WxSopUserMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.wx.sop.mapper.WxSopUserMapper">
  6. <resultMap type="WxSopUser" id="WxSopUserResult">
  7. <result property="id" column="id" />
  8. <result property="type" column="type" />
  9. <result property="sopId" column="sop_id" />
  10. <result property="accountId" column="account_id" />
  11. <result property="startTime" column="start_time" />
  12. <result property="chatId" column="chat_id" />
  13. <result property="status" column="status" />
  14. <result property="createTime" column="create_time" />
  15. <result property="createBy" column="create_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="updateBy" column="update_by" />
  18. <result property="remark" column="remark" />
  19. </resultMap>
  20. <sql id="selectWxSopUserVo">
  21. 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
  22. </sql>
  23. <select id="selectWxSopUserList" parameterType="WxSopUser" resultMap="WxSopUserResult">
  24. SELECT
  25. w.id,w.type, w.sop_id, w.account_id, w.start_time, w.chat_id, w.status,
  26. w.create_time, w.create_by, w.update_time, w.update_by, w.remark,
  27. c.wx_nick_name AS account_name
  28. FROM wx_sop_user w
  29. LEFT JOIN company_wx_account c ON w.account_id = c.id
  30. <where>
  31. <if test="type != null "> and type = #{type}</if>
  32. <if test="sopId != null "> and sop_id = #{sopId}</if>
  33. <if test="accountId != null "> and account_id = #{accountId}</if>
  34. <if test="accountName != null "> and account_name = #{accountName}</if>
  35. <if test="startTime != null "> and start_time = #{startTime}</if>
  36. <if test="chatId != null and chatId != ''"> and chat_id = #{chatId}</if>
  37. <if test="status != null "> and status = #{status}</if>
  38. </where>
  39. </select>
  40. <select id="selectWxSopUserById" parameterType="Long" resultMap="WxSopUserResult">
  41. <include refid="selectWxSopUserVo"/>
  42. where id = #{id}
  43. </select>
  44. <insert id="insertWxSopUser" parameterType="WxSopUser" useGeneratedKeys="true" keyProperty="id">
  45. insert into wx_sop_user
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="type != null">type,</if>
  48. <if test="sopId != null">sop_id,</if>
  49. <if test="accountId != null">account_id,</if>
  50. <if test="startTime != null">start_time,</if>
  51. <if test="chatId != null">chat_id,</if>
  52. <if test="status != null">status,</if>
  53. <if test="createTime != null">create_time,</if>
  54. <if test="createBy != null">create_by,</if>
  55. <if test="updateTime != null">update_time,</if>
  56. <if test="updateBy != null">update_by,</if>
  57. <if test="remark != null">remark,</if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides=",">
  60. <if test="type != null">#{type},</if>
  61. <if test="sopId != null">#{sopId},</if>
  62. <if test="accountId != null">#{accountId},</if>
  63. <if test="startTime != null">#{startTime},</if>
  64. <if test="chatId != null">#{chatId},</if>
  65. <if test="status != null">#{status},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. <if test="createBy != null">#{createBy},</if>
  68. <if test="updateTime != null">#{updateTime},</if>
  69. <if test="updateBy != null">#{updateBy},</if>
  70. <if test="remark != null">#{remark},</if>
  71. </trim>
  72. </insert>
  73. <update id="updateWxSopUser" parameterType="WxSopUser">
  74. update wx_sop_user
  75. <trim prefix="SET" suffixOverrides=",">
  76. <if test="type != null">type = #{type},</if>
  77. <if test="sopId != null">sop_id = #{sopId},</if>
  78. <if test="accountId != null">account_id = #{accountId},</if>
  79. <if test="startTime != null">start_time = #{startTime},</if>
  80. <if test="chatId != null">chat_id = #{chatId},</if>
  81. <if test="status != null">status = #{status},</if>
  82. <if test="createTime != null">create_time = #{createTime},</if>
  83. <if test="createBy != null">create_by = #{createBy},</if>
  84. <if test="updateTime != null">update_time = #{updateTime},</if>
  85. <if test="updateBy != null">update_by = #{updateBy},</if>
  86. <if test="remark != null">remark = #{remark},</if>
  87. </trim>
  88. where id = #{id}
  89. </update>
  90. <delete id="deleteWxSopUserById" parameterType="Long">
  91. delete from wx_sop_user where id = #{id}
  92. </delete>
  93. <delete id="deleteWxSopUserByIds" parameterType="String">
  94. delete from wx_sop_user where id in
  95. <foreach item="id" collection="array" open="(" separator="," close=")">
  96. #{id}
  97. </foreach>
  98. </delete>
  99. <delete id="deleteBySopId" parameterType="Long">
  100. delete from wx_sop_user where sop_id = #{sopId}
  101. </delete>
  102. <select id="selectwxSopUser" parameterType="WxSopUser" resultMap="WxSopUserResult">
  103. <include refid="selectWxSopUserVo"/>
  104. <where>
  105. <if test="sopId != null">and sop_id = #{sopId}</if>
  106. <if test="type != null">and type = #{type}</if>
  107. <if test="accountId != null">and account_id = #{accountId}</if>
  108. <if test="startTime != null">and start_time = #{startTime}</if>
  109. </where>
  110. LIMIT 1
  111. </select>
  112. </mapper>