CreditCityNormMapper.xml 10.3 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.CreditCityNormMapper">
    
    <resultMap type="CreditCityNorm" id="CreditCityNormResult">
        <result property="id"    column="id"    />
        <result property="parentId"    column="parent_id"    />
        <result property="project"    column="project"    />
        <result property="score"    column="score"    />
        <result property="normIndex"    column="norm_index"    />
        <result property="normContent"    column="norm_content"    />
        <result property="scoreStandard"    column="score_standard"    />
        <result property="layerBelong"    column="layer_belong"    />
        <result property="contentType"    column="content_type"    />
        <result property="responsibleUnit"    column="responsible_unit"    />
        <result property="responsibleName"    column="responsible_name"    />
        <result property="memo"    column="memo"    />
        <result property="reportDate"    column="report_date"    />
        <result property="reportDept"    column="report_dept"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="point"    column="point"    />
    </resultMap>

    <sql id="selectCreditCityNormVo">
        select id, parent_id, project, score, norm_index, norm_content, score_standard, layer_belong, content_type, responsible_unit, responsible_name, memo, report_date, report_dept, check_status, del_flag, create_by, create_time, update_by, update_time, point from credit_city_norm
    </sql>

    <select id="selectCreditCityNormList" parameterType="CreditCityNorm" resultMap="CreditCityNormResult">
        <include refid="selectCreditCityNormVo"/>
        <where>  
            <if test="parentId != null "> and parent_id = #{parentId}</if>
            <if test="project != null  and project != ''"> and project = #{project}</if>
            <if test="score != null "> and score = #{score}</if>
            <if test="normIndex != null  and normIndex != ''"> and norm_index = #{normIndex}</if>
            <if test="normContent != null  and normContent != ''"> and norm_content = #{normContent}</if>
            <if test="scoreStandard != null  and scoreStandard != ''"> and score_standard = #{scoreStandard}</if>
            <if test="layerBelong != null  and layerBelong != ''"> and layer_belong = #{layerBelong}</if>
            <if test="contentType != null  and contentType != ''"> and content_type = #{contentType}</if>
            <if test="responsibleUnit != null  and responsibleUnit != ''"> and responsible_unit = #{responsibleUnit}</if>
            <if test="responsibleName != null  and responsibleName != ''"> and responsible_name = #{responsibleName}</if>
            <if test="memo != null  and memo != ''"> and memo = #{memo}</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="getCreditCityNormAndUploadFile" parameterType="CreditCityNorm" resultType="CreditCityNorm">
        SELECT
            n.project AS 'project',
                n.norm_index AS 'normIndex',
                n.parent_id AS 'parentId',
                n.norm_content AS 'normContent',
                n.content_type AS 'contentType',
                n.score_standard AS 'scoreStandard',
                n.responsible_name AS 'responsibleName',
                n.check_status AS 'checkStatus',
                m.file_name AS 'fileName',
                m.upload_dept AS 'responsibleUnit',
                d.dept_name AS 'reportDept'

        FROM
            credit_city_norm n
                JOIN credit_multi_file m ON n.id = m.b_id
                JOIN sys_dept d ON m.upload_dept = d.dept_id
        WHERE
            m.b_type = "city_norm"
          AND n.parent_id = #{parentId}
    </select>

    <select id="selectCreditCityNormById" parameterType="Long" resultMap="CreditCityNormResult">
        <include refid="selectCreditCityNormVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCreditCityNorm" parameterType="CreditCityNorm" useGeneratedKeys="true" keyProperty="id">
        insert into credit_city_norm
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parentId != null">parent_id,</if>
            <if test="project != null and project != ''">project,</if>
            <if test="score != null">score,</if>
            <if test="normIndex != null and normIndex != ''">norm_index,</if>
            <if test="normContent != null and normContent != ''">norm_content,</if>
            <if test="scoreStandard != null and scoreStandard != ''">score_standard,</if>
            <if test="layerBelong != null and layerBelong != ''">layer_belong,</if>
            <if test="contentType != null and contentType != ''">content_type,</if>
            <if test="responsibleUnit != null and responsibleUnit != ''">responsible_unit,</if>
            <if test="responsibleName != null and responsibleName != ''">responsible_name,</if>
            <if test="memo != null">memo,</if>
            <if test="reportDate != null">report_date,</if>
            <if test="reportDept != null">report_dept,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="point != null">point,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parentId != null">#{parentId},</if>
            <if test="project != null and project != ''">#{project},</if>
            <if test="score != null">#{score},</if>
            <if test="normIndex != null and normIndex != ''">#{normIndex},</if>
            <if test="normContent != null and normContent != ''">#{normContent},</if>
            <if test="scoreStandard != null and scoreStandard != ''">#{scoreStandard},</if>
            <if test="layerBelong != null and layerBelong != ''">#{layerBelong},</if>
            <if test="contentType != null and contentType != ''">#{contentType},</if>
            <if test="responsibleUnit != null and responsibleUnit != ''">#{responsibleUnit},</if>
            <if test="responsibleName != null and responsibleName != ''">#{responsibleName},</if>
            <if test="memo != null">#{memo},</if>
            <if test="reportDate != null">#{reportDate},</if>
            <if test="reportDept != null">#{reportDept},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="point != null">#{point},</if>
         </trim>
    </insert>

    <update id="updateCreditCityNorm" parameterType="CreditCityNorm">
        update credit_city_norm
        <trim prefix="SET" suffixOverrides=",">
            <if test="parentId != null">parent_id = #{parentId},</if>
            <if test="project != null and project != ''">project = #{project},</if>
            <if test="score != null">score = #{score},</if>
            <if test="normIndex != null and normIndex != ''">norm_index = #{normIndex},</if>
            <if test="normContent != null and normContent != ''">norm_content = #{normContent},</if>
            <if test="scoreStandard != null and scoreStandard != ''">score_standard = #{scoreStandard},</if>
            <if test="layerBelong != null and layerBelong != ''">layer_belong = #{layerBelong},</if>
            <if test="contentType != null and contentType != ''">content_type = #{contentType},</if>
            <if test="responsibleUnit != null and responsibleUnit != ''">responsible_unit = #{responsibleUnit},</if>
            <if test="responsibleName != null and responsibleName != ''">responsible_name = #{responsibleName},</if>
            <if test="memo != null">memo = #{memo},</if>
            <if test="reportDate != null">report_date = #{reportDate},</if>
            <if test="reportDept != null">report_dept = #{reportDept},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="point != null">point = #{point},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCreditCityNormById" parameterType="Long">
        delete from credit_city_norm where id = #{id}
    </delete>

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

    <select id="selectCount" parameterType="com.credit.cy.business.model.query.WorkCountQuery" resultType="java.lang.Long">
        select count(1) from credit_city_norm
        <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>
</mapper>