| | |
| | | </select> |
| | | |
| | | <select id="selectSupplierDoList4Check" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderList4CheckDTO"> |
| | | SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum, sum(tt.amount) totalAmount |
| | | SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum |
| | | , sum(tt.amount) totalAmount, sum(tt.uncheckedCount) uncheckedCount |
| | | from ( |
| | | select s.id, s.name supplierName, s.contact_tel supplierTel, st.name stationName |
| | | , (select sum(num) from t_order_item oi |
| | | where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) num |
| | | , (select sum(oi.supplier_price * oi.num) from t_order_item oi |
| | | , (select sum(oi.supplier_price * oi.num) from t_order_item oi |
| | | where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) amount |
| | | , (select count(1) from t_delivery_order dor |
| | | where dor.id = q.id and dor.status != 'CHECKED') uncheckedCount |
| | | from t_supplier_info s |
| | | join t_station st on st.id = s.station_id |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | |
| | | <if test="condition.orderNo != null and condition.orderNo != ''"> |
| | | AND q.order_no LIKE concat('%', #{condition.orderNo},'%') |
| | | </if> |
| | | <if test="condition.status != null and condition.status != ''"> |
| | | AND q.status = #{condition.status} |
| | | |
| | | <if test="condition.statusList != null and condition.statusList.size > 0"> |
| | | AND q.status in |
| | | <foreach collection="condition.statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="condition.supplierId != null"> |
| | |
| | | <if test="condition.orderNo != null and condition.orderNo != ''"> |
| | | AND q.order_no LIKE concat('%', #{condition.orderNo},'%') |
| | | </if> |
| | | <if test="condition.status != null and condition.status != ''"> |
| | | AND q.status = #{condition.status} |
| | | |
| | | <if test="condition.statusList != null and condition.statusList.size > 0"> |
| | | AND q.status in |
| | | <foreach collection="condition.statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="condition.warehouseId != null"> |
| | |
| | | </select> |
| | | |
| | | <select id="statisticStationList" resultType="com.mzl.flower.dto.response.flower.StationStatisticDTO"> |
| | | select tt.* |
| | | , (select count(distinct s.id) |
| | | from t_supplier_info s |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('CHECKED') |
| | | AND s.station_id = tt.stationId |
| | | ) checkedSupplierCount |
| | | , (select count(distinct s.id) |
| | | from t_supplier_info s |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('PENDING', 'ARRIVED') |
| | | AND s.station_id = tt.stationId |
| | | ) uncheckedSupplierCount |
| | | from ( |
| | | SELECT |
| | | s.station_id AS stationId, |
| | | st.`name`, |
| | |
| | | <if test="endDate != null"> |
| | | AND o.create_time <= #{endDate} |
| | | </if> |
| | | GROUP BY |
| | | s.station_id, |
| | | st.`name`; |
| | | |
| | | <if test="statusList != null and statusList.size > 0"> |
| | | AND o.status in |
| | | <foreach collection="statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY s.station_id, st.`name` |
| | | ) tt |
| | | </select> |
| | | |
| | | <update id="setDeliveryOrderPending"> |
| | |
| | | SELECT q.* |
| | | FROM t_delivery_order q |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('PENDING', 'ARRIVED', 'CHECKED') |
| | | AND q.status in ('PENDING', 'ARRIVED') |
| | | AND q.supplier_id = #{supplierId} |
| | | AND q.create_time > #{startDate} |
| | | AND q.create_time <= #{endDate} |
| | | <if test="startDate != null"> |
| | | AND q.create_time > #{startDate} |
| | | </if> |
| | | <if test="endDate != null"> |
| | | AND q.create_time <= #{endDate} |
| | | </if> |
| | | </select> |
| | | </mapper> |