TemplateConfigurationMapper.xml 7.29 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.lhcredit.project.business.templateConfiguration.mapper.TemplateConfigurationMapper">

    <resultMap type="TemplateConfiguration" id="TemplateConfigurationResult">
        <result property="id"    column="id"    />
        <result property="orgId"    column="org_id"    />
        <result property="contractId"    column="contract_id"    />
        <result property="owner"    column="owner"    />
        <result property="typeId"    column="type_id"    />
        <result property="serviceRemark"    column="service_remark"    />
        <result property="contractRemark"    column="contract_remark"    />
        <result property="contractName"    column="contract_name"    />
        <result property="reportForm"    column="report_form"    />
        <result property="clientId"    column="client_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

	<sql id="selectTemplateConfigurationVo">
        select id, org_id, contract_id, owner, contract_name,contract_remark,service_remark,type_id, report_form, client_id, create_time, create_by, update_time, update_by from template_configuration
    </sql>

    <select id="selectTemplateConfigurationList" parameterType="TemplateConfiguration" resultMap="TemplateConfigurationResult">
        <include refid="selectTemplateConfigurationVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="contractId != null "> and contract_id = #{contractId}</if>
            <if test="owner != null  and owner != '' "> and owner = #{owner}</if>
            <if test="serviceRemark != null  and serviceRemark != '' "> and service_remark = #{serviceRemark}</if>
            <if test="contractRemark != null  and contractRemark != '' "> and contract_remark = #{contractRemark}</if>
            <if test="contractName != null  and contractName != '' "> and contract_name = #{contractName}</if>
            <if test="typeId != null  and typeId != '' "> and type_id = #{typeId}</if>
            <if test="reportForm != null  and reportForm != '' "> and report_form = #{reportForm}</if>
            <if test="clientId != null  and clientId != '' "> and client_id = #{clientId}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="createBy != null  and createBy != '' "> and create_by = #{createBy}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
        </where>
    </select>

    <select id="selectTemplateConfigurationById" parameterType="Long" resultMap="TemplateConfigurationResult">
        <include refid="selectTemplateConfigurationVo"/>
        where id = #{id}
    </select>

    <select id="getTemppConfByOrg" parameterType="Long" resultMap="TemplateConfigurationResult">
        <include refid="selectTemplateConfigurationVo"/>
        <where>
            <if test="orgId != null "> and org_id = #{orgId}</if>
        </where>
    </select>

    <insert id="insertTemplateConfiguration" parameterType="TemplateConfiguration" useGeneratedKeys="true" keyProperty="id">
        insert into template_configuration
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orgId != null  ">org_id,</if>
            <if test="contractId != null  ">contract_id,</if>
            <if test="owner != null  and owner != ''  ">owner,</if>
            <if test="typeId != null  and typeId != ''  ">type_id,</if>
            <if test="serviceRemark != null  and serviceRemark != '' ">  service_remark ,</if>
            <if test="contractRemark != null  and contractRemark != '' "> contract_remark ,</if>
            <if test="contractName != null  and contractName != '' "> contract_name ,</if>
            <if test="reportForm != null  and reportForm != ''  ">report_form,</if>
            <if test="clientId != null  and clientId != ''  ">client_id,</if>
            <if test="createTime != null  ">create_time,</if>
            <if test="createBy != null  and createBy != ''  ">create_by,</if>
            <if test="updateTime != null  ">update_time,</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orgId != null  ">#{orgId},</if>
            <if test="contractId != null  ">#{contractId},</if>
            <if test="owner != null  and owner != ''  ">#{owner},</if>
            <if test="typeId != null  and typeId != ''  ">#{typeId},</if>
            <if test="serviceRemark != null  and serviceRemark != '' ">  #{serviceRemark},</if>
            <if test="contractRemark != null  and contractRemark != '' "> #{contractRemark}, </if>
            <if test="contractName != null  and contractName != '' "> #{contractName},</if>
            <if test="reportForm != null  and reportForm != ''  ">#{reportForm},</if>
            <if test="clientId != null  and clientId != ''  ">#{clientId},</if>
            <if test="createTime != null  ">#{createTime},</if>
            <if test="createBy != null  and createBy != ''  ">#{createBy},</if>
            <if test="updateTime != null  ">#{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">#{updateBy},</if>
        </trim>
    </insert>


    <update id="updateTemplateConfiguration" parameterType="TemplateConfiguration">
        update template_configuration
        <trim prefix="SET" suffixOverrides=",">
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="contractId != null  ">contract_id = #{contractId},</if>
            <if test="owner != null ">owner = #{owner},</if>
            <if test="serviceRemark != null ">  service_remark = #{serviceRemark},</if>
            <if test="contractRemark != null "> contract_remark = #{contractRemark}, </if>
            <if test="contractName != null "> contract_name = #{contractName},</if>
            type_id = #{typeId},
            <if test="reportForm != null  and reportForm != ''  ">report_form = #{reportForm},</if>
            <if test="clientId != null  ">client_id = #{clientId},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="createBy != null  and createBy != ''  ">create_by = #{createBy},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteTemplateConfigurationById" parameterType="Long">
        delete from template_configuration where id = #{id}
    </delete>

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

</mapper>