TSafeCheckRecordMapper.xml 13.1 KB
Newer Older
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
<?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.TSafeCheckRecordMapper">

    <resultMap type="TSafeCheckRecord" id="TSafeCheckRecordResult">
        <result property="safeCheckId"    column="safe_check_id"    />
        <result property="stationId"    column="station_id"    />
        <result property="gasUserId"    column="gas_user_id"    />
        <result property="safeCheckDate"    column="safe_check_date"    />
        <result property="safeCheckPerson"    column="safe_check_person"    />
        <result property="bottleNum"    column="bottle_num"    />
        <result property="checkInStatus"    column="check_in_status"    />
        <result property="stoveCheckStatus"    column="stove_check_status"    />
        <result property="stoveCheckPic"    column="stove_check_pic"    />
        <result property="hoseCheckStatus"    column="hose_check_status"    />
        <result property="hoseCheckPic"    column="hose_check_pic"    />
        <result property="valveCheckStatus"    column="valve_check_status"    />
        <result property="valveCheckPic"    column="valve_check_pic"    />
        <result property="bottleCheckStatus"    column="bottle_check_status"    />
        <result property="bottleCheckPic"    column="bottle_check_pic"    />
        <result property="alarmCheckStatus"    column="alarm_check_status"    />
        <result property="alarmCheckPic"    column="alarm_check_pic"    />
        <result property="placeCheckStatus"    column="place_check_status"    />
        <result property="placeCheckPic"    column="place_check_pic"    />
        <result property="checkPersonSign"    column="check_person_sign"    />
        <result property="gasUserSign"    column="gas_user_sign"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remark"    column="remark"    />
        <result property="stationName" column="station_name"/>
        <result property="gasUserName" column="gas_user_name"/>
        <result property="gasUserType" column="gas_user_type"/>
        <result property="telNum" column="tel_num"/>
        <result property="gasUserAddress" column="gas_user_address"/>
        <result property="safeCheckPersonName" column="safe_check_person_name"/>
    </resultMap>

    <sql id="selectTSafeCheckRecordVo">
        SELECT
            record.safe_check_id,
            record.station_id,
            record.gas_user_id,
            record.safe_check_date,
            record.safe_check_person,
            record.bottle_num,
            record.check_in_status,
            record.stove_check_status,
            record.stove_check_pic,
            record.hose_check_status,
            record.hose_check_pic,
            record.valve_check_status,
            record.valve_check_pic,
            record.bottle_check_status,
            record.bottle_check_pic,
            record.alarm_check_status,
            record.alarm_check_pic,
            record.place_check_status,
            record.place_check_pic,
            record.check_person_sign,
            record.gas_user_sign,
            record.create_time,
            record.update_time,
            record.is_del,
            record.remark,
            station.station_name,
            us.gas_user_name,
            us.gas_user_type,
            us.tel_num,
            us.gas_user_address,
            p.name as safe_check_person_name
        FROM
            t_safe_check_record record
        LEFT JOIN t_gas_storage_station_info station ON station.station_id = record.station_id
        LEFT JOIN t_gas_user_info us ON us.gas_user_id = record.gas_user_id
        LEFT JOIN t_practitioner_info p ON p.practitioner_id = record.safe_check_person
    </sql>

    <select id="selectTSafeCheckRecordList" parameterType="TSafeCheckRecord" resultMap="TSafeCheckRecordResult">
        <include refid="selectTSafeCheckRecordVo"/>
        <where>
            <if test="stationId != null "> and record.station_id = #{stationId}</if>
            <if test="gasUserId != null "> and record.gas_user_id = #{gasUserId}</if>
            <if test="safeCheckDate != null "> and record.safe_check_date = #{safeCheckDate}</if>
            <if test="safeCheckPerson != null "> and record.safe_check_person = #{safeCheckPerson}</if>
            <if test="bottleNum != null "> and record.bottle_num = #{bottleNum}</if>
            <if test="checkInStatus != null  and checkInStatus != ''"> and record.check_in_status = #{checkInStatus}</if>
            <if test="stoveCheckStatus != null  and stoveCheckStatus != ''"> and record.stove_check_status = #{stoveCheckStatus}</if>
            <if test="stoveCheckPic != null  and stoveCheckPic != ''"> and record.stove_check_pic = #{stoveCheckPic}</if>
            <if test="hoseCheckStatus != null  and hoseCheckStatus != ''"> and record.hose_check_status = #{hoseCheckStatus}</if>
            <if test="hoseCheckPic != null  and hoseCheckPic != ''"> and record.hose_check_pic = #{hoseCheckPic}</if>
            <if test="valveCheckStatus != null  and valveCheckStatus != ''"> and record.valve_check_status = #{valveCheckStatus}</if>
            <if test="valveCheckPic != null  and valveCheckPic != ''"> and record.valve_check_pic = #{valveCheckPic}</if>
            <if test="bottleCheckStatus != null  and bottleCheckStatus != ''"> and record.bottle_check_status = #{bottleCheckStatus}</if>
            <if test="bottleCheckPic != null  and bottleCheckPic != ''"> and record.bottle_check_pic = #{bottleCheckPic}</if>
            <if test="alarmCheckStatus != null  and alarmCheckStatus != ''"> and record.alarm_check_status = #{alarmCheckStatus}</if>
            <if test="alarmCheckPic != null  and alarmCheckPic != ''"> and record.alarm_check_pic = #{alarmCheckPic}</if>
            <if test="placeCheckStatus != null  and placeCheckStatus != ''"> and record.place_check_status = #{placeCheckStatus}</if>
            <if test="placeCheckPic != null  and placeCheckPic != ''"> and record.place_check_pic = #{placeCheckPic}</if>
            <if test="checkPersonSign != null  and checkPersonSign != ''"> and record.check_person_sign = #{checkPersonSign}</if>
            <if test="gasUserSign != null  and gasUserSign != ''"> and record.gas_user_sign = #{gasUserSign}</if>
            <if test="isDel != null  and isDel != ''"> and record.is_del = #{isDel}</if>
            <if test="gasUserType != null and gasUserType != ''"> and us.gas_user_type = #{gasUserType}</if>
            <if test="safeCheckBeginTime != null and safeCheckEndTime != null">and record.safe_check_date between #{safeCheckBeginTime} and #{safeCheckEndTime} </if>
        </where>
        order by record.safe_check_id desc
    </select>

    <select id="selectTSafeCheckRecordById" parameterType="Long" resultMap="TSafeCheckRecordResult">
        <include refid="selectTSafeCheckRecordVo"/>
        where record.safe_check_id = #{safeCheckId}
    </select>

    <insert id="insertTSafeCheckRecord" parameterType="TSafeCheckRecord" useGeneratedKeys="true" keyProperty="safeCheckId">
        insert into t_safe_check_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="stationId != null">station_id,</if>
            <if test="gasUserId != null">gas_user_id,</if>
            <if test="safeCheckDate != null">safe_check_date,</if>
            <if test="safeCheckPerson != null">safe_check_person,</if>
            <if test="bottleNum != null">bottle_num,</if>
            <if test="checkInStatus != null">check_in_status,</if>
            <if test="stoveCheckStatus != null">stove_check_status,</if>
            <if test="stoveCheckPic != null">stove_check_pic,</if>
            <if test="hoseCheckStatus != null">hose_check_status,</if>
            <if test="hoseCheckPic != null">hose_check_pic,</if>
            <if test="valveCheckStatus != null">valve_check_status,</if>
            <if test="valveCheckPic != null">valve_check_pic,</if>
            <if test="bottleCheckStatus != null">bottle_check_status,</if>
            <if test="bottleCheckPic != null">bottle_check_pic,</if>
            <if test="alarmCheckStatus != null">alarm_check_status,</if>
            <if test="alarmCheckPic != null">alarm_check_pic,</if>
            <if test="placeCheckStatus != null">place_check_status,</if>
            <if test="placeCheckPic != null">place_check_pic,</if>
            <if test="checkPersonSign != null">check_person_sign,</if>
            <if test="gasUserSign != null">gas_user_sign,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="stationId != null">#{stationId},</if>
            <if test="gasUserId != null">#{gasUserId},</if>
            <if test="safeCheckDate != null">#{safeCheckDate},</if>
            <if test="safeCheckPerson != null">#{safeCheckPerson},</if>
            <if test="bottleNum != null">#{bottleNum},</if>
            <if test="checkInStatus != null">#{checkInStatus},</if>
            <if test="stoveCheckStatus != null">#{stoveCheckStatus},</if>
            <if test="stoveCheckPic != null">#{stoveCheckPic},</if>
            <if test="hoseCheckStatus != null">#{hoseCheckStatus},</if>
            <if test="hoseCheckPic != null">#{hoseCheckPic},</if>
            <if test="valveCheckStatus != null">#{valveCheckStatus},</if>
            <if test="valveCheckPic != null">#{valveCheckPic},</if>
            <if test="bottleCheckStatus != null">#{bottleCheckStatus},</if>
            <if test="bottleCheckPic != null">#{bottleCheckPic},</if>
            <if test="alarmCheckStatus != null">#{alarmCheckStatus},</if>
            <if test="alarmCheckPic != null">#{alarmCheckPic},</if>
            <if test="placeCheckStatus != null">#{placeCheckStatus},</if>
            <if test="placeCheckPic != null">#{placeCheckPic},</if>
            <if test="checkPersonSign != null">#{checkPersonSign},</if>
            <if test="gasUserSign != null">#{gasUserSign},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTSafeCheckRecord" parameterType="TSafeCheckRecord">
        update t_safe_check_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="stationId != null">station_id = #{stationId},</if>
            <if test="gasUserId != null">gas_user_id = #{gasUserId},</if>
            <if test="safeCheckDate != null">safe_check_date = #{safeCheckDate},</if>
            <if test="safeCheckPerson != null">safe_check_person = #{safeCheckPerson},</if>
            <if test="bottleNum != null">bottle_num = #{bottleNum},</if>
            <if test="checkInStatus != null">check_in_status = #{checkInStatus},</if>
            <if test="stoveCheckStatus != null">stove_check_status = #{stoveCheckStatus},</if>
            <if test="stoveCheckPic != null">stove_check_pic = #{stoveCheckPic},</if>
            <if test="hoseCheckStatus != null">hose_check_status = #{hoseCheckStatus},</if>
            <if test="hoseCheckPic != null">hose_check_pic = #{hoseCheckPic},</if>
            <if test="valveCheckStatus != null">valve_check_status = #{valveCheckStatus},</if>
            <if test="valveCheckPic != null">valve_check_pic = #{valveCheckPic},</if>
            <if test="bottleCheckStatus != null">bottle_check_status = #{bottleCheckStatus},</if>
            <if test="bottleCheckPic != null">bottle_check_pic = #{bottleCheckPic},</if>
            <if test="alarmCheckStatus != null">alarm_check_status = #{alarmCheckStatus},</if>
            <if test="alarmCheckPic != null">alarm_check_pic = #{alarmCheckPic},</if>
            <if test="placeCheckStatus != null">place_check_status = #{placeCheckStatus},</if>
            <if test="placeCheckPic != null">place_check_pic = #{placeCheckPic},</if>
            <if test="checkPersonSign != null">check_person_sign = #{checkPersonSign},</if>
            <if test="gasUserSign != null">gas_user_sign = #{gasUserSign},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where safe_check_id = #{safeCheckId}
    </update>

    <delete id="deleteTSafeCheckRecordById" parameterType="Long">
        delete from t_safe_check_record where safe_check_id = #{safeCheckId}
    </delete>

    <delete id="deleteTSafeCheckRecordByIds" parameterType="String">
        delete from t_safe_check_record where safe_check_id in
        <foreach item="safeCheckId" collection="array" open="(" separator="," close=")">
            #{safeCheckId}
        </foreach>
    </delete>
</mapper>