1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fs.company.mapper.CompanyMoneyLogsMapper">
-
- <resultMap type="CompanyMoneyLogs" id="CompanyMoneyLogsResult">
- <result property="logsId" column="logs_id" />
- <result property="companyId" column="company_id" />
- <result property="money" column="money" />
- <result property="balance" column="balance" />
- <result property="remark" column="remark" />
- <result property="createTime" column="create_time" />
- <result property="logsType" column="logs_type" />
- <result property="businessId" column="business_id" />
- </resultMap>
- <sql id="selectCompanyMoneyLogsVo">
- select logs_id, company_id, money,balance, remark, create_time,logs_type,business_id from company_money_logs
- </sql>
- <select id="selectCompanyMoneyLogsList" parameterType="CompanyMoneyLogs" resultMap="CompanyMoneyLogsResult">
- <include refid="selectCompanyMoneyLogsVo"/>
- <where>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="money != null "> and money = #{money}</if>
- </where>
- </select>
-
- <select id="selectCompanyMoneyLogsById" parameterType="Long" resultMap="CompanyMoneyLogsResult">
- <include refid="selectCompanyMoneyLogsVo"/>
- where logs_id = #{logsId}
- </select>
- <select id="selectCompanyRedPackageListVO" resultType="com.fs.company.domain.CompanyRedPackage">
- select sum(l.amount) as totalAmount,u.nick_name as nickName,c.company_name as companyName
- from fs_course_red_packet_log l
- LEFT JOIN company_user u on l.company_user_id =u.user_id
- left join company c on l.company_id = c.company_id
- where
- u.user_id is not null and l.status=1
- <if test="companyId != null">
- and l.company_id = #{companyId}
- </if>
- <if test="dateTime != null">
- and DATE_FORMAT(l.create_time,'%Y-%m-%d') like concat(#{dateTime}, '%')
- </if>
- GROUP BY l.company_user_id
- order by c.company_id,u.user_id
- </select>
- <insert id="insertCompanyMoneyLogs" parameterType="CompanyMoneyLogs" useGeneratedKeys="true" keyProperty="logsId">
- insert into company_money_logs
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="companyId != null">company_id,</if>
- <if test="money != null">money,</if>
- <if test="balance != null">balance,</if>
- <if test="remark != null">remark,</if>
- <if test="createTime != null">create_time,</if>
- <if test="logsType != null">logs_type,</if>
- <if test="businessId != null">business_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="companyId != null">#{companyId},</if>
- <if test="money != null">#{money},</if>
- <if test="balance != null">#{balance},</if>
- <if test="remark != null">#{remark},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="logsType != null">#{logsType},</if>
- <if test="businessId != null">#{businessId},</if>
- </trim>
- </insert>
- <update id="updateCompanyMoneyLogs" parameterType="CompanyMoneyLogs">
- update company_money_logs
- <trim prefix="SET" suffixOverrides=",">
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="money != null">money = #{money},</if>
- <if test="balance != null">balance = #{balance},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="logsType != null">logs_type = #{logsType},</if>
- <if test="businessId != null">business_id = #{businessId},</if>
- </trim>
- where logs_id = #{logsId}
- </update>
- <delete id="deleteCompanyMoneyLogsById" parameterType="Long">
- delete from company_money_logs where logs_id = #{logsId}
- </delete>
- <delete id="deleteCompanyMoneyLogsByIds" parameterType="String">
- delete from company_money_logs where logs_id in
- <foreach item="logsId" collection="array" open="(" separator="," close=")">
- #{logsId}
- </foreach>
- </delete>
-
- </mapper>
|