QwSopTempMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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.sop.mapper.QwSopTempMapper">
  6. <resultMap type="QwSopTemp" id="QwSopTempResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="setting" column="setting" />
  10. <result property="status" column="status" />
  11. <result property="sort" column="sort" />
  12. <result property="createTime" column="create_time" />
  13. <result property="createBy" column="create_by" />
  14. <result property="companyId" column="company_id" />
  15. <result property="gap" column="gap" />
  16. <result property="sendType" column="send_type" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="templateType" column="template_type" />
  19. <result property="isTop" column="is_top" />
  20. <result property="project" column="project" />
  21. <result property="courseId" column="course_id" />
  22. <result property="createByDept" column="create_by_dept" />
  23. </resultMap>
  24. <sql id="selectQwSopTempVo">
  25. select * from qw_sop_temp
  26. </sql>
  27. <select id="selectQwSopTempList" resultType="QwSopTemp" resultMap="QwSopTempResult">
  28. <include refid="selectQwSopTempVo"/>
  29. <where>
  30. <if test="id != null "> and id = #{id}</if>
  31. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  32. <if test="setting != null and setting != ''"> and setting = #{setting}</if>
  33. <if test="status != null and status != ''"> and status = #{status}</if>
  34. <if test="sort != null "> and sort = #{sort}</if>
  35. <if test="companyId != null "> and company_id = #{companyId}</if>
  36. <if test="sendType != null "> and send_type = #{sendType}</if>
  37. </where>
  38. </select>
  39. <select id="selectQwSopTempListNew" resultType="QwSopTemp" resultMap="QwSopTempResult">
  40. select * from qw_sop_temp
  41. <where>
  42. <if test="id != null "> and id = #{id}</if>
  43. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  44. <if test="status != null and status != ''"> and status = #{status}</if>
  45. <if test="sort != null "> and sort = #{sort}</if>
  46. <if test="companyId != null ">
  47. AND (company_id = #{companyId} OR template_type = 1)
  48. </if>
  49. <if test="sendType != null "> and send_type = #{sendType}</if>
  50. <if test="createBy != null "> and create_by = #{createBy}</if>
  51. <if test="cuDeptIdList != null and !cuDeptIdList.isEmpty()">
  52. AND create_by_dept IN
  53. <foreach collection='cuDeptIdList' item='item' open='(' separator=',' close=')'>
  54. #{item}
  55. </foreach>
  56. </if>
  57. <if test="userIds != null and !userIds.isEmpty()">
  58. AND create_by IN
  59. <foreach collection='userIds' item='item' open='(' separator=',' close=')'>
  60. #{item}
  61. </foreach>
  62. </if>
  63. <if test="companyUserIds != null and !companyUserIds.isEmpty()">
  64. AND create_by IN
  65. <foreach collection='companyUserIds' item='item' open='(' separator=',' close=')'>
  66. #{item}
  67. </foreach>
  68. </if>
  69. </where>
  70. order by is_top desc, sort, create_time desc
  71. </select>
  72. <select id="selectQwSopTempById" parameterType="String" resultMap="QwSopTempResult">
  73. <include refid="selectQwSopTempVo"/>
  74. where id = #{id}
  75. </select>
  76. <select id="listTemp" resultType="com.fs.sop.domain.QwSopTemp">
  77. select * from qw_sop_temp_temp
  78. </select>
  79. <select id="selectListByIds" resultType="com.fs.sop.domain.QwSopTemp">
  80. select * from qw_sop_temp where id in
  81. <foreach item="id" collection="ids" open="(" separator="," close=")">
  82. #{id}
  83. </foreach>
  84. </select>
  85. <insert id="insertQwSopTemp" parameterType="QwSopTemp" useGeneratedKeys="true" keyProperty="id">
  86. insert into qw_sop_temp
  87. <trim prefix="(" suffix=")" suffixOverrides=",">
  88. <if test="data.id != null">id,</if>
  89. <if test="data.name != null">name,</if>
  90. <if test="data.setting != null">setting,</if>
  91. <if test="data.status != null">status,</if>
  92. <if test="data.sort != null">sort,</if>
  93. <if test="data.createTime != null">create_time,</if>
  94. <if test="data.createBy != null">create_by,</if>
  95. <if test="data.companyId != null">company_id,</if>
  96. <if test="data.gap != null">gap,</if>
  97. <if test="data.sendType != null">send_type,</if>
  98. <if test="data.updateTime != null">update_time,</if>
  99. <if test="data.templateType != null">template_type,</if>
  100. <if test="data.isTop != null">is_top,</if>
  101. <if test="data.project !=null ">project,</if>
  102. <if test="data.courseId !=null ">course_id,</if>
  103. <if test="data.createByDept !=null ">create_by_dept,</if>
  104. </trim>
  105. <trim prefix="values (" suffix=")" suffixOverrides=",">
  106. <if test="data.id != null">#{data.id},</if>
  107. <if test="data.name != null">#{data.name},</if>
  108. <if test="data.setting != null">#{data.setting},</if>
  109. <if test="data.status != null">#{data.status},</if>
  110. <if test="data.sort != null">#{data.sort},</if>
  111. <if test="data.createTime != null">#{data.createTime},</if>
  112. <if test="data.createBy != null">#{data.createBy},</if>
  113. <if test="data.companyId != null">#{data.companyId},</if>
  114. <if test="data.gap != null">#{data.gap},</if>
  115. <if test="data.sendType != null">#{data.sendType},</if>
  116. <if test="data.updateTime != null">#{data.updateTime},</if>
  117. <if test="data.templateType != null">#{data.templateType},</if>
  118. <if test="data.isTop != null">#{data.isTop},</if>
  119. <if test="data.project !=null ">#{data.project},</if>
  120. <if test="data.courseId !=null ">#{data.courseId},</if>
  121. <if test="data.createByDept !=null ">#{data.createByDept},</if>
  122. </trim>
  123. </insert>
  124. <update id="updateQwSopTemp" parameterType="QwSopTemp" useGeneratedKeys="false" keyProperty="id" >
  125. update qw_sop_temp
  126. <trim prefix="SET" suffixOverrides=",">
  127. <if test="data.name != null">name = #{data.name},</if>
  128. <if test="data.setting != null">setting = #{data.setting},</if>
  129. <if test="data.status != null">status = #{data.status},</if>
  130. <if test="data.sort != null">sort = #{data.sort},</if>
  131. <if test="data.createTime != null">create_time = #{data.createTime},</if>
  132. <if test="data.createBy != null">create_by = #{data.createBy},</if>
  133. <if test="data.companyId != null">company_id = #{data.companyId},</if>
  134. <if test="data.gap != null">gap = #{data.gap},</if>
  135. <if test="data.sendType != null">send_type = #{data.sendType},</if>
  136. <if test="data.updateTime != null">update_time = #{data.updateTime},</if>
  137. <if test="data.templateType != null">template_type = #{data.templateType},</if>
  138. <if test="data.isTop != null">is_top = #{data.isTop},</if>
  139. <if test="data.project !=null ">project = #{data.project},</if>
  140. <if test="data.courseId !=null ">course_id = #{data.courseId},</if>
  141. <if test="data.createByDept !=null ">create_by_dept = #{data.createByDept},</if>
  142. </trim>
  143. where id = #{data.id}
  144. </update>
  145. <delete id="deleteQwSopTempById" parameterType="String">
  146. delete from qw_sop_temp where id = #{id}
  147. </delete>
  148. <delete id="deleteQwSopTempByIds" parameterType="String">
  149. delete from qw_sop_temp where id in
  150. <foreach item="id" collection="array" open="(" separator="," close=")">
  151. #{id}
  152. </foreach>
  153. </delete>
  154. <!-- <update id="updateQwSopTempByIds" parameterType="String">-->
  155. <!-- ALTER TABLE qw_sop_temp-->
  156. <!-- UPDATE status = 0-->
  157. <!-- WHERE id IN-->
  158. <!-- <foreach item="id" collection="ids" open="(" separator="," close=")">-->
  159. <!-- CAST(#{id} AS UUID)-->
  160. <!-- </foreach>-->
  161. <!-- </update>-->
  162. <update id="updateQwSopTempByIds" parameterType="String">
  163. UPDATE qw_sop_temp set status = 2
  164. WHERE id IN
  165. <foreach item="id" collection="ids" open="(" separator="," close=")">
  166. #{id}
  167. </foreach>
  168. </update>
  169. </mapper>