TInsRecInforMapper.xml 8.29 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
<?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"    />
23 24 25

        <result property="govUploadState"    column="f_gov_upload_state"    />
        <result property="govUploadTime"    column="f_gov_upload_time"    />
耿迪迪's avatar
耿迪迪 committed
26 27 28
    </resultMap>

    <sql id="selectTInsRecInforVo">
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
        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,
45
            rec.f_gov_upload_state,
46
            rec.f_gov_upload_time,
47 48 49 50 51
            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
52 53 54 55 56
    </sql>

    <select id="selectTInsRecInforList" parameterType="TInsRecInfor" resultMap="TInsRecInforResult">
        <include refid="selectTInsRecInforVo"/>
        <where>  
57 58 59 60
            <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>
61
            <if test="govUploadState != null  and govUploadState != ''"> and rec.f_gov_upload_state = #{govUploadState}</if>
耿迪迪's avatar
耿迪迪 committed
62
        </where>
耿迪迪's avatar
耿迪迪 committed
63
        ORDER BY f_last_update_time DESC
耿迪迪's avatar
耿迪迪 committed
64 65 66 67
    </select>
    
    <select id="selectTInsRecInforById" parameterType="Long" resultMap="TInsRecInforResult">
        <include refid="selectTInsRecInforVo"/>
68
        where rec.f_ins_rec_infor_id = #{fInsRecInforId}
耿迪迪's avatar
耿迪迪 committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    </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>
88 89 90

            <if test="govUploadState != null">f_gov_upload_state,</if>
            <if test="govUploadTime != null">f_gov_upload_time,</if>
耿迪迪's avatar
耿迪迪 committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
         </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>
107 108 109 110

            <if test="govUploadState != null">#{govUploadState},</if>
            <if test="govUploadTime != null">#{govUploadTime},</if>

耿迪迪's avatar
耿迪迪 committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
         </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>
131 132 133

            <if test="govUploadState != null">f_gov_upload_state = #{govUploadState},</if>
            <if test="govUploadTime != null">f_gov_upload_time = #{govUploadTime},</if>
耿迪迪's avatar
耿迪迪 committed
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
        </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>