TSuperviseMapper.xml 4.75 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
<?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.TSuperviseMapper">
    
    <resultMap type="TSupervise" id="TSuperviseResult">
        <result property="id"    column="id"    />
        <result property="title"    column="title"    />
        <result property="content"    column="content"    />
        <result property="resultContent"    column="result_content"    />
        <result property="person"    column="person"    />
        <result property="address"    column="address"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="enterpriseId"    column="enterprise_id"    />
        <result property="pictrueUrl"    column="pictrue_url"    />
        <result property="vedioUrl"    column="vedio_url"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectTSuperviseVo">
        select id, title, content, result_content, person, address, longitude, latitude, enterprise_id, pictrue_url, vedio_url, create_time from t_supervise
    </sql>

    <select id="selectTSuperviseList" parameterType="TSupervise" resultMap="TSuperviseResult">
        <include refid="selectTSuperviseVo"/>
        <where>  
            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
            <if test="person != null  and person != ''"> and person like concat('%', #{person}, '%') </if>
            <if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
        </where>
    </select>
    
    <select id="selectTSuperviseById" parameterType="Long" resultMap="TSuperviseResult">
        <include refid="selectTSuperviseVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTSupervise" parameterType="TSupervise" useGeneratedKeys="true" keyProperty="id">
        insert into t_supervise
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="title != null">title,</if>
            <if test="content != null">content,</if>
            <if test="resultContent != null">result_content,</if>
            <if test="person != null">person,</if>
            <if test="address != null">address,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="enterpriseId != null">enterprise_id,</if>
            <if test="pictrueUrl != null">pictrue_url,</if>
            <if test="vedioUrl != null">vedio_url,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="title != null">#{title},</if>
            <if test="content != null">#{content},</if>
            <if test="resultContent != null">#{resultContent},</if>
            <if test="person != null">#{person},</if>
            <if test="address != null">#{address},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="enterpriseId != null">#{enterpriseId},</if>
            <if test="pictrueUrl != null">#{pictrueUrl},</if>
            <if test="vedioUrl != null">#{vedioUrl},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateTSupervise" parameterType="TSupervise">
        update t_supervise
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null">title = #{title},</if>
            <if test="content != null">content = #{content},</if>
            <if test="resultContent != null">result_content = #{resultContent},</if>
            <if test="person != null">person = #{person},</if>
            <if test="address != null">address = #{address},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
            <if test="pictrueUrl != null">pictrue_url = #{pictrueUrl},</if>
            <if test="vedioUrl != null">vedio_url = #{vedioUrl},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTSuperviseById" parameterType="Long">
        delete from t_supervise where id = #{id}
    </delete>

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