TemplateConfigurationParametersMapper.xml 13.6 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.templateConfigurationParameters.mapper.TemplateConfigurationParametersMapper">

    <resultMap type="TemplateConfigurationParameters" id="TemplateConfigurationParametersResult">
        <result property="id"    column="id"    />
        <result property="templateId"    column="template_id"    />
        <result property="orgId"    column="org_id"    />
        <result property="typeId"    column="type_id"    />
        <result property="typeName"    column="type_name"    />
        <result property="clientType"    column="client_type"    />
        <result property="typePrice"    column="type_price"    />
        <result property="reportPrice"    column="report_price"    />
        <result property="deliveryDays"    column="delivery_days"    />
        <result property="reportTranslationType"    column="report_translation_type"    />
        <result property="price"    column="price"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="clientId"    column="client_id"    />
        <result property="checked"    column="checked"    />
        <result property="status"    column="status"    />
    </resultMap>

	<sql id="selectTemplateConfigurationParametersVo">
        select id, template_id, type_id, type_name, client_type,client_id,checked, type_price, report_price, delivery_days, report_translation_type, price, create_time, create_by, update_time, update_by ,status from template_configuration_parameters
    </sql>

    <select id="selectTemplateConfigurationParametersList" parameterType="TemplateConfigurationParameters" resultMap="TemplateConfigurationParametersResult">
        <include refid="selectTemplateConfigurationParametersVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="templateId != null "> and template_id = #{templateId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="typeId != null "> and type_id = #{typeId}</if>
            <if test="typeName != null and typeName != '' "> and type_name = #{typeName}</if>
            <if test="clientType != null and clientType != '' "> and client_type = #{clientType}</if>
            <if test="typePrice != null "> and type_price = #{typePrice}</if>
            <if test="clientId != null "> and client_id = #{clientId}</if>
            <if test="checked != null "> and checked = #{checked}</if>
            <if test="reportPrice != null "> and report_price = #{reportPrice}</if>
            <if test="deliveryDays != null "> and delivery_days = #{deliveryDays}</if>
            <if test="reportTranslationType != null and reportTranslationType != '' "> and report_translation_type = #{reportTranslationType}</if>
            <if test="price != null "> and price = #{price}</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>
            and status = 0
        </where>
        ORDER BY
        type_id ASC,
        client_id ASC,
        CASE client_type
        WHEN 3 THEN 1
        WHEN 0 THEN 2
        WHEN 1 THEN 3
        WHEN 2 THEN 4
        WHEN 4 THEN 5
        ELSE 6
        END
        ;

    </select>

    <select id="selectTemplateConfigurationParametersById" parameterType="String" resultMap="TemplateConfigurationParametersResult">
        <include refid="selectTemplateConfigurationParametersVo"/>
        where id = #{id}
    </select>
    <select id="selectTemplateConfigurationParametersClientIds"
            resultType="com.lhcredit.project.business.templateConfigurationParameters.domain.TemplateConfigurationParameters"
            parameterType="String">
        <include refid="selectTemplateConfigurationParametersVo"/>
        where client_id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>

    <insert id="insertTemplateConfigurationParameters" parameterType="TemplateConfigurationParameters" useGeneratedKeys="true" keyProperty="id">
        insert into template_configuration_parameters
		<trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''  ">id,</if>
			<if test="templateId != null  ">template_id,</if>
			<if test="orgId != null  ">org_id,</if>
			<if test="typeId != null  ">type_id,</if>
			<if test="typeName != null  and typeName != ''  ">type_name,</if>
			<if test="clientType != null  and clientType != ''  ">client_type,</if>
			<if test="typePrice != null  ">type_price,</if>
			<if test="reportPrice != null   ">report_price,</if>
            <if test="clientId != null   ">client_id,</if>
            <if test="checked != null  ">checked,</if>
			<if test="deliveryDays != null  ">delivery_days,</if>
			<if test="reportTranslationType != null  and reportTranslationType != ''  ">report_translation_type,</if>
			<if test="price != null   ">price,</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>
            <if test="status != null  and status != ''  ">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''  ">#{id},</if>
			<if test="templateId != null  ">#{templateId},</if>
			<if test="orgId != null  ">#{orgId},</if>
			<if test="typeId != null  ">#{typeId},</if>
			<if test="typeName != null  and typeName != ''  ">#{typeName},</if>
			<if test="clientType != null  and clientType != ''  ">#{clientType},</if>
			<if test="typePrice != null  ">#{typePrice},</if>
			<if test="reportPrice != null ">#{reportPrice},</if>
            <if test="clientId != null ">#{clientId},</if>
            <if test="checked != null  ">#{checked},</if>
			<if test="deliveryDays != null  ">#{deliveryDays},</if>
			<if test="reportTranslationType != null  and reportTranslationType != ''  ">#{reportTranslationType},</if>
			<if test="price != null  ">#{price},</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>
            <if test="status != null  and status != ''  ">#{status},</if>
         </trim>
    </insert>
    <insert id="batchInsertTemplateConfigurationParameters" parameterType="java.util.List">
        INSERT INTO template_configuration_parameters
        <foreach collection="list" item="item" separator=",">
            <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="item.templateId != null">template_id,</if>
                <if test="item.typeId != null">type_id,</if>
                <if test="item.typeName != null and item.typeName != ''">type_name,</if>
                <if test="item.clientType != null and item.clientType != ''">client_type,</if>
                <if test="item.typePrice != null">type_price,</if>
                <if test="item.clientId != null">client_id,</if>
                <if test="item.checked != null">checked,</if>
                <if test="item.deliveryDays != null">delivery_days,</if>
                <if test="item.reportTranslationType != null and item.reportTranslationType != ''">report_translation_type,</if>
                <if test="item.price != null">price,</if>
                <if test="item.createTime != null">create_time,</if>
                <if test="item.createBy != null and item.createBy != ''">create_by,</if>
                <if test="item.updateTime != null">update_time,</if>
                <if test="item.updateBy != null and item.updateBy != ''">update_by,</if>
                <if test="item.status != null and item.status != ''">status,</if>
            </trim>
            <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
                <if test="item.templateId != null">#{item.templateId},</if>
                <if test="item.typeId != null">#{item.typeId},</if>
                <if test="item.typeName != null and item.typeName != ''">#{item.typeName},</if>
                <if test="item.clientType != null and item.clientType != ''">#{item.clientType},</if>
                <if test="item.typePrice != null">#{item.typePrice},</if>
                <if test="item.clientId != null">#{item.clientId},</if>
                <if test="item.checked != null">#{item.checked},</if>
                <if test="item.deliveryDays != null">#{item.deliveryDays},</if>
                <if test="item.reportTranslationType != null and item.reportTranslationType != ''">#{item.reportTranslationType},</if>
                <if test="item.price != null">#{item.price},</if>
                <if test="item.createTime != null">#{item.createTime},</if>
                <if test="item.createBy != null and item.createBy != ''">#{item.createBy},</if>
                <if test="item.updateTime != null">#{item.updateTime},</if>
                <if test="item.updateBy != null and item.updateBy != ''">#{item.updateBy},</if>
                <if test="item.status != null and item.status != ''">#{item.status},</if>
            </trim>
        </foreach>
    </insert>



    <update id="updateTemplateConfigurationParameters" parameterType="TemplateConfigurationParameters">
        update template_configuration_parameters
        <trim prefix="SET" suffixOverrides=",">
            <if test="templateId != null  ">template_id = #{templateId},</if>
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="typeId != null  ">type_id = #{typeId},</if>
            <if test="typeName != null  and typeName != ''  ">type_name = #{typeName},</if>
            <if test="clientType != null  and clientType != ''  ">client_type = #{clientType},</if>
            <if test="typePrice != null  ">type_price = #{typePrice},</if>
            <if test="clientId != null   ">client_id = #{clientId},</if>
            <if test="checked != null  ">checked = #{checked},</if>
            <if test="reportPrice != null   ">report_price = #{reportPrice},</if>
            <if test="deliveryDays != null  ">delivery_days = #{deliveryDays},</if>
            <if test="reportTranslationType != null  and reportTranslationType != ''  ">report_translation_type = #{reportTranslationType},</if>
            <if test="price != null   ">price = #{price},</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>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="updateTemplateConfigurationParametersNameAndStatus" parameterType="TemplateConfigurationParameters">
        update template_configuration_parameters
        <trim prefix="SET" suffixOverrides=",">
            <if test="templateId != null  ">template_id = #{templateId},</if>
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="typeId != null  ">type_id = #{typeId},</if>
            <if test="typeName != null  and typeName != ''  ">type_name = #{typeName},</if>
            <if test="clientType != null  and clientType != ''  ">client_type = #{clientType},</if>
            <if test="typePrice != null  ">type_price = #{typePrice},</if>
            <if test="clientId != null   ">client_id = #{clientId},</if>
            <if test="checked != null  ">checked = #{checked},</if>
            <if test="reportPrice != null   ">report_price = #{reportPrice},</if>
            <if test="deliveryDays != null  ">delivery_days = #{deliveryDays},</if>
            <if test="reportTranslationType != null  and reportTranslationType != ''  ">report_translation_type = #{reportTranslationType},</if>
            <if test="price != null   ">price = #{price},</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>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where client_id = #{clientId}
    </update>

    <delete id="deleteTemplateConfigurationParametersById" parameterType="Long">
        delete from template_configuration_parameters where id = #{id}
    </delete>

    <delete id="deleteTemplateConfigurationParametersByOrgId" parameterType="Long">
        delete from template_configuration_parameters where org_id = #{OrgId}
    </delete>
    <delete id="deleteTemplateConfigurationParametersByIds" parameterType="String">
        delete from template_configuration_parameters where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>