TwinOrderDetailMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.jjt.order.mapper.TwinOrderDetailMapper">
  6. <resultMap type="TwinOrderDetail" id="TwinOrderDetailResult">
  7. <result property="odId" column="OD_ID" />
  8. <result property="oderId" column="ODER_ID" />
  9. <result property="weight" column="WEIGHT" />
  10. <result property="price" column="PRICE" />
  11. <result property="unit" column="UNIT" />
  12. <result property="num" column="NUM" />
  13. <result property="totalPrice" column="TOTAL_PRICE" />
  14. <result property="color" column="COLOR" />
  15. <result property="bomCode" column="BOM_CODE" />
  16. <result property="bomName" column="BOM_NAME" />
  17. <result property="bomWeight" column="BOM_WEIGHT" />
  18. <result property="bomSpec" column="BOM_SPEC" />
  19. <result property="remark" column="REMARK" />
  20. </resultMap>
  21. <sql id="selectTwinOrderDetailVo">
  22. select OD_ID, ODER_ID, WEIGHT, PRICE, UNIT, NUM, TOTAL_PRICE, COLOR, BOM_CODE, BOM_NAME, BOM_WEIGHT, BOM_SPEC, REMARK from TWIN_ORDER_DETAIL
  23. </sql>
  24. <select id="selectTwinOrderDetailList" parameterType="TwinOrderDetail" resultMap="TwinOrderDetailResult">
  25. <include refid="selectTwinOrderDetailVo"/>
  26. <where>
  27. <if test="oderId != null "> and ODER_ID = #{oderId}</if>
  28. <if test="weight != null "> and WEIGHT = #{weight}</if>
  29. <if test="price != null "> and PRICE = #{price}</if>
  30. <if test="unit != null and unit != ''"> and UNIT = #{unit}</if>
  31. <if test="num != null "> and NUM = #{num}</if>
  32. <if test="totalPrice != null "> and TOTAL_PRICE = #{totalPrice}</if>
  33. <if test="color != null and color != ''"> and COLOR = #{color}</if>
  34. <if test="bomCode != null and bomCode != ''"> and BOM_CODE = #{bomCode}</if>
  35. <if test="bomName != null and bomName != ''"> and BOM_NAME like concat('%', #{bomName}, '%')</if>
  36. <if test="bomWeight != null "> and BOM_WEIGHT = #{bomWeight}</if>
  37. <if test="bomSpec != null and bomSpec != ''"> and BOM_SPEC = #{bomSpec}</if>
  38. <if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
  39. </where>
  40. </select>
  41. <select id="selectTwinOrderDetailByOdId" parameterType="Long" resultMap="TwinOrderDetailResult">
  42. <include refid="selectTwinOrderDetailVo"/>
  43. where OD_ID = #{odId}
  44. </select>
  45. <insert id="insertTwinOrderDetail" parameterType="TwinOrderDetail">
  46. insert into TWIN_ORDER_DETAIL
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="odId != null">OD_ID,</if>
  49. <if test="oderId != null">ODER_ID,</if>
  50. <if test="weight != null">WEIGHT,</if>
  51. <if test="price != null">PRICE,</if>
  52. <if test="unit != null">UNIT,</if>
  53. <if test="num != null">NUM,</if>
  54. <if test="totalPrice != null">TOTAL_PRICE,</if>
  55. <if test="color != null">COLOR,</if>
  56. <if test="bomCode != null">BOM_CODE,</if>
  57. <if test="bomName != null">BOM_NAME,</if>
  58. <if test="bomWeight != null">BOM_WEIGHT,</if>
  59. <if test="bomSpec != null">BOM_SPEC,</if>
  60. <if test="remark != null">REMARK,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="odId != null">#{odId},</if>
  64. <if test="oderId != null">#{oderId},</if>
  65. <if test="weight != null">#{weight},</if>
  66. <if test="price != null">#{price},</if>
  67. <if test="unit != null">#{unit},</if>
  68. <if test="num != null">#{num},</if>
  69. <if test="totalPrice != null">#{totalPrice},</if>
  70. <if test="color != null">#{color},</if>
  71. <if test="bomCode != null">#{bomCode},</if>
  72. <if test="bomName != null">#{bomName},</if>
  73. <if test="bomWeight != null">#{bomWeight},</if>
  74. <if test="bomSpec != null">#{bomSpec},</if>
  75. <if test="remark != null">#{remark},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateTwinOrderDetail" parameterType="TwinOrderDetail">
  79. update TWIN_ORDER_DETAIL
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="oderId != null">ODER_ID = #{oderId},</if>
  82. <if test="weight != null">WEIGHT = #{weight},</if>
  83. <if test="price != null">PRICE = #{price},</if>
  84. <if test="unit != null">UNIT = #{unit},</if>
  85. <if test="num != null">NUM = #{num},</if>
  86. <if test="totalPrice != null">TOTAL_PRICE = #{totalPrice},</if>
  87. <if test="color != null">COLOR = #{color},</if>
  88. <if test="bomCode != null">BOM_CODE = #{bomCode},</if>
  89. <if test="bomName != null">BOM_NAME = #{bomName},</if>
  90. <if test="bomWeight != null">BOM_WEIGHT = #{bomWeight},</if>
  91. <if test="bomSpec != null">BOM_SPEC = #{bomSpec},</if>
  92. <if test="remark != null">REMARK = #{remark},</if>
  93. </trim>
  94. where OD_ID = #{odId}
  95. </update>
  96. <delete id="deleteTwinOrderDetailByOdId" parameterType="Long">
  97. delete from TWIN_ORDER_DETAIL where OD_ID = #{odId}
  98. </delete>
  99. <delete id="deleteTwinOrderDetailByOdIds" parameterType="String">
  100. delete from TWIN_ORDER_DETAIL where OD_ID in
  101. <foreach item="odId" collection="array" open="(" separator="," close=")">
  102. #{odId}
  103. </foreach>
  104. </delete>
  105. </mapper>