CreditMonitorWcqkMapper.xml 8.35 KB
<?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.credit.cy.business.mapper.CreditMonitorWcqkMapper">
    
    <resultMap type="CreditMonitorWcqk" id="CreditMonitorWcqkResult">
        <result property="id"    column="id"    />
        <result property="parentId"    column="parent_id"    />
        <result property="hyqk1"    column="hyqk_1"    />
        <result property="hyqkNo1"    column="hyqk_no1"    />
        <result property="hyqk2"    column="hyqk_2"    />
        <result property="hyqkNo2"    column="hyqk_no2"    />
        <result property="fgqk"    column="fgqk"    />
        <result property="fgqkNo"    column="fgqk_no"    />
        <result property="fgwcqk"    column="fgwcqk"    />
        <result property="fgwcqkNo"    column="fgwcqk_no"    />
        <result property="reportDate"    column="report_date"    />
        <result property="reportDept"    column="report_dept"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectCreditMonitorWcqkVo">
        select id, parent_id, hyqk_1, hyqk_no1, hyqk_2, hyqk_no2, fgqk, fgqk_no, fgwcqk, fgwcqk_no, report_date, report_dept, check_status, create_by, create_time, del_flag from credit_monitor_wcqk
    </sql>

    <select id="selectCreditMonitorWcqkList" parameterType="CreditMonitorWcqk" resultMap="CreditMonitorWcqkResult">
        <include refid="selectCreditMonitorWcqkVo"/>
        <where>
            and parent_id = #{parentId}
            <if test="hyqk1 != null  and hyqk1 != ''"> and hyqk_1 = #{hyqk1}</if>
            <if test="reportDate != null "> and report_date = #{reportDate}</if>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="checkStatus != null "> and check_status = #{checkStatus}</if>
        </where>
    </select>
    
    <select id="selectCreditMonitorWcqkById" parameterType="Long" resultMap="CreditMonitorWcqkResult">
        <include refid="selectCreditMonitorWcqkVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCreditMonitorWcqk" parameterType="CreditMonitorWcqk" useGeneratedKeys="true" keyProperty="id">
        insert into credit_monitor_wcqk
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parentId != null">parent_id,</if>
            <if test="hyqk1 != null">hyqk_1,</if>
            <if test="hyqkNo1 != null">hyqk_no1,</if>
            <if test="hyqk2 != null">hyqk_2,</if>
            <if test="hyqkNo2 != null">hyqk_no2,</if>
            <if test="fgqk != null">fgqk,</if>
            <if test="fgqkNo != null">fgqk_no,</if>
            <if test="fgwcqk != null">fgwcqk,</if>
            <if test="fgwcqkNo != null">fgwcqk_no,</if>
            <if test="reportDate != null">report_date,</if>
            <if test="reportDept != null">report_dept,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parentId != null">#{parentId},</if>
            <if test="hyqk1 != null">#{hyqk1},</if>
            <if test="hyqkNo1 != null">#{hyqkNo1},</if>
            <if test="hyqk2 != null">#{hyqk2},</if>
            <if test="hyqkNo2 != null">#{hyqkNo2},</if>
            <if test="fgqk != null">#{fgqk},</if>
            <if test="fgqkNo != null">#{fgqkNo},</if>
            <if test="fgwcqk != null">#{fgwcqk},</if>
            <if test="fgwcqkNo != null">#{fgwcqkNo},</if>
            <if test="reportDate != null">#{reportDate},</if>
            <if test="reportDept != null">#{reportDept},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateCreditMonitorWcqk" parameterType="CreditMonitorWcqk">
        update credit_monitor_wcqk
        <trim prefix="SET" suffixOverrides=",">
            <if test="parentId != null">parent_id = #{parentId},</if>
            <if test="hyqk1 != null">hyqk_1 = #{hyqk1},</if>
            <if test="hyqkNo1 != null">hyqk_no1 = #{hyqkNo1},</if>
            <if test="hyqk2 != null">hyqk_2 = #{hyqk2},</if>
            <if test="hyqkNo2 != null">hyqk_no2 = #{hyqkNo2},</if>
            <if test="fgqk != null">fgqk = #{fgqk},</if>
            <if test="fgqkNo != null">fgqk_no = #{fgqkNo},</if>
            <if test="fgwcqk != null">fgwcqk = #{fgwcqk},</if>
            <if test="fgwcqkNo != null">fgwcqk_no = #{fgwcqkNo},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCreditMonitorWcqkById" parameterType="Long">
        delete from credit_monitor_wcqk where id = #{id}
    </delete>

    <delete id="deleteCreditMonitorWcqkByIds" parameterType="String">
        delete from credit_monitor_wcqk where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectDataByIdList" parameterType="Long" resultMap="CreditMonitorWcqkResult">
        <include refid="selectCreditMonitorWcqkVo"/> where id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <update id="checkReport" parameterType="Long">
        update credit_monitor_wcqk set check_status = 2, report_date = now()
        where id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
        and check_status = 1
    </update>

    <insert id="batchSave" parameterType="java.util.List">
        insert into credit_monitor_wcqk (id,parent_id, hyqk_1, hyqk_no1, hyqk_2, hyqk_no2, fgqk, fgqk_no, fgwcqk, fgwcqk_no, report_date, report_dept,create_by, create_time)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.id},#{item.parentId},#{item.hyqk1},#{item.hyqkNo1},#{item.hyqk2},#{item.hyqkNo2},#{item.fgqk},
            #{item.fgqkNo},#{item.fgwcqk},#{item.fgwcqkNo},#{item.reportDate},#{item.reportDept},#{item.createBy},#{item.createTime})
        </foreach>
    </insert>

    <select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(1) from credit_monitor_wcqk
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
    </select>

    <select id="selectDeptCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(distinct report_dept) from credit_monitor_wcqk
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
    </select>

    <select id="selectGroupCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="com.credit.cy.business.model.GroupNumResult">
        select report_dept as dept,count(1) as total from credit_monitor_wcqk
        <where>
            <if test="reportDept != null  and reportDept != ''"> and report_dept = #{reportDept}</if>
            <if test="null!=reportStartDate"> and report_date >= #{reportStartDate}</if>
            <if test="null!=reportEndDate"> AND report_date <![CDATA[<=]]> #{reportEndDate}</if>
        </where>
        group by report_dept
    </select>
</mapper>