123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.fjhx.item.mapper.product.ProductInfoMapper">
- <sql id="page">
- SELECT pi.id,
- pi.definition,
- pi.product_classify_id,
- pi.CODE,
- pi.type,
- pi.NAME,
- pi.spec,
- pi.unit,
- pi.remark,
- pi.custom_code,
- pi.create_user,
- pi.create_time,
- pi.update_user,
- pi.update_time,
- pi.bar_code,
- pi.length,
- pi.width,
- pi.height,
- pi.net_weight,
- pi.technology_id,
- pi.name_english,
- pi.technology_id,
- pi.hs_code,
- pi.material,
- pi.frontal_texture,
- pi.reverse_texture,
- pi.color_layer,
- pi.color,
- pi.stock_threshold,
- pi.price,
- pi.currency,
- pi.cost_price,
- pi.cost_currency,
- pi.raw_material_id,
- pi.prod_img_path,
- pi.prod_file_path,
- pi.company_id
- FROM product_info pi
- </sql>
- <select id="getPage" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- <include refid="page"/>
- ${ew.customSqlSegment}
- </select>
- <select id="getList" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- <include refid="page"/>
- ${ew.customSqlSegment}
- </select>
- <select id="getListByProductIds" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- SELECT
- t1.*,
- t2.`name` AS classifyName
- FROM
- product_info t1
- LEFT JOIN product_classify t2 ON t1.product_classify_id = t2.id
- <where>
- <if test="productIds neq null and productIds.size() > 0">
- <foreach collection="productIds" item="productId" open="t1.id IN (" separator="," close=")">
- #{productId}
- </foreach>
- </if>
- </where>
- </select>
- <select id="getListByProductType" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- SELECT
- t1.*,
- t2.`name` AS classifyName
- FROM
- product_info t1
- LEFT JOIN product_classify t2 ON t1.product_classify_id = t2.id
- <where>
- <if test="productType neq null ">
- t1.type = #{productType}
- </if>
- <if test="definition neq null">
- and t1.definition = #{definition}
- </if>
- <if test="productName neq null and productName neq '' ">
- and t1.name = #{productName}
- </if>
- <if test="productCode neq null and productName neq ''">
- and t1.code = #{productCode}
- </if>
- </where>
- </select>
- <select id="productTypeRanking" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- SELECT pi.type type,
- ifnull(SUM(pc.amount), 0) contractAmount,
- ifnull(SUM(pc.quantity), 0) contractQuantity,
- ifnull(sum(pd.amount), 0) purchaseAmount,
- IFNULL(SUM(pd.count), 0) purchaseQuantity
- FROM product_info pi
- LEFT JOIN contract_product pc ON pi.id = pc.product_id
- left join contract bc on pc.contract_id = bc.id
- left join purchase_detail pd on pi.id = pd.bussiness_id
- ${ew.customSqlSegment}
- </select>
- <select id="productRanking" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- SELECT pi.name name,
- ifnull(SUM(pc.amount), 0) contractAmount,
- ifnull(SUM(pc.quantity), 0) contractQuantity,
- ifnull(sum(pd.amount), 0) purchaseAmount,
- IFNULL(SUM(pd.count), 0) purchaseQuantity
- FROM product_info pi
- LEFT JOIN contract_product pc ON pi.id = pc.product_id
- left join contract bc on pc.contract_id = bc.id
- left join purchase_detail pd on pi.id = pd.bussiness_id
- ${ew.customSqlSegment}
- </select>
- <select id="getCustomerProductList" resultType="com.fjhx.item.entity.product.vo.ProductInfoVo">
- <include refid="page"/>
- LEFT JOIN product_classify pc ON pi.product_classify_id = pc.id
- ${ew.customSqlSegment}
- </select>
- <select id="statisticsProduct" resultType="java.util.Map">
- SELECT
- `type` AS `type`,
- count(1) AS count
- FROM
- product_info
- WHERE `type` IS NOT NULL
- AND `type` != "null"
- AND `type` != ""
- AND definition = 1
- GROUP BY
- `type`
- </select>
- <select id="getProductAnalysisPage" resultType="com.fjhx.item.entity.product.bo.ProductAnalysisBo">
- select pi.id AS productId,
- pi.name AS productName
- from product_info pi
- ${ew.customSqlSegment}
- </select>
- </mapper>
|