LiveGoodsMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.live.mapper.LiveGoodsMapper">
  6. <resultMap type="LiveGoods" id="LiveGoodsResult">
  7. <result property="goodsId" column="goods_id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="goodsName" column="goods_name" />
  10. <result property="goodsDesc" column="goods_desc" />
  11. <result property="imgUrl" column="img_url" />
  12. <result property="images" column="images" />
  13. <result property="price" column="price" />
  14. <result property="opPrice" column="op_price" />
  15. <result property="status" column="status" />
  16. <result property="stock" column="stock" />
  17. <result property="sort" column="sort" />
  18. <result property="createTime" column="create_time" />
  19. <result property="createBy" column="create_by" />
  20. <result property="updateBy" column="update_by" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="remark" column="remark" />
  23. </resultMap>
  24. <sql id="selectLiveGoodsVo">
  25. select goods_id, live_id, goods_name, goods_desc, img_url, images, price, op_price, status, stock, sort, create_time, create_by, update_by, update_time, remark from live_goods
  26. </sql>
  27. <select id="selectLiveGoodsList" parameterType="LiveGoods" resultMap="LiveGoodsResult">
  28. <include refid="selectLiveGoodsVo"/>
  29. <where>
  30. <if test="liveId != null "> and live_id = #{liveId}</if>
  31. <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
  32. <if test="goodsDesc != null and goodsDesc != ''"> and goods_desc = #{goodsDesc}</if>
  33. <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
  34. <if test="images != null and images != ''"> and images = #{images}</if>
  35. <if test="price != null "> and price = #{price}</if>
  36. <if test="opPrice != null "> and op_price = #{opPrice}</if>
  37. <if test="status != null "> and status = #{status}</if>
  38. <if test="stock != null "> and stock = #{stock}</if>
  39. <if test="sort != null "> and sort = #{sort}</if>
  40. </where>
  41. </select>
  42. <select id="selectLiveGoodsByGoodsId" parameterType="Long" resultMap="LiveGoodsResult">
  43. <include refid="selectLiveGoodsVo"/>
  44. where goods_id = #{goodsId}
  45. </select>
  46. <insert id="insertLiveGoods" parameterType="LiveGoods" useGeneratedKeys="true" keyProperty="goodsId">
  47. insert into live_goods
  48. <trim prefix="(" suffix=")" suffixOverrides=",">
  49. <if test="liveId != null">live_id,</if>
  50. <if test="goodsName != null">goods_name,</if>
  51. <if test="goodsDesc != null">goods_desc,</if>
  52. <if test="imgUrl != null">img_url,</if>
  53. <if test="images != null">images,</if>
  54. <if test="price != null">price,</if>
  55. <if test="opPrice != null">op_price,</if>
  56. <if test="status != null">status,</if>
  57. <if test="stock != null">stock,</if>
  58. <if test="sort != null">sort,</if>
  59. <if test="createTime != null">create_time,</if>
  60. <if test="createBy != null">create_by,</if>
  61. <if test="updateBy != null">update_by,</if>
  62. <if test="updateTime != null">update_time,</if>
  63. <if test="remark != null">remark,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="liveId != null">#{liveId},</if>
  67. <if test="goodsName != null">#{goodsName},</if>
  68. <if test="goodsDesc != null">#{goodsDesc},</if>
  69. <if test="imgUrl != null">#{imgUrl},</if>
  70. <if test="images != null">#{images},</if>
  71. <if test="price != null">#{price},</if>
  72. <if test="opPrice != null">#{opPrice},</if>
  73. <if test="status != null">#{status},</if>
  74. <if test="stock != null">#{stock},</if>
  75. <if test="sort != null">#{sort},</if>
  76. <if test="createTime != null">#{createTime},</if>
  77. <if test="createBy != null">#{createBy},</if>
  78. <if test="updateBy != null">#{updateBy},</if>
  79. <if test="updateTime != null">#{updateTime},</if>
  80. <if test="remark != null">#{remark},</if>
  81. </trim>
  82. </insert>
  83. <update id="updateLiveGoods" parameterType="LiveGoods">
  84. update live_goods
  85. <trim prefix="SET" suffixOverrides=",">
  86. <if test="liveId != null">live_id = #{liveId},</if>
  87. <if test="goodsName != null">goods_name = #{goodsName},</if>
  88. <if test="goodsDesc != null">goods_desc = #{goodsDesc},</if>
  89. <if test="imgUrl != null">img_url = #{imgUrl},</if>
  90. <if test="images != null">images = #{images},</if>
  91. <if test="price != null">price = #{price},</if>
  92. <if test="opPrice != null">op_price = #{opPrice},</if>
  93. <if test="status != null">status = #{status},</if>
  94. <if test="stock != null">stock = #{stock},</if>
  95. <if test="sort != null">sort = #{sort},</if>
  96. <if test="createTime != null">create_time = #{createTime},</if>
  97. <if test="createBy != null">create_by = #{createBy},</if>
  98. <if test="updateBy != null">update_by = #{updateBy},</if>
  99. <if test="updateTime != null">update_time = #{updateTime},</if>
  100. <if test="remark != null">remark = #{remark},</if>
  101. </trim>
  102. where goods_id = #{goodsId}
  103. </update>
  104. <delete id="deleteLiveGoodsByGoodsId" parameterType="Long">
  105. delete from live_goods where goods_id = #{goodsId}
  106. </delete>
  107. <delete id="deleteLiveGoodsByGoodsIds" parameterType="String">
  108. delete from live_goods where goods_id in
  109. <foreach item="goodsId" collection="array" open="(" separator="," close=")">
  110. #{goodsId}
  111. </foreach>
  112. </delete>
  113. </mapper>