1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?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.sale.mapper.contract.ContractMapper">
- <select id="getPage" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
- select
- *
- from contract
- ${ew.customSqlSegment}
- </select>
- <select id="getNoPackContractByCustomerId" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
- SELECT
- *
- FROM
- (
- SELECT
- t1.*,
- t2.quantity AS cpQuantity,
- ( SELECT IFNULL( SUM( quantity ), 0 ) FROM pack_detail_product WHERE contract_product_id = t2.id ) AS sumPackQuantity
- FROM
- contract t1
- LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
- WHERE
- buy_corporation_id = #{customerId}
- ) t1
- WHERE t1.sumPackQuantity < t1.cpQuantity
- AND t1.`status` >=30 <999
- GROUP BY t1.id
- </select>
- <select id="getNoPackContractProductById" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
- SELECT
- *
- FROM
- (
- SELECT
- t1.*,
- t2.quantity AS cpQuantity,
- t2.id AS contractProductId,
- ( SELECT IFNULL( SUM( quantity ), 0 ) FROM pack_detail_product WHERE contract_product_id = t2.id ) AS sumPackQuantity
- FROM
- contract t1
- LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
- WHERE
- buy_corporation_id = #{customerId}
- ) t1
- WHERE t1.sumPackQuantity < t1.cpQuantity
- AND t1.id = #{contractId}
- </select>
- </mapper>
|