OrderGoodsDao.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.kmall.admin.dao.OrderGoodsDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.admin.entity.OrderGoodsEntity" id="orderGoodsMap">
  6. <result property="id" column="id"/>
  7. <result property="orderId" column="order_id"/>
  8. <result property="goodsId" column="goods_id"/>
  9. <result property="goodsName" column="goods_name"/>
  10. <result property="goodsSn" column="goods_sn"/>
  11. <result property="productId" column="product_id"/>
  12. <result property="number" column="number"/>
  13. <result property="marketPrice" column="market_price"/>
  14. <result property="retailPrice" column="retail_price"/>
  15. <result property="goodsSpecificationNameValue" column="goods_specification_name_value"/>
  16. <result property="isReal" column="is_real"/>
  17. <result property="goodsSpecificationIds" column="goods_specification_ids"/>
  18. <result property="listPicUrl" column="list_pic_url"/>
  19. <result property="sku" column="sku"/>
  20. </resultMap>
  21. <select id="queryObject" resultType="com.kmall.admin.entity.OrderGoodsEntity">
  22. select * from mall_order_goods where id = #{value}
  23. </select>
  24. <select id="queryList" resultType="com.kmall.admin.entity.OrderGoodsEntity">
  25. select * from mall_order_goods
  26. WHERE 1=1
  27. <if test="orderId != null">
  28. AND order_id = #{orderId}
  29. </if>
  30. <choose>
  31. <when test="sidx != null and sidx.trim() != ''">
  32. order by ${sidx} ${order}
  33. </when>
  34. <otherwise>
  35. order by id desc
  36. </otherwise>
  37. </choose>
  38. <if test="offset != null and limit != null">
  39. limit #{offset}, #{limit}
  40. </if>
  41. </select>
  42. <select id="queryTotal" resultType="int">
  43. select count(*) from mall_order_goods WHERE 1=1
  44. <if test="orderId != null">
  45. AND order_id = #{orderId}
  46. </if>
  47. </select>
  48. <insert id="save" parameterType="com.kmall.admin.entity.OrderGoodsEntity" useGeneratedKeys="true" keyProperty="id">
  49. insert into mall_order_goods
  50. (
  51. `order_id`,
  52. `goods_id`,
  53. `goods_name`,
  54. `goods_sn`,
  55. `product_id`,
  56. `number`,
  57. `market_price`,
  58. `retail_price`,
  59. `goods_specification_name_value`,
  60. `is_real`,
  61. `goods_specification_ids`,
  62. `list_pic_url`
  63. )
  64. values
  65. (
  66. #{orderId},
  67. #{goodsId},
  68. #{goodsName},
  69. #{goodsSn},
  70. #{productId},
  71. #{number},
  72. #{marketPrice},
  73. #{retailPrice},
  74. #{goodsSpecificationNameValue},
  75. #{isReal},
  76. #{goodsSpecificationIds},
  77. #{listPicUrl}
  78. )
  79. </insert>
  80. <update id="update" parameterType="com.kmall.admin.entity.OrderGoodsEntity">
  81. update mall_order_goods
  82. <set>
  83. <if test="orderId != null">`order_id` = #{orderId},</if>
  84. <if test="goodsId != null">`goods_id` = #{goodsId},</if>
  85. <if test="goodsName != null">`goods_name` = #{goodsName},</if>
  86. <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
  87. <if test="productId != null">`product_id` = #{productId},</if>
  88. <if test="number != null">`number` = #{number},</if>
  89. <if test="marketPrice != null">`market_price` = #{marketPrice},</if>
  90. <if test="retailPrice != null">`retail_price` = #{retailPrice},</if>
  91. <if test="goodsSpecificationNameValue != null">`goods_specification_name_value` =
  92. #{goodsSpecificationNameValue},
  93. </if>
  94. <if test="isReal != null">`is_real` = #{isReal},</if>
  95. <if test="goodsSpecificationIds != null">`goods_specification_ids` = #{goodsSpecificationIds},</if>
  96. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}</if>
  97. </set>
  98. where id = #{id}
  99. </update>
  100. <delete id="delete">
  101. delete from mall_order_goods where id = #{value}
  102. </delete>
  103. <delete id="deleteBatch">
  104. delete from mall_order_goods where id in
  105. <foreach item="id" collection="array" open="(" separator="," close=")">
  106. #{id}
  107. </foreach>
  108. </delete>
  109. </mapper>