ProductLabelServiceDaoImplMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. left join product_category pc on pc.category_id = p.category_id and pc.store_id = p.store_id and pc.status_cd = '0'
  21. left join t_dict td on p.state = td.status_cd and td.table_name= 'product' and td.table_columns = 'state'
  22. left join product_label t on t.product_id = p.product_id and t.store_id = p.store_id and t.status_cd = '0'
  23. <if test="labelCd !=null and labelCd != ''">
  24. and t.label_cd= #{labelCd}
  25. </if>
  26. where 1 =1
  27. <if test="labelId !=null and labelId != ''">
  28. and t.label_id= #{labelId}
  29. </if>
  30. <if test="productId !=null and productId != ''">
  31. and t.product_id= #{productId}
  32. </if>
  33. <if test="statusCd !=null and statusCd != ''">
  34. and t.status_cd= #{statusCd}
  35. </if>
  36. <if test="storeId !=null and storeId != ''">
  37. and t.store_id= #{storeId}
  38. </if>
  39. <if test='hasProduct !=null and hasProduct == "N"'>
  40. and t.product_id is null
  41. </if>
  42. order by t.create_time desc
  43. <if test="page != -1 and page != null ">
  44. limit #{page}, #{row}
  45. </if>
  46. </select>
  47. <!-- 修改产品标签信息 add by wuxw 2018-07-03 -->
  48. <update id="updateProductLabelInfo" parameterType="Map">
  49. update product_label t set t.status_cd = #{statusCd}
  50. <if test="newBId != null and newBId != ''">
  51. ,t.b_id = #{newBId}
  52. </if>
  53. <if test="productId !=null and productId != ''">
  54. , t.product_id= #{productId}
  55. </if>
  56. <if test="storeId !=null and storeId != ''">
  57. , t.store_id= #{storeId}
  58. </if>
  59. <if test="labelCd !=null and labelCd != ''">
  60. , t.label_cd= #{labelCd}
  61. </if>
  62. where 1=1
  63. <if test="labelId !=null and labelId != ''">
  64. and t.label_id= #{labelId}
  65. </if>
  66. </update>
  67. <!-- 查询产品标签数量 add by wuxw 2018-07-03 -->
  68. <select id="queryProductLabelsCount" parameterType="Map" resultType="Map">
  69. select count(1) count
  70. from product p
  71. left join product_category pc on pc.category_id = p.category_id and pc.store_id = p.store_id and pc.status_cd = '0'
  72. left join t_dict td on p.state = td.status_cd and td.table_name= 'product' and td.table_columns = 'state'
  73. left join product_label t on t.product_id = p.product_id and t.store_id = p.store_id and t.status_cd = '0'
  74. <if test="labelCd !=null and labelCd != ''">
  75. and t.label_cd= #{labelCd}
  76. </if>
  77. where 1 =1
  78. <if test="labelId !=null and labelId != ''">
  79. and t.label_id= #{labelId}
  80. </if>
  81. <if test="productId !=null and productId != ''">
  82. and t.product_id= #{productId}
  83. </if>
  84. <if test="statusCd !=null and statusCd != ''">
  85. and t.status_cd= #{statusCd}
  86. </if>
  87. <if test="storeId !=null and storeId != ''">
  88. and t.store_id= #{storeId}
  89. </if>
  90. <if test='hasProduct !=null and hasProduct == "N"'>
  91. and t.product_id is null
  92. </if>
  93. </select>
  94. </mapper>