| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fire.admin.mapper.CustomerProductInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.fire.dto.CustomerProduct">
- <id column="customer_product_id" property="customerProductId"/>
- <result column="customer_id" property="customerId"/>
- <result column="package_id" property="packageId"/>
- <result column="type" property="type"/>
- <result column="price" property="price"/>
- <result column="face_price" property="facePrice"/>
- <result column="is_effective" property="isEffective"/>
- <result column="discount" property="disCount"/>
- </resultMap>
- <resultMap id="ResultMap" type="com.fire.admin.vo.CustomerProductInfoVo">
- <result column="customer_product_id" property="customerProductId"/>
- <result column="customer_id" property="customerId"/>
- <result column="package_id" property="packageId"/>
- <result column="product_name" property="productName"/>
- <result column="type" property="type"/>
- <result column="price" property="price"/>
- <result column="face_price" property="facePrice"/>
- <result column="area_name" property="areaName"/>
- <result column="operator" property="operator"/>
- <result column="is_effective" property="isEffective"/>
- <result column="discount" property="disCount"/>
- </resultMap>
- <sql id="selectCustomerProductByCustomerId">
- cp .customer_product_id,
- cp.customer_id,
- p.package_id,
- p.product_name,
- cp.type,
- cp.price,
- cp.face_price,
- p.area_name,
- p.operator,
- cp.is_effective,
- FORMAT(cp.discount ,4) as discount
- </sql>
- <select id="queryCustomerProductByCustomerId" resultMap="ResultMap">
- SELECT
- <include refid="selectCustomerProductByCustomerId"/>
- FROM
- flow_product_info AS p
- LEFT JOIN customer_product cp ON p.package_id = cp.package_id
- <where>
- <if test="type !=null and type !=''">
- AND cp.type=#{type}
- </if>
- <if test="customerId !=null and customerId !=''">
- AND cp.customer_id=#{customerId}
- </if>
- </where>
- </select>
- </mapper>
|