QwSopTempMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. </resultMap>
  19. <sql id="selectQwSopTempVo">
  20. select * from qw_sop_temp
  21. </sql>
  22. <select id="selectQwSopTempList" resultType="QwSopTemp" resultMap="QwSopTempResult">
  23. <include refid="selectQwSopTempVo"/>
  24. <where>
  25. <if test="id != null "> and id = #{id}</if>
  26. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  27. <if test="setting != null and setting != ''"> and setting = #{setting}</if>
  28. <if test="status != null and status != ''"> and status = #{status}</if>
  29. <if test="sort != null "> and sort = #{sort}</if>
  30. <if test="companyId != null "> and company_id = #{companyId}</if>
  31. <if test="sendType != null "> and send_type = #{sendType}</if>
  32. </where>
  33. </select>
  34. <select id="selectQwSopTempListNew" resultType="QwSopTemp" resultMap="QwSopTempResult">
  35. select * from qw_sop_temp
  36. <where>
  37. <if test="id != null "> and id = #{id}</if>
  38. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  39. <if test="status != null and status != ''"> and status = #{status}</if>
  40. <if test="sort != null "> and sort = #{sort}</if>
  41. <if test="companyId != null "> and company_id = #{companyId}</if>
  42. <if test="sendType != null "> and send_type = #{sendType}</if>
  43. <if test="createBy != null "> and create_by = #{createBy}</if>
  44. <if test="cuDeptIdList != null and !cuDeptIdList.isEmpty()">
  45. AND create_by_dept IN
  46. <foreach collection='cuDeptIdList' item='item' open='(' separator=',' close=')'>
  47. #{item}
  48. </foreach>
  49. </if>
  50. </where>
  51. order by sort,create_time desc
  52. </select>
  53. <select id="selectQwSopTempById" parameterType="String" resultMap="QwSopTempResult">
  54. <include refid="selectQwSopTempVo"/>
  55. where id = #{id}
  56. </select>
  57. <select id="listTemp" resultType="com.fs.sop.domain.QwSopTemp">
  58. select * from qw_sop_temp_temp
  59. </select>
  60. <select id="selectListByIds" resultType="com.fs.sop.domain.QwSopTemp">
  61. select * from qw_sop_temp where id in
  62. <foreach item="id" collection="ids" open="(" separator="," close=")">
  63. #{id}
  64. </foreach>
  65. </select>
  66. <insert id="insertQwSopTemp" parameterType="QwSopTemp" useGeneratedKeys="true" keyProperty="id">
  67. insert into qw_sop_temp
  68. <trim prefix="(" suffix=")" suffixOverrides=",">
  69. <if test="data.id != null">id,</if>
  70. <if test="data.name != null">name,</if>
  71. <if test="data.setting != null">setting,</if>
  72. <if test="data.status != null">status,</if>
  73. <if test="data.sort != null">sort,</if>
  74. <if test="data.createTime != null">create_time,</if>
  75. <if test="data.createBy != null">create_by,</if>
  76. <if test="data.companyId != null">company_id,</if>
  77. <if test="data.gap != null">gap,</if>
  78. <if test="data.sendType != null">send_type,</if>
  79. <if test="data.updateTime != null">update_time,</if>
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <if test="data.id != null">#{data.id},</if>
  83. <if test="data.name != null">#{data.name},</if>
  84. <if test="data.setting != null">#{data.setting},</if>
  85. <if test="data.status != null">#{data.status},</if>
  86. <if test="data.sort != null">#{data.sort},</if>
  87. <if test="data.createTime != null">#{data.createTime},</if>
  88. <if test="data.createBy != null">#{data.createBy},</if>
  89. <if test="data.companyId != null">#{data.companyId},</if>
  90. <if test="data.gap != null">#{data.gap},</if>
  91. <if test="data.sendType != null">#{data.sendType},</if>
  92. <if test="data.updateTime != null">#{data.updateTime},</if>
  93. </trim>
  94. </insert>
  95. <update id="updateQwSopTemp" parameterType="QwSopTemp" useGeneratedKeys="false" keyProperty="id" >
  96. update qw_sop_temp
  97. <trim prefix="SET" suffixOverrides=",">
  98. <if test="data.name != null">name = #{data.name},</if>
  99. <if test="data.setting != null">setting = #{data.setting},</if>
  100. <if test="data.status != null">status = #{data.status},</if>
  101. <if test="data.sort != null">sort = #{data.sort},</if>
  102. <if test="data.createTime != null">create_time = #{data.createTime},</if>
  103. <if test="data.createBy != null">create_by = #{data.createBy},</if>
  104. <if test="data.companyId != null">company_id = #{data.companyId},</if>
  105. <if test="data.gap != null">gap = #{data.gap},</if>
  106. <if test="data.sendType != null">send_type = #{data.sendType},</if>
  107. <if test="data.updateTime != null">update_time = #{data.updateTime},</if>
  108. </trim>
  109. where id = #{data.id}
  110. </update>
  111. <delete id="deleteQwSopTempById" parameterType="String">
  112. delete from qw_sop_temp where id = #{id}
  113. </delete>
  114. <delete id="deleteQwSopTempByIds" parameterType="String">
  115. delete from qw_sop_temp where id in
  116. <foreach item="id" collection="array" open="(" separator="," close=")">
  117. #{id}
  118. </foreach>
  119. </delete>
  120. <!-- <update id="updateQwSopTempByIds" parameterType="String">-->
  121. <!-- ALTER TABLE qw_sop_temp-->
  122. <!-- UPDATE status = 0-->
  123. <!-- WHERE id IN-->
  124. <!-- <foreach item="id" collection="ids" open="(" separator="," close=")">-->
  125. <!-- CAST(#{id} AS UUID)-->
  126. <!-- </foreach>-->
  127. <!-- </update>-->
  128. <update id="updateQwSopTempByIds" parameterType="String">
  129. UPDATE qw_sop_temp set status = 2
  130. WHERE id IN
  131. <foreach item="id" collection="ids" open="(" separator="," close=")">
  132. #{id}
  133. </foreach>
  134. </update>
  135. </mapper>