ProcessTemplateMapper.xml 4.94 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.chinagas.modules.zjwjsb.mapper.ProcessTemplateMapper">


    <select id="selectTemplateList" resultType="ProcessTemplate">
        select template_id,template_name,upload_period,process_type,biz_type,parent_id,type,ancestors from zjwjsb_process_template
        where del_flag = '0' and type = 'P'
    </select>

    <select id="selectProcessTemplateList" resultType="ProcessTemplate">
        select template_id,template_name,upload_period,process_type,biz_type,parent_id,type,ancestors from zjwjsb_process_template
        where del_flag = '0'
        <if test="templateId != null and templateId != ''">
            and template_id = #{templateId}
        </if>
        <if test="templateName != null and templateName != ''">
            and template_name = #{templateName}
        </if>
        <if test="uploadPeriod != null and uploadPeriod != ''">
            and upload_period = #{uploadPeriod}
        </if>
        <if test="processType != null and processType != ''">
            and process_type = #{processType}
        </if>
        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
        </if>
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
        </if>
    </select>

    <insert id="insertProcessTemplate" parameterType="ProcessTemplate">
        insert into zjwjsb_process_template(
<!--        <if test=" templateId   != null and templateId   != ''">template_id,</if>-->
        <if test=" templateName != null and templateName != ''">template_name,</if>
        <if test=" uploadPeriod != null and uploadPeriod != ''">upload_period,</if>
        <if test="processType != null and processType != ''">
            process_type,
        </if>
        <if test="parentId != null and parentId != ''">
            parent_id,
        </if>
        <if test="type != null and type != ''">
            type,
        </if>
        <if test="ancestors != null and ancestors != ''">
            ancestors,
        </if>
                biz_type,
                                            create_by,
                                            create_time
        ) values(
                <if test=" templateId   != null and templateId   != ''">#{templateId  },</if>
                <if test=" templateName != null and templateName != ''">#{templateName},</if>
        <if test=" uploadPeriod != null and uploadPeriod != ''">#{uploadPeriod},</if>
        <if test="processType != null and processType != ''">
            #{processType},
        </if>
        <if test="parentId != null and parentId != ''">
            #{parentId},
        </if>
        <if test="type != null and type != ''">
            #{type},
        </if>
        <if test="ancestors != null and ancestors != ''">
            #{ancestors},
        </if>
                 #{bizType},
                 #{createBy},
                 sysdate()
    )
    </insert>

    <update id="updateProcessTemplate" parameterType="ProcessTemplate">
        update zjwjsb_process_template set
        <if test=" templateName != null and templateName != ''">template_name=#{templateName},</if>
        <if test=" updateBy != null and updateBy != ''">template_name=#{templateName},</if>
        <if test=" uploadPeriod != null and uploadPeriod != ''">upload_period=#{uploadPeriod},</if>
        <if test="processType != null and processType != ''">
             process_type = #{processType},
        </if>
        <if test="parentId != null and parentId != ''">
            parent_id = #{parentId},
        </if>
        <if test="type != null and type != ''">
            type = #{type},
        </if>
        <if test="ancestors != null and ancestors != ''">
            ancestors = #{ancestors},
        </if>
        <if test="bizType != null and bizType != ''">
            biz_type = #{bizType},
        </if>
                                           update_time = sysdate()
    where template_id=#{templateId}
    </update>

    <update id="deleteProcessTemplateById" parameterType="Long">
        update zjwjsb_process_template set del_flag = '1' where template_id = #{templateId}
    </update>

    <select id="selectProcessTemplateById" parameterType="Long" resultType="ProcessTemplate">
        select template_id,template_name,upload_period,process_type,biz_type,parent_Id,type,ancestors from zjwjsb_process_template
        where del_flag = '0' and template_id=#{templateId}
    </select>


    <select id="selectProcessType" resultType="ProcessTemplate">
        select template_id,template_name,parent_id,type,ancestors from zjwjsb_process_template
        where del_flag = '0' and type = 'T'
    </select>
</mapper>