SopOrderLogMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.SopOrderLogMapper">
  6. <resultMap type="SopOrderLog" id="SopOrderLogResult">
  7. <result property="id" column="id" />
  8. <result property="sopId" column="sop_id" />
  9. <result property="fsUserId" column="fs_user_id" />
  10. <result property="isBuy" column="is_buy" />
  11. <result property="orderSendType" column="order_send_type" />
  12. <result property="crateTime" column="crate_time" />
  13. <result property="updateTime" column="update_time" />
  14. <result property="sendTime" column="send_time" />
  15. <result property="status" column="status" />
  16. </resultMap>
  17. <sql id="selectSopOrderLogVo">
  18. select id, sop_id, fs_user_id, is_buy, order_send_type, crate_time, update_time, send_time,status from sop_order_log
  19. </sql>
  20. <select id="selectSopOrderLogList" parameterType="SopOrderLog" resultMap="SopOrderLogResult">
  21. <include refid="selectSopOrderLogVo"/>
  22. <where>
  23. <if test="sopId != null and sopId != ''"> and sop_id = #{sopId}</if>
  24. <if test="fsUserId != null "> and fs_user_id = #{fsUserId}</if>
  25. <if test="isBuy != null "> and is_buy = #{isBuy}</if>
  26. <if test="orderSendType != null "> and order_send_type = #{orderSendType}</if>
  27. <if test="crateTime != null "> and crate_time = #{crateTime}</if>
  28. <if test="sendTime != null "> and send_time = #{sendTime}</if>
  29. <if test="status != null "> and status = #{status}</if>
  30. </where>
  31. </select>
  32. <select id="selectSopOrderLogById" parameterType="Long" resultMap="SopOrderLogResult">
  33. <include refid="selectSopOrderLogVo"/>
  34. where id = #{id}
  35. </select>
  36. <select id="queryUnsentSOPData" resultType="com.fs.sop.domain.SopOrderLog">
  37. SELECT sol.id,sol.sop_id,sol.is_buy,sol.order_send_type,sol.status FROM sop_order_log sol WHERE sol.send_time &lt;=NOW() and sol.status=0
  38. </select>
  39. <insert id="insertSopOrderLog" parameterType="SopOrderLog" useGeneratedKeys="true" keyProperty="id">
  40. insert into sop_order_log
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="sopId != null">sop_id,</if>
  43. <if test="exId != null">ex_id,</if>
  44. <if test="isBuy != null">is_buy,</if>
  45. <if test="orderSendType != null">order_send_type,</if>
  46. <if test="crateTime != null">crate_time,</if>
  47. <if test="updateTime != null">update_time,</if>
  48. <if test="sendTime != null">send_time,</if>
  49. <if test="status != null">status,</if>
  50. <if test="companyUserId != null">company_user_id,</if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides=",">
  53. <if test="sopId != null">#{sopId},</if>
  54. <if test="exId != null">#{exId},</if>
  55. <if test="isBuy != null">#{isBuy},</if>
  56. <if test="orderSendType != null">#{orderSendType},</if>
  57. <if test="crateTime != null">#{crateTime},</if>
  58. <if test="updateTime != null">#{updateTime},</if>
  59. <if test="sendTime != null">#{sendTime},</if>
  60. <if test="status != null">#{status},</if>
  61. <if test="companyUserId != null">#{companyUserId},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateSopOrderLog" parameterType="SopOrderLog">
  65. update sop_order_log
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="sopId != null">sop_id = #{sopId},</if>
  68. <if test="fsUserId != null">fs_user_id = #{fsUserId},</if>
  69. <if test="isBuy != null">is_buy = #{isBuy},</if>
  70. <if test="orderSendType != null">order_send_type = #{orderSendType},</if>
  71. <if test="crateTime != null">crate_time = #{crateTime},</if>
  72. <if test="updateTime != null">update_time = #{updateTime},</if>
  73. <if test="sendTime != null">send_time = #{sendTime},</if>
  74. <if test="status != null">status = #{status},</if>
  75. </trim>
  76. where id = #{id}
  77. </update>
  78. <update id="updateIsSentSOPDataByIds" parameterType="java.util.List">
  79. UPDATE sop_order_log
  80. SET status = 1
  81. WHERE id IN
  82. <foreach collection="list" item="id" open="(" close=")" separator=",">
  83. #{id}
  84. </foreach>
  85. </update>
  86. <delete id="deleteSopOrderLogById" parameterType="Long">
  87. delete from sop_order_log where id = #{id}
  88. </delete>
  89. <delete id="deleteSopOrderLogByIds" parameterType="String">
  90. delete from sop_order_log where id in
  91. <foreach item="id" collection="array" open="(" separator="," close=")">
  92. #{id}
  93. </foreach>
  94. </delete>
  95. </mapper>