CustomerProductInfoMapper.xml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.fire.admin.mapper.CustomerProductInfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.fire.dto.CustomerProduct">
  6. <id column="customer_product_id" property="customerProductId"/>
  7. <result column="customer_id" property="customerId"/>
  8. <result column="package_id" property="packageId"/>
  9. <result column="type" property="type"/>
  10. <result column="price" property="price"/>
  11. <result column="face_price" property="facePrice"/>
  12. <result column="is_effective" property="isEffective"/>
  13. <result column="discount" property="disCount"/>
  14. </resultMap>
  15. <resultMap id="ResultMap" type="com.fire.admin.vo.CustomerProductInfoVo">
  16. <result column="customer_product_id" property="customerProductId"/>
  17. <result column="customer_id" property="customerId"/>
  18. <result column="package_id" property="packageId"/>
  19. <result column="product_name" property="productName"/>
  20. <result column="type" property="type"/>
  21. <result column="price" property="price"/>
  22. <result column="face_price" property="facePrice"/>
  23. <result column="area_name" property="areaName"/>
  24. <result column="operator" property="operator"/>
  25. <result column="is_effective" property="isEffective"/>
  26. <result column="discount" property="disCount"/>
  27. </resultMap>
  28. <sql id="selectCustomerProductByCustomerId">
  29. cp .customer_product_id,
  30. cp.customer_id,
  31. p.package_id,
  32. p.product_name,
  33. cp.type,
  34. cp.price,
  35. cp.face_price,
  36. p.area_name,
  37. p.operator,
  38. cp.is_effective,
  39. FORMAT(cp.discount ,4) as discount
  40. </sql>
  41. <select id="queryCustomerProductByCustomerId" resultMap="ResultMap">
  42. SELECT
  43. <include refid="selectCustomerProductByCustomerId"/>
  44. FROM
  45. flow_product_info AS p
  46. LEFT JOIN customer_product cp ON p.package_id = cp.package_id
  47. <where>
  48. <if test="type !=null and type !=''">
  49. AND cp.type=#{type}
  50. </if>
  51. <if test="customerId !=null and customerId !=''">
  52. AND cp.customer_id=#{customerId}
  53. </if>
  54. </where>
  55. </select>
  56. </mapper>