1
0

OrderGoodsDao.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. </resultMap>
  20. <select id="queryObject" resultType="com.kmall.admin.entity.OrderGoodsEntity">
  21. select * from mall_order_goods where id = #{value}
  22. </select>
  23. <select id="queryList" resultType="com.kmall.admin.entity.OrderGoodsEntity">
  24. select * from mall_order_goods
  25. WHERE 1=1
  26. <if test="orderId != null">
  27. AND order_id = #{orderId}
  28. </if>
  29. <choose>
  30. <when test="sidx != null and sidx.trim() != ''">
  31. order by ${sidx} ${order}
  32. </when>
  33. <otherwise>
  34. order by id desc
  35. </otherwise>
  36. </choose>
  37. <if test="offset != null and limit != null">
  38. limit #{offset}, #{limit}
  39. </if>
  40. </select>
  41. <select id="queryTotal" resultType="int">
  42. select count(*) from mall_order_goods WHERE 1=1
  43. <if test="orderId != null">
  44. AND order_id = #{orderId}
  45. </if>
  46. </select>
  47. <insert id="save" parameterType="com.kmall.admin.entity.OrderGoodsEntity" useGeneratedKeys="true" keyProperty="id">
  48. insert into mall_order_goods
  49. (
  50. `order_id`,
  51. `goods_id`,
  52. `goods_name`,
  53. `goods_sn`,
  54. `product_id`,
  55. `number`,
  56. `market_price`,
  57. `retail_price`,
  58. `goods_specification_name_value`,
  59. `is_real`,
  60. `goods_specification_ids`,
  61. `list_pic_url`
  62. )
  63. values
  64. (
  65. #{orderId},
  66. #{goodsId},
  67. #{goodsName},
  68. #{goodsSn},
  69. #{productId},
  70. #{number},
  71. #{marketPrice},
  72. #{retailPrice},
  73. #{goodsSpecificationNameValue},
  74. #{isReal},
  75. #{goodsSpecificationIds},
  76. #{listPicUrl}
  77. )
  78. </insert>
  79. <update id="update" parameterType="com.kmall.admin.entity.OrderGoodsEntity">
  80. update mall_order_goods
  81. <set>
  82. <if test="orderId != null">`order_id` = #{orderId},</if>
  83. <if test="goodsId != null">`goods_id` = #{goodsId},</if>
  84. <if test="goodsName != null">`goods_name` = #{goodsName},</if>
  85. <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
  86. <if test="productId != null">`product_id` = #{productId},</if>
  87. <if test="number != null">`number` = #{number},</if>
  88. <if test="marketPrice != null">`market_price` = #{marketPrice},</if>
  89. <if test="retailPrice != null">`retail_price` = #{retailPrice},</if>
  90. <if test="goodsSpecificationNameValue != null">`goods_specification_name_value` =
  91. #{goodsSpecificationNameValue},
  92. </if>
  93. <if test="isReal != null">`is_real` = #{isReal},</if>
  94. <if test="goodsSpecificationIds != null">`goods_specification_ids` = #{goodsSpecificationIds},</if>
  95. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}</if>
  96. </set>
  97. where id = #{id}
  98. </update>
  99. <delete id="delete">
  100. delete from mall_order_goods where id = #{value}
  101. </delete>
  102. <delete id="deleteBatch">
  103. delete from mall_order_goods where id in
  104. <foreach item="id" collection="array" open="(" separator="," close=")">
  105. #{id}
  106. </foreach>
  107. </delete>
  108. </mapper>