QwWorkTaskMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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.qw.mapper.QwWorkTaskMapper">
  6. <resultMap type="QwWorkTask" id="QwWorkTaskResult">
  7. <result property="id" column="id" />
  8. <result property="extId" column="ext_id" />
  9. <result property="qwUserId" column="qw_user_id" />
  10. <result property="type" column="type" />
  11. <result property="status" column="status" />
  12. <result property="remark" column="remark" />
  13. <result property="score" column="score" />
  14. <result property="sopId" column="sop_id" />
  15. <result property="companyId" column="company_id" />
  16. <result property="companyUserId" column="company_user_id" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateTime" column="update_time" />
  19. <result property="title" column="title" />
  20. </resultMap>
  21. <sql id="selectQwWorkTaskVo">
  22. select id, ext_id, qw_user_id, type,title, status, remark, score, sop_id, company_id, company_user_id, create_time, update_time from qw_work_task
  23. </sql>
  24. <select id="selectQwWorkTaskList" parameterType="QwWorkTask" resultMap="QwWorkTaskResult">
  25. <include refid="selectQwWorkTaskVo"/>
  26. <where>
  27. <if test="extId != null "> and ext_id = #{extId}</if>
  28. <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
  29. <if test="type != null "> and type = #{type}</if>
  30. <if test="status != null "> and status = #{status}</if>
  31. <if test="score != null "> and score = #{score}</if>
  32. <if test="sopId != null and sopId != ''"> and sop_id = #{sopId}</if>
  33. <if test="companyId != null "> and company_id = #{companyId}</if>
  34. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  35. </where>
  36. </select>
  37. <select id="selectQwWorkTaskById" parameterType="Long" resultMap="QwWorkTaskResult">
  38. <include refid="selectQwWorkTaskVo"/>
  39. where id = #{id}
  40. </select>
  41. <select id="selectQwWorkTaskListVONew" resultType="com.fs.qw.vo.QwWorkTaskListVO">
  42. select t.* from qw_work_task t
  43. <where>
  44. DATE(t.create_time) = CURDATE()
  45. <if test="extId != null "> and t.ext_id = #{extId}</if>
  46. <if test="qwUserId != null "> and t.qw_user_id = #{qwUserId}</if>
  47. <if test="type != null "> and t.type = #{type}</if>
  48. <if test="status != null "> and t.status = #{status}</if>
  49. <if test="score != null "> and t.score = #{score}</if>
  50. <if test="sopId != null and sopId != ''"> and t.sop_id = #{sopId}</if>
  51. <if test="companyId != null "> and t.company_id = #{companyId}</if>
  52. <if test="companyUserId != null "> and t.company_user_id = #{companyUserId}</if>
  53. </where>
  54. order by t.score desc,t.id desc
  55. </select>
  56. <insert id="insertQwWorkTask" parameterType="QwWorkTask" useGeneratedKeys="true" keyProperty="id">
  57. insert into qw_work_task
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="extId != null">ext_id,</if>
  60. <if test="qwUserId != null">qw_user_id,</if>
  61. <if test="type != null">type,</if>
  62. <if test="status != null">status,</if>
  63. <if test="remark != null">remark,</if>
  64. <if test="score != null">score,</if>
  65. <if test="sopId != null">sop_id,</if>
  66. <if test="companyId != null">company_id,</if>
  67. <if test="companyUserId != null">company_user_id,</if>
  68. <if test="createTime != null">create_time,</if>
  69. <if test="updateTime != null">update_time,</if>
  70. <if test="title != null">title,</if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="extId != null">#{extId},</if>
  74. <if test="qwUserId != null">#{qwUserId},</if>
  75. <if test="type != null">#{type},</if>
  76. <if test="status != null">#{status},</if>
  77. <if test="remark != null">#{remark},</if>
  78. <if test="score != null">#{score},</if>
  79. <if test="sopId != null">#{sopId},</if>
  80. <if test="companyId != null">#{companyId},</if>
  81. <if test="companyUserId != null">#{companyUserId},</if>
  82. <if test="createTime != null">#{createTime},</if>
  83. <if test="updateTime != null">#{updateTime},</if>
  84. <if test="title != null">#{title},</if>
  85. </trim>
  86. </insert>
  87. <update id="updateQwWorkTask" parameterType="QwWorkTask">
  88. update qw_work_task
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="extId != null">ext_id = #{extId},</if>
  91. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  92. <if test="type != null">type = #{type},</if>
  93. <if test="status != null">status = #{status},</if>
  94. <if test="remark != null">remark = #{remark},</if>
  95. <if test="score != null">score = #{score},</if>
  96. <if test="sopId != null">sop_id = #{sopId},</if>
  97. <if test="companyId != null">company_id = #{companyId},</if>
  98. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  99. <if test="createTime != null">create_time = #{createTime},</if>
  100. <if test="updateTime != null">update_time = #{updateTime},</if>
  101. <if test="title != null">title = #{title},</if>
  102. </trim>
  103. where id = #{id}
  104. </update>
  105. <insert id="insertQwWorkTaskBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
  106. INSERT INTO qw_work_task (
  107. ext_id,
  108. qw_user_id,
  109. status,
  110. type,
  111. title,
  112. remark,
  113. score,
  114. sop_id,
  115. company_id,
  116. company_user_id,
  117. create_time,
  118. update_time
  119. )
  120. VALUES
  121. <foreach collection="qwWorkTasks" item="log" separator=",">
  122. (
  123. #{log.extId},
  124. #{log.qwUserId},
  125. #{log.status},
  126. #{log.type},
  127. #{log.title},
  128. #{log.remark},
  129. #{log.score},
  130. #{log.sopId},
  131. #{log.companyId},
  132. #{log.companyUserId},
  133. #{log.createTime},
  134. #{log.updateTime}
  135. )
  136. </foreach>
  137. </insert>
  138. <delete id="deleteQwWorkTaskById" parameterType="Long">
  139. delete from qw_work_task where id = #{id}
  140. </delete>
  141. <delete id="deleteQwWorkTaskByIds" parameterType="String">
  142. delete from qw_work_task where id in
  143. <foreach item="id" collection="array" open="(" separator="," close=")">
  144. #{id}
  145. </foreach>
  146. </delete>
  147. </mapper>