|
|
@@ -1,113 +1,119 @@
|
|
|
<?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.sckw.payment.dao.KwpLedgerLogisticsMapper">
|
|
|
- <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerLogistics">
|
|
|
- <!--@mbg.generated-->
|
|
|
- <!--@Table kwp_ledger_logistics-->
|
|
|
- <id column="id" jdbcType="BIGINT" property="id" />
|
|
|
- <result column="ent_id" jdbcType="BIGINT" property="entId" />
|
|
|
- <result column="l_ledger_no" jdbcType="VARCHAR" property="lLedgerNo" />
|
|
|
- <result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
- <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
|
|
|
- <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
|
|
- <result column="tax_rate" jdbcType="INTEGER" property="taxRate" />
|
|
|
- <result column="trading" jdbcType="INTEGER" property="trading" />
|
|
|
- <result column="unload_amount" jdbcType="DECIMAL" property="unloadAmount" />
|
|
|
- <result column="load_amount" jdbcType="DECIMAL" property="loadAmount" />
|
|
|
- <result column="deficit_amount" jdbcType="DECIMAL" property="deficitAmount" />
|
|
|
- <result column="lose_amount" jdbcType="DECIMAL" property="loseAmount" />
|
|
|
- <result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
|
|
|
- <result column="settle_price" jdbcType="DECIMAL" property="settlePrice" />
|
|
|
- <result column="actual_price" jdbcType="DECIMAL" property="actualPrice" />
|
|
|
- <result column="audit_user" jdbcType="VARCHAR" property="auditUser" />
|
|
|
- <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone" />
|
|
|
- <result column="url" jdbcType="VARCHAR" property="url" />
|
|
|
- <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime" />
|
|
|
- <result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
|
- <result column="status" jdbcType="INTEGER" property="status" />
|
|
|
- <result column="create_by" jdbcType="BIGINT" property="createBy" />
|
|
|
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
- <result column="update_by" jdbcType="BIGINT" property="updateBy" />
|
|
|
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
|
- <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Base_Column_List">
|
|
|
- <!--@mbg.generated-->
|
|
|
- id, ent_id, l_ledger_no, `name`, start_time, end_time, tax_rate, trading, unload_amount,
|
|
|
- load_amount, deficit_amount, lose_amount, total_price, settle_price, actual_price,
|
|
|
- audit_user, audit_phone, url, generate_time, remark, `status`, create_by, create_time,
|
|
|
- update_by, update_time, del_flag
|
|
|
- </sql>
|
|
|
+ <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerLogistics">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table kwp_ledger_logistics-->
|
|
|
+ <id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
+ <result column="ent_id" jdbcType="BIGINT" property="entId"/>
|
|
|
+ <result column="l_ledger_no" jdbcType="VARCHAR" property="lLedgerNo"/>
|
|
|
+ <result column="name" jdbcType="VARCHAR" property="name"/>
|
|
|
+ <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
|
|
|
+ <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
|
|
|
+ <result column="tax_rate" jdbcType="INTEGER" property="taxRate"/>
|
|
|
+ <result column="trading" jdbcType="INTEGER" property="trading"/>
|
|
|
+ <result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
|
|
|
+ <result column="ex_tax_price" jdbcType="DECIMAL" property="exTaxPrice"/>
|
|
|
+ <result column="settle_price" jdbcType="DECIMAL" property="settlePrice"/>
|
|
|
+ <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
|
|
|
+ <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
|
|
|
+ <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
|
|
|
+ <result column="url" jdbcType="VARCHAR" property="url"/>
|
|
|
+ <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
|
|
|
+ <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
|
|
|
+ <result column="order_count" jdbcType="INTEGER" property="orderCount"/>
|
|
|
+ <result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
+ <result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
+ <result column="create_by" jdbcType="BIGINT" property="createBy"/>
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
+ <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
|
|
|
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
+ <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id,
|
|
|
+ ent_id,
|
|
|
+ l_ledger_no,
|
|
|
+ `name`,
|
|
|
+ start_time,
|
|
|
+ end_time,
|
|
|
+ tax_rate,
|
|
|
+ trading,
|
|
|
+ total_price,
|
|
|
+ ex_tax_price,
|
|
|
+ settle_price,
|
|
|
+ actual_price,
|
|
|
+ audit_user,
|
|
|
+ audit_phone,
|
|
|
+ url,
|
|
|
+ generate_time,
|
|
|
+ receipt_time,
|
|
|
+ order_count,
|
|
|
+ remark,
|
|
|
+ `status`,
|
|
|
+ create_by,
|
|
|
+ create_time,
|
|
|
+ update_by,
|
|
|
+ update_time,
|
|
|
+ del_flag
|
|
|
+ </sql>
|
|
|
|
|
|
<select id="pageSelect" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
|
|
|
select kll.id,
|
|
|
- kll.l_ledger_no lLedgerNo,
|
|
|
+ kll.l_ledger_no lLedgerNo,
|
|
|
kll.name,
|
|
|
- kll.start_time startTime,
|
|
|
- kll.end_time endTime,
|
|
|
- kll.tax_rate taxRate,
|
|
|
+ kll.start_time startTime,
|
|
|
+ kll.end_time endTime,
|
|
|
+ kll.tax_rate taxRate,
|
|
|
kll.trading,
|
|
|
- kll.unload_amount unloadAmount,
|
|
|
- kll.load_amount loadAmount,
|
|
|
- kll.deficit_amount deficitAmount,
|
|
|
- kll.lose_amount loseAmount,
|
|
|
- kll.total_price totalPrice,
|
|
|
- kll.settle_price settlePrice,
|
|
|
- kll.actual_price actualPrice,
|
|
|
+ kll.total_price totalPrice,
|
|
|
+ kll.ex_tax_price exTaxPrice,
|
|
|
+ kll.settle_price settlePrice,
|
|
|
+ kll.actual_price actualPrice,
|
|
|
kll.url,
|
|
|
- kll.generate_time generateTime,
|
|
|
+ kll.generate_time generateTime,
|
|
|
+ kll.receipt_time receiptTime,
|
|
|
kll.remark,
|
|
|
kll.status,
|
|
|
- count(kllo.id) orderCount
|
|
|
+ kllu.contacts,
|
|
|
+ kllu.phone,
|
|
|
+ kllu.firm_name firmName,
|
|
|
+ kll.order_count orderCount
|
|
|
from kwp_ledger_logistics kll
|
|
|
- inner join kwp_ledger_logistics_order kllo on kll.id = kllo.l_ledger_id
|
|
|
+ inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
|
|
|
<where>
|
|
|
- <choose>
|
|
|
- <when test="ids != null and ids.size() != 0">
|
|
|
- kll.id in
|
|
|
- <foreach close=")" collection="ids" item="id" open="" separator=",">
|
|
|
- #{id,jdbcType=BIGINT}
|
|
|
- </foreach>
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
-
|
|
|
- kll.del_flag = 0
|
|
|
- and kllo.del_flag = 0
|
|
|
-
|
|
|
- <if test="logisticsReq.status != null">
|
|
|
-
|
|
|
- and kll.status = #{logisticsReq.status}
|
|
|
- </if>
|
|
|
- <if test="logisticsReq.trading != null">
|
|
|
- and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
- </if>
|
|
|
- <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
|
|
|
- and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
|
|
|
- and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
|
|
|
- </if>
|
|
|
- <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
|
|
|
- and (
|
|
|
- kll.l_ledger_no like concat('%'
|
|
|
- , #{logisticsReq.keywords}
|
|
|
- , '%')
|
|
|
- or kll.check_user like concat('%'
|
|
|
- , #{logisticsReq.keywords}
|
|
|
- , '%')
|
|
|
- <if test="ids != null and ids.size() != 0">
|
|
|
- or kll.check_ent_id in
|
|
|
- <foreach close=")" collection="ids" item="item" open="(" separator=",">
|
|
|
- #{item,jdbcType=BIGINT}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- )
|
|
|
- </if>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
+ kll.del_flag = 0
|
|
|
+ and kllu.unit_type = 1
|
|
|
+ <if test="logisticsReq.status != null">
|
|
|
+ and kll.status = #{logisticsReq.status}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.trading != null">
|
|
|
+ and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
|
|
|
+ and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
|
|
|
+ and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
|
|
|
+ and (
|
|
|
+ kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
</where>
|
|
|
- group by kll.id, kll.check_ent_id, kll.carrier_ent_id, kll.l_ledger_no, kll.name, kll.start_time, kll.end_time,
|
|
|
- kll.tax_rate, kll.trading, kll.unload_amount, kll.load_amount, kll.deficit_amount, kll.lose_amount,
|
|
|
- kll.total_price, kll.settle_price, kll.actual_price, kll.check_phone, kll.check_user,
|
|
|
- kll.carrier_phone, kll.carrier_user, kll.url, kll.generate_time, kll.remark, kll.status
|
|
|
order by kll.generate_time desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="countOrder" resultType="java.util.Map">
|
|
|
+ SELECT count(1) "0",
|
|
|
+ count(IF(`status` = 1, 1, NULL)) "1",
|
|
|
+ count(IF(`status` = 2, 1, NULL)) "2",
|
|
|
+ count(IF(`status` = 3, 1, NULL)) "3",
|
|
|
+ count(IF(`status` = 4, 1, NULL)) "4",
|
|
|
+ count(IF(`status` = 5, 1, NULL)) "5"
|
|
|
+ FROM `kwp_ledger_logistics`
|
|
|
+ WHERE del_flag = 0;
|
|
|
+ </select>
|
|
|
</mapper>
|