TInsRecInforMapper.xml 7.5 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?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.zehong.system.mapper.TInsRecInforMapper">
    
    <resultMap type="TInsRecInfor" id="TInsRecInforResult">
        <result property="fInsRecInforId"    column="f_ins_rec_infor_id"    />
        <result property="fCheckCode"    column="f_check_code"    />
        <result property="fCheckTaskCode"    column="f_check_task_code"    />
        <result property="fRegionCode"    column="f_region_code"    />
        <result property="fObjectType"    column="f_object_type"    />
        <result property="fObjectCode"    column="f_object_code"    />
        <result property="fCheckUserId"    column="f_check_user_id"    />
        <result property="fCheckManName"    column="f_check_man_name"    />
        <result property="fCheckManPhone"    column="f_check_man_phone"    />
        <result property="fCheckTime"    column="f_check_time"    />
        <result property="fHazardsNum"    column="f_hazards_num"    />
        <result property="fDoscNeedExecute"    column="f_dosc_need_execute"    />
        <result property="fAnnex"    column="f_annex"    />
        <result property="fLastUpdateTime"    column="f_last_update_time"    />
        <result property="fRemark"    column="f_remark"    />
    </resultMap>

    <sql id="selectTInsRecInforVo">
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
        SELECT
            rec.f_ins_rec_infor_id,
            rec.f_check_code,
            rec.f_check_task_code,
            rec.f_region_code,
            rec.f_object_type,
            rec.f_object_code,
            rec.f_check_user_id,
            rec.f_check_man_name,
            rec.f_check_man_phone,
            rec.f_check_time,
            rec.f_hazards_num,
            rec.f_dosc_need_execute,
            rec.f_annex,
            rec.f_last_update_time,
            rec.f_remark,
            task.f_name as taskName,
            (select f_name from t_county_level_region where f_county_code = rec.f_region_code) AS countyName
        FROM
            t_ins_rec_infor rec
        LEFT JOIN t_ins_task_infor task ON task.f_unique_code = rec.f_check_task_code
耿迪迪's avatar
耿迪迪 committed
47 48 49 50 51
    </sql>

    <select id="selectTInsRecInforList" parameterType="TInsRecInfor" resultMap="TInsRecInforResult">
        <include refid="selectTInsRecInforVo"/>
        <where>  
52 53 54 55
            <if test="fCheckCode != null  and fCheckCode != ''"> and rec.f_check_code = #{fCheckCode}</if>
            <if test="fObjectType != null  and fObjectType != ''"> and rec.f_object_type = #{fObjectType}</if>
            <if test="fCheckManName != null  and fCheckManName != ''"> and rec.f_check_man_name like concat('%', #{fCheckManName}, '%')</if>
            <if test="fCheckManPhone != null  and fCheckManPhone != ''"> and rec.f_check_man_phone like concat('%', #{fCheckManPhone}, '%')</if>
耿迪迪's avatar
耿迪迪 committed
56
        </where>
耿迪迪's avatar
耿迪迪 committed
57
        ORDER BY f_last_update_time DESC
耿迪迪's avatar
耿迪迪 committed
58 59 60 61
    </select>
    
    <select id="selectTInsRecInforById" parameterType="Long" resultMap="TInsRecInforResult">
        <include refid="selectTInsRecInforVo"/>
62
        where rec.f_ins_rec_infor_id = #{fInsRecInforId}
耿迪迪's avatar
耿迪迪 committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
    </select>
        
    <insert id="insertTInsRecInfor" parameterType="TInsRecInfor" useGeneratedKeys="true" keyProperty="fInsRecInforId">
        insert into t_ins_rec_infor
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fCheckCode != null and fCheckCode != ''">f_check_code,</if>
            <if test="fCheckTaskCode != null and fCheckTaskCode != ''">f_check_task_code,</if>
            <if test="fRegionCode != null and fRegionCode != ''">f_region_code,</if>
            <if test="fObjectType != null and fObjectType != ''">f_object_type,</if>
            <if test="fObjectCode != null and fObjectCode != ''">f_object_code,</if>
            <if test="fCheckUserId != null and fCheckUserId != ''">f_check_user_id,</if>
            <if test="fCheckManName != null and fCheckManName != ''">f_check_man_name,</if>
            <if test="fCheckManPhone != null">f_check_man_phone,</if>
            <if test="fCheckTime != null and fCheckTime != ''">f_check_time,</if>
            <if test="fHazardsNum != null">f_hazards_num,</if>
            <if test="fDoscNeedExecute != null">f_dosc_need_execute,</if>
            <if test="fAnnex != null">f_annex,</if>
            <if test="fLastUpdateTime != null">f_last_update_time,</if>
            <if test="fRemark != null">f_remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fCheckCode != null and fCheckCode != ''">#{fCheckCode},</if>
            <if test="fCheckTaskCode != null and fCheckTaskCode != ''">#{fCheckTaskCode},</if>
            <if test="fRegionCode != null and fRegionCode != ''">#{fRegionCode},</if>
            <if test="fObjectType != null and fObjectType != ''">#{fObjectType},</if>
            <if test="fObjectCode != null and fObjectCode != ''">#{fObjectCode},</if>
            <if test="fCheckUserId != null and fCheckUserId != ''">#{fCheckUserId},</if>
            <if test="fCheckManName != null and fCheckManName != ''">#{fCheckManName},</if>
            <if test="fCheckManPhone != null">#{fCheckManPhone},</if>
            <if test="fCheckTime != null and fCheckTime != ''">#{fCheckTime},</if>
            <if test="fHazardsNum != null">#{fHazardsNum},</if>
            <if test="fDoscNeedExecute != null">#{fDoscNeedExecute},</if>
            <if test="fAnnex != null">#{fAnnex},</if>
            <if test="fLastUpdateTime != null">#{fLastUpdateTime},</if>
            <if test="fRemark != null">#{fRemark},</if>
         </trim>
    </insert>

    <update id="updateTInsRecInfor" parameterType="TInsRecInfor">
        update t_ins_rec_infor
        <trim prefix="SET" suffixOverrides=",">
            <if test="fCheckCode != null and fCheckCode != ''">f_check_code = #{fCheckCode},</if>
            <if test="fCheckTaskCode != null and fCheckTaskCode != ''">f_check_task_code = #{fCheckTaskCode},</if>
            <if test="fRegionCode != null and fRegionCode != ''">f_region_code = #{fRegionCode},</if>
            <if test="fObjectType != null and fObjectType != ''">f_object_type = #{fObjectType},</if>
            <if test="fObjectCode != null and fObjectCode != ''">f_object_code = #{fObjectCode},</if>
            <if test="fCheckUserId != null and fCheckUserId != ''">f_check_user_id = #{fCheckUserId},</if>
            <if test="fCheckManName != null and fCheckManName != ''">f_check_man_name = #{fCheckManName},</if>
            <if test="fCheckManPhone != null">f_check_man_phone = #{fCheckManPhone},</if>
            <if test="fCheckTime != null and fCheckTime != ''">f_check_time = #{fCheckTime},</if>
            <if test="fHazardsNum != null">f_hazards_num = #{fHazardsNum},</if>
            <if test="fDoscNeedExecute != null">f_dosc_need_execute = #{fDoscNeedExecute},</if>
            <if test="fAnnex != null">f_annex = #{fAnnex},</if>
            <if test="fLastUpdateTime != null">f_last_update_time = #{fLastUpdateTime},</if>
            <if test="fRemark != null">f_remark = #{fRemark},</if>
        </trim>
        where f_ins_rec_infor_id = #{fInsRecInforId}
    </update>

    <delete id="deleteTInsRecInforById" parameterType="Long">
        delete from t_ins_rec_infor where f_ins_rec_infor_id = #{fInsRecInforId}
    </delete>

    <delete id="deleteTInsRecInforByIds" parameterType="String">
        delete from t_ins_rec_infor where f_ins_rec_infor_id in 
        <foreach item="fInsRecInforId" collection="array" open="(" separator="," close=")">
            #{fInsRecInforId}
        </foreach>
    </delete>
</mapper>