对比新文件 |
| | |
| | | <?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.gk.firework.Mapper.DeliveryOrderInfoMapper" > |
| | | <resultMap id="BaseResultMap" type="com.gk.firework.Domain.DeliveryOrderInfo" > |
| | | <!-- --> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="ordercode" property="ordercode" jdbcType="VARCHAR" /> |
| | | <result column="createat" property="createat" jdbcType="TIMESTAMP" /> |
| | | <result column="createby" property="createby" jdbcType="VARCHAR" /> |
| | | <result column="operator" property="operator" jdbcType="VARCHAR" /> |
| | | <result column="operatat" property="operatat" jdbcType="TIMESTAMP" /> |
| | | <result column="shop" property="shop" jdbcType="VARCHAR" /> |
| | | <result column="boxnum" property="boxnum" jdbcType="INTEGER" /> |
| | | <result column="type" property="type" jdbcType="TINYINT" /> |
| | | <result column="companynumber" property="companynumber" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | | <!-- --> |
| | | id, ordercode, createat, createby, operator, operatat, shop, boxnum, `type`, companynumber |
| | | </sql> |
| | | <select id="selectPages" resultType="com.gk.firework.Domain.Vo.DeliveryOrderInfoVo"> |
| | | select |
| | | do.id, |
| | | do.ordercode, |
| | | do.createat, |
| | | do.createby, |
| | | do.operator, |
| | | do.operatat, |
| | | do.shop, |
| | | sum(do.num) realboxnum, |
| | | do.transportcert, |
| | | do.`type`, |
| | | do.companynumber |
| | | from ( |
| | | select |
| | | do.id, |
| | | do.ordercode, |
| | | do.createat, |
| | | do.createby, |
| | | do.operator, |
| | | do.operatat, |
| | | do.shop, |
| | | sum(dd.num/p.boxnumber) num, |
| | | do.transportcert, |
| | | do.`type`, |
| | | do.companynumber |
| | | from deliveryorder as do |
| | | left join deliverydetail as dd on dd.deliverycode = do.ordercode |
| | | left join product as p on p.directioncode = dd.itemcode and p.isdel = 0 |
| | | <where> |
| | | <if test="params.starttime != null and params.starttime != ''"> |
| | | and do.operatat >= #{params.starttime} |
| | | </if> |
| | | <if test="params.endtime != null and params.endtime != ''"> |
| | | and do.operatat < #{params.endtime} |
| | | </if> |
| | | <if test="params.transportcert != null and params.transportcert != ''"> |
| | | and do.transportcert like concat("%",#{params.transportcert},"%") |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and do.type = #{params.type} |
| | | </if> |
| | | <if test="params.code != null and params.code != ''"> |
| | | and do.ordercode like concat("%",#{params.code},"%") |
| | | </if> |
| | | </where> |
| | | group by do.ordercode,dd.itemcode |
| | | ) as do |
| | | left join enterprise as e on e.enterprisenumber = do.companynumber |
| | | <where> |
| | | e.validflag = 1 |
| | | and e.enterprisestatus = 'ON' |
| | | <choose> |
| | | <when test="params.enterprisenumber != null and params.enterprisenumber != ''"> |
| | | and do.companynumber = #{params.enterprisenumber} |
| | | </when> |
| | | <otherwise> |
| | | <if test="params.province != null and params.province != ''"> |
| | | and e.province = #{params.province} |
| | | </if> |
| | | <if test="params.city != null and params.city != ''"> |
| | | and e.city = #{params.city} |
| | | </if> |
| | | <if test="params.district != null and params.district != ''"> |
| | | and e.district = #{params.district} |
| | | </if> |
| | | <if test="params.street != null and params.street != ''"> |
| | | and e.street = #{params.street} |
| | | </if> |
| | | <if test="params.committee != null and params.committee != ''"> |
| | | and e.committee = #{params.committee} |
| | | </if> |
| | | </otherwise> |
| | | </choose> |
| | | <if test="params.filterProvince != null and params.filterProvince != ''"> |
| | | and e.province = #{params.filterProvince} |
| | | </if> |
| | | <if test="params.filterCity != null and params.filterCity != ''"> |
| | | and e.city = #{params.filterCity} |
| | | </if> |
| | | <if test="params.filterDistrict != null and params.filterDistrict != ''"> |
| | | and e.district = #{params.filterDistrict} |
| | | </if> |
| | | <if test="params.filterStreet != null and params.filterStreet != ''"> |
| | | and e.street = #{params.filterStreet} |
| | | </if> |
| | | <if test="params.filterCommittee != null and params.filterCommittee != ''"> |
| | | and e.committee = #{params.filterCommittee} |
| | | </if> |
| | | <if test="params.filterType != null and params.filterType != ''"> |
| | | and do.type = #{params.filterType} |
| | | </if> |
| | | <if test="params.enterprisename != null and params.enterprisename != ''"> |
| | | and e.enterprisename like concat("%",#{params.enterprisename},"%") |
| | | </if> |
| | | <if test="params.safetysupervision != null and params.safetysupervision != ''"> |
| | | and e.safetysupervision = #{params.safetysupervision} |
| | | </if> |
| | | </where> |
| | | |
| | | group by do.ordercode |
| | | order by do.operatat desc |
| | | </select> |
| | | |
| | | <select id="getDeliveryNum" resultType="decimal"> |
| | | select |
| | | sum(detail.num/product.boxnumber) |
| | | from deliverydetail as detail |
| | | left join deliveryorder as delivery on delivery.ordercode = detail.deliverycode |
| | | left join product on detail.itemcode = product.directioncode and product.isdel = 0 |
| | | <where> |
| | | delivery.type = 1 |
| | | and delivery.operatat >= #{condition.beginDate} |
| | | and delivery.operatat <= #{condition.endDate} |
| | | and delivery.companynumber = #{condition.companyNumber} |
| | | <if test="condition.itemCode != null"> |
| | | and product.directioncode = #{condition.itemCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="getReturnDeliveryNum" resultType="decimal"> |
| | | select |
| | | sum(detail.num/product.boxnumber) |
| | | from deliverydetail as detail |
| | | left join deliveryorder as delivery on delivery.ordercode = detail.deliverycode |
| | | left join product on detail.itemcode = product.directioncode and product.isdel = 0 |
| | | <where> |
| | | delivery.type = 2 |
| | | and delivery.operatat >= #{condition.beginDate} |
| | | and delivery.operatat <= #{condition.endDate} |
| | | and delivery.companynumber = #{condition.companyNumber} |
| | | <if test="condition.itemCode != null"> |
| | | and product.directioncode = #{condition.itemCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectDeliveryOrderByTimeAndUser" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from deliveryorder |
| | | <where> |
| | | operator = #{username} |
| | | and operatat = #{datetime} |
| | | </where> |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="getProductVosByCert" resultType="com.gk.firework.Domain.Vo.ProductVo"> |
| | | select |
| | | detail.itemcode as itemCode, |
| | | detail.itemname as name, |
| | | COUNT(detail.id)as num |
| | | from deliverydetail_slice1 as detail |
| | | LEFT JOIN deliveryorder_slice1 as dor on dor.ordercode = detail.deliverycode |
| | | where dor.transportcert = #{cert} |
| | | group by detail.itemcode |
| | | </select> |
| | | </mapper> |