| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?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.fs.wx.sop.mapper.WxSopUserMapper">
- <resultMap type="WxSopUser" id="WxSopUserResult">
- <result property="id" column="id" />
- <result property="type" column="type" />
- <result property="sopId" column="sop_id" />
- <result property="accountId" column="account_id" />
- <result property="startTime" column="start_time" />
- <result property="chatId" column="chat_id" />
- <result property="status" column="status" />
- <result property="createTime" column="create_time" />
- <result property="createBy" column="create_by" />
- <result property="updateTime" column="update_time" />
- <result property="updateBy" column="update_by" />
- <result property="remark" column="remark" />
- </resultMap>
- <sql id="selectWxSopUserVo">
- select id, type, sop_id, account_id, start_time, chat_id, status, create_time, create_by, update_time, update_by, remark from wx_sop_user
- </sql>
- <select id="selectWxSopUserList" parameterType="WxSopUser" resultMap="WxSopUserResult">
- SELECT
- w.id,w.type, w.sop_id, w.account_id, w.start_time, w.chat_id, w.status,
- w.create_time, w.create_by, w.update_time, w.update_by, w.remark,
- c.wx_nick_name AS account_name
- FROM wx_sop_user w
- LEFT JOIN company_wx_account c ON w.account_id = c.id
- <where>
- <if test="type != null "> and type = #{type}</if>
- <if test="sopId != null "> and sop_id = #{sopId}</if>
- <if test="accountId != null "> and account_id = #{accountId}</if>
- <if test="accountName != null "> and account_name = #{accountName}</if>
- <if test="startTime != null "> and start_time = #{startTime}</if>
- <if test="chatId != null and chatId != ''"> and chat_id = #{chatId}</if>
- <if test="status != null "> and status = #{status}</if>
- </where>
- </select>
- <select id="selectWxSopUserById" parameterType="Long" resultMap="WxSopUserResult">
- <include refid="selectWxSopUserVo"/>
- where id = #{id}
- </select>
- <insert id="insertWxSopUser" parameterType="WxSopUser" useGeneratedKeys="true" keyProperty="id">
- insert into wx_sop_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="type != null">type,</if>
- <if test="sopId != null">sop_id,</if>
- <if test="accountId != null">account_id,</if>
- <if test="startTime != null">start_time,</if>
- <if test="chatId != null">chat_id,</if>
- <if test="status != null">status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="createBy != null">create_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="type != null">#{type},</if>
- <if test="sopId != null">#{sopId},</if>
- <if test="accountId != null">#{accountId},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="chatId != null">#{chatId},</if>
- <if test="status != null">#{status},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateWxSopUser" parameterType="WxSopUser">
- update wx_sop_user
- <trim prefix="SET" suffixOverrides=",">
- <if test="type != null">type = #{type},</if>
- <if test="sopId != null">sop_id = #{sopId},</if>
- <if test="accountId != null">account_id = #{accountId},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="chatId != null">chat_id = #{chatId},</if>
- <if test="status != null">status = #{status},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteWxSopUserById" parameterType="Long">
- delete from wx_sop_user where id = #{id}
- </delete>
- <delete id="deleteWxSopUserByIds" parameterType="String">
- delete from wx_sop_user where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteBySopId" parameterType="Long">
- delete from wx_sop_user where sop_id = #{sopId}
- </delete>
- <select id="selectwxSopUser" parameterType="WxSopUser" resultMap="WxSopUserResult">
- <include refid="selectWxSopUserVo"/>
- <where>
- <if test="sopId != null">and sop_id = #{sopId}</if>
- <if test="type != null">and type = #{type}</if>
- <if test="accountId != null">and account_id = #{accountId}</if>
- <if test="startTime != null">and start_time = #{startTime}</if>
- </where>
- LIMIT 1
- </select>
- </mapper>
|