ProductLabelServiceDaoImplMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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="productLabelServiceDaoImpl">
  6. <!-- 保存产品标签信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveProductLabelInfo" parameterType="Map">
  8. insert into product_label(
  9. label_id,product_id,store_id,label_cd
  10. ) values (
  11. #{labelId},#{productId},#{storeId},#{labelCd}
  12. )
  13. </insert>
  14. <!-- 查询产品标签信息 add by wuxw 2018-07-03 -->
  15. <select id="getProductLabelInfo" parameterType="Map" resultType="Map">
  16. select t.label_id,t.label_id labelId,p.product_id productId,p.store_id storeId,t.label_cd,t.label_cd labelCd,
  17. p.unit_name unitName,p.is_postage isPostage,p.sort,p.bar_code barCode,p.postage,p.prod_name prodName,
  18. p.state,p.keyword,p.prod_desc prodDesc,p.category_id categoryId,pc.category_name categoryName,td.name stateName,
  19. t.create_time createTime
  20. from product p
  21. left join product_category pc on pc.category_id = p.category_id and pc.store_id = p.store_id and pc.status_cd = '0'
  22. left join t_dict td on p.state = td.status_cd and td.table_name= 'product' and td.table_columns = 'state'
  23. left join product_label t on t.product_id = p.product_id and t.store_id = p.store_id and t.status_cd = '0'
  24. where 1 =1
  25. <if test="labelId !=null and labelId != ''">
  26. and t.label_id= #{labelId}
  27. </if>
  28. <if test="productId !=null and productId != ''">
  29. and t.product_id= #{productId}
  30. </if>
  31. <if test="statusCd !=null and statusCd != ''">
  32. and t.status_cd= #{statusCd}
  33. </if>
  34. <if test="storeId !=null and storeId != ''">
  35. and t.store_id= #{storeId}
  36. </if>
  37. <if test="labelCd !=null and labelCd != ''">
  38. and t.label_cd= #{labelCd}
  39. </if>
  40. <if test="hasProduct !=null and hasProduct == 'N'">
  41. and p.product_id is null
  42. </if>
  43. order by t.create_time desc
  44. <if test="page != -1 and page != null ">
  45. limit #{page}, #{row}
  46. </if>
  47. </select>
  48. <!-- 修改产品标签信息 add by wuxw 2018-07-03 -->
  49. <update id="updateProductLabelInfo" parameterType="Map">
  50. update product_label t set t.status_cd = #{statusCd}
  51. <if test="newBId != null and newBId != ''">
  52. ,t.b_id = #{newBId}
  53. </if>
  54. <if test="productId !=null and productId != ''">
  55. , t.product_id= #{productId}
  56. </if>
  57. <if test="storeId !=null and storeId != ''">
  58. , t.store_id= #{storeId}
  59. </if>
  60. <if test="labelCd !=null and labelCd != ''">
  61. , t.label_cd= #{labelCd}
  62. </if>
  63. where 1=1
  64. <if test="labelId !=null and labelId != ''">
  65. and t.label_id= #{labelId}
  66. </if>
  67. </update>
  68. <!-- 查询产品标签数量 add by wuxw 2018-07-03 -->
  69. <select id="queryProductLabelsCount" parameterType="Map" resultType="Map">
  70. select count(1) count
  71. from product p
  72. left join product_category pc on pc.category_id = p.category_id and pc.store_id = p.store_id and pc.status_cd = '0'
  73. left join t_dict td on p.state = td.status_cd and td.table_name= 'product' and td.table_columns = 'state'
  74. left join product_label t on t.product_id = p.product_id and t.store_id = p.store_id and t.status_cd = '0'
  75. where 1 =1
  76. <if test="labelId !=null and labelId != ''">
  77. and t.label_id= #{labelId}
  78. </if>
  79. <if test="productId !=null and productId != ''">
  80. and t.product_id= #{productId}
  81. </if>
  82. <if test="statusCd !=null and statusCd != ''">
  83. and t.status_cd= #{statusCd}
  84. </if>
  85. <if test="storeId !=null and storeId != ''">
  86. and t.store_id= #{storeId}
  87. </if>
  88. <if test="labelCd !=null and labelCd != ''">
  89. and t.label_cd= #{labelCd}
  90. </if>
  91. <if test="hasProduct !=null and hasProduct == 'N'">
  92. and p.product_id is null
  93. </if>
  94. </select>
  95. </mapper>