ProductInfoMapper.xml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.fjhx.item.mapper.product.ProductInfoMapper">
  4. <select id="getPage" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
  5. SELECT
  6. pi.id,
  7. pi.definition,
  8. pi.product_classify_id,
  9. pi.CODE,
  10. pi.type,
  11. pi.NAME,
  12. pi.spec,
  13. pi.unit,
  14. pi.remark,
  15. pi.create_user,
  16. pi.create_time,
  17. pi.update_user,
  18. pi.update_time,
  19. pi.victoriatourist_json,
  20. IF(DATEDIFF(now(),json_unquote( victoriatourist_json -> '$.growUpDay' ))> 0,3,IF(DATEDIFF(now(), json_unquote(victoriatourist_json -> '$.newProductsDay' ))> 0, 2, 1 )) AS lifeCycle
  21. FROM
  22. product_info pi
  23. ${ew.customSqlSegment}
  24. </select>
  25. <select id="getListByProductIds" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
  26. SELECT
  27. t1.*,
  28. t2.`name` AS classifyName
  29. FROM
  30. product_info t1
  31. LEFT JOIN product_classify t2 ON t1.product_classify_id = t2.id
  32. <where>
  33. <if test="productIds neq null and productIds.size() > 0">
  34. <foreach collection="productIds" item="productId" open="t1.id IN (" separator="," close=")">
  35. #{productId}
  36. </foreach>
  37. </if>
  38. </where>
  39. </select>
  40. <select id="getListByProductType" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
  41. SELECT
  42. t1.*,
  43. t2.`name` AS classifyName
  44. FROM
  45. product_info t1
  46. LEFT JOIN product_classify t2 ON t1.product_classify_id = t2.id
  47. <where>
  48. <if test="productType neq null ">
  49. t1.type = #{productType}
  50. </if>
  51. </where>
  52. </select>
  53. </mapper>