TEventReceiveMapper.xml 7.56 KB
Newer Older
zhangjianqian's avatar
zhangjianqian 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.TEventReceiveMapper">
    
    <resultMap type="TEventReceive" id="TEventReceiveResult">
        <result property="id"    column="id"    />
        <result property="eventName"    column="event_name"    />
        <result property="eventType"    column="event_type"    />
        <result property="eventGrade"    column="event_grade"    />
        <result property="address"    column="address"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="informant"    column="informant"    />
        <result property="inforTime"    column="infor_time"    />
        <result property="informantPhone"    column="informant_phone"    />
        <result property="describe"    column="describe"    />
        <result property="status"    column="status"    />
        <result property="enterpriseId"    column="enterprise_id"    />
        <result property="enterpriseName"    column="enterprise_name"    />
        <result property="remarks"    column="remarks"    />
23 24
        <result property="companyRead"    column="company_read"    />
        <result property="governmentRead"    column="government_read"    />
zhangjianqian's avatar
zhangjianqian committed
25 26 27 28 29
        <result property="isDel"    column="is_del"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectTEventReceiveVo">
30 31
        select id, event_name, event_type, event_grade, address, longitude, latitude,
         company_read,government_read,informant, infor_time, informant_phone, `describe`, `status`,enterprise_id, enterprise_name, remarks, is_del, create_time from t_event_receive
zhangjianqian's avatar
zhangjianqian committed
32
    </sql>
33 34 35 36 37 38
    <select id="getReadReceiveList" resultMap="TEventReceiveResult">
        <include refid="selectTEventReceiveVo"/>
        <where>
            <if test="enterpriseId != null and enterpriseId != -2"> and enterprise_id = #{enterpriseId}</if>
        </where>
    </select>
zhangjianqian's avatar
zhangjianqian committed
39 40 41 42 43 44 45 46
    <select id="selectTEventReceiveList" parameterType="TEventReceive" resultMap="TEventReceiveResult">
        <include refid="selectTEventReceiveVo"/>
        <where>  
            <if test="eventName != null  and eventName != ''"> and event_name like concat('%', #{eventName}, '%')</if>
            <if test="eventType != null "> and event_type = #{eventType}</if>
            <if test="eventGrade != null "> and event_grade = #{eventGrade}</if>
            <if test="enterpriseId != null and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
            <if test="status != null and status!=5"> and status = #{status}</if>
47 48
            <if test="companyRead != null"> and company_read = #{companyRead}</if>
            <if test="governmentRead != null"> and government_read = #{governmentRead}</if>
zhangjianqian's avatar
zhangjianqian committed
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
            <if test="status ==5"> and status !=4 </if>
            and is_del = 0
        </where>
        order by infor_time
    </select>
    
    <select id="selectTEventReceiveById" parameterType="String" resultMap="TEventReceiveResult">
        <include refid="selectTEventReceiveVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTEventReceive" parameterType="TEventReceive">
        insert into t_event_receive
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="eventName != null">event_name,</if>
            <if test="eventType != null">event_type,</if>
            <if test="eventGrade != null">event_grade,</if>
            <if test="address != null">address,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="informant != null">informant,</if>
            <if test="inforTime != null">infor_time,</if>
            <if test="informantPhone != null">informant_phone,</if>
            <if test="describe != null">`describe`,</if>
            <if test="status != null">`status`,</if>
            <if test="enterpriseId != null">enterprise_id,</if>
            <if test="enterpriseName != null">enterprise_name,</if>
            <if test="remarks != null">remarks,</if>
78 79
            <if test="companyRead != null">company_read,</if>
            <if test="governmentRead != null">government_read,</if>
zhangjianqian's avatar
zhangjianqian committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
            <if test="isDel != null">is_del,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="eventName != null">#{eventName},</if>
            <if test="eventType != null">#{eventType},</if>
            <if test="eventGrade != null">#{eventGrade},</if>
            <if test="address != null">#{address},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="informant != null">#{informant},</if>
            <if test="inforTime != null">#{inforTime},</if>
            <if test="informantPhone != null">#{informantPhone},</if>
            <if test="describe != null">#{describe},</if>
            <if test="status != null">#{status},</if>
            <if test="enterpriseId != null">#{enterpriseId},</if>
            <if test="enterpriseName != null">#{enterpriseName},</if>
            <if test="remarks != null">#{remarks},</if>
99 100
            <if test="companyRead != null">#{companyRead},</if>
            <if test="governmentRead != null">#{governmentRead},</if>
zhangjianqian's avatar
zhangjianqian committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
            <if test="isDel != null">#{isDel},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateTEventReceive" parameterType="TEventReceive">
        update t_event_receive
        <trim prefix="SET" suffixOverrides=",">
            <if test="eventName != null">event_name = #{eventName},</if>
            <if test="eventType != null">event_type = #{eventType},</if>
            <if test="eventGrade != null">event_grade = #{eventGrade},</if>
            <if test="address != null">address = #{address},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="informant != null">informant = #{informant},</if>
            <if test="inforTime != null">infor_time = #{inforTime},</if>
            <if test="informantPhone != null">informant_phone = #{informantPhone},</if>
            <if test="describe != null">`describe` = #{describe},</if>
            <if test="status != null">`status` = #{status},</if>
            <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
            <if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
123 124
            <if test="companyRead != null">company_read = #{companyRead},</if>
            <if test="governmentRead != null">government_read = #{governmentRead},</if>
zhangjianqian's avatar
zhangjianqian committed
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTEventReceiveById" parameterType="String">
        delete from t_event_receive where id = #{id}
    </delete>

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