|
@@ -5,16 +5,22 @@
|
|
|
<mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehouseAgreementMapper">
|
|
|
|
|
|
<resultMap type="TWarehouseAgreement" id="TWarehouseAgreementResult">
|
|
|
+ <result property="rankNo" column="rank_no"/>
|
|
|
<result property="fId" column="f_id"/>
|
|
|
<result property="fBillno" column="f_billno"/>
|
|
|
<result property="fContractno" column="f_contractno"/>
|
|
|
<result property="fDeptid" column="f_deptid"/>
|
|
|
+ <result property="fDeptName" column="f_deptname"/>
|
|
|
<result property="fCorpid" column="f_corpid"/>
|
|
|
+ <result property="fCorpName" column="f_corpname"/>
|
|
|
<result property="fGoodsid" column="f_goodsid"/>
|
|
|
+ <result property="fStltypeName" column="f_stltypename"/>
|
|
|
<result property="fStltypeid" column="f_stltypeid"/>
|
|
|
<result property="fFeetypeid" column="f_feetypeid"/>
|
|
|
+ <result property="fFeetypeName" column="f_feetypename"/>
|
|
|
<result property="tPackages" column="t_packages"/>
|
|
|
<result property="fTrademodeid" column="f_trademodeid"/>
|
|
|
+ <result property="fTrademodeName" column="f_trademodename"/>
|
|
|
<result property="fFreedays" column="f_freedays"/>
|
|
|
<result property="fBegindate" column="f_begindate"/>
|
|
|
<result property="fEnddate" column="f_enddate"/>
|
|
@@ -26,6 +32,7 @@
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="remark" column="remark"/>
|
|
|
+ <result property="fTaskTypeName" column="f_task_type_name"/>
|
|
|
<result property="fTaskType" column="f_task_type"/>
|
|
|
<result property="fDc" column="f_dc"/>
|
|
|
<result property="fBilltype" column="f_billtype"/>
|
|
@@ -65,28 +72,110 @@
|
|
|
|
|
|
<select id="selectTWarehouseAgreementList" parameterType="TWarehouseAgreement"
|
|
|
resultMap="TWarehouseAgreementResult">
|
|
|
- <include refid="selectTWarehouseAgreementVo"/>
|
|
|
+ select
|
|
|
+ @rank:=@rank + 1 as rank_no,
|
|
|
+ a.*
|
|
|
+ from
|
|
|
+ (
|
|
|
+ select
|
|
|
+ twg.f_id,
|
|
|
+ twg.f_billno,
|
|
|
+ twg.f_contractno,
|
|
|
+ twg.f_deptid,
|
|
|
+ dept.dept_name as f_deptname,
|
|
|
+ corp.f_name as f_corpname,
|
|
|
+ twg.f_goodsid,
|
|
|
+ dict.dict_label as f_stltypename,
|
|
|
+ twg.f_stltypeid,
|
|
|
+ twg.f_feetypeid,
|
|
|
+ CASE
|
|
|
+ WHEN twg.f_feetypeid='D' THEN '收'
|
|
|
+ WHEN twg.f_feetypeid='C' THEN '付'
|
|
|
+ END as f_feetypename,
|
|
|
+ twg.t_packages,
|
|
|
+ twg.f_trademodeid,
|
|
|
+ dttradmode.dict_label as f_trademodename,
|
|
|
+ twg.f_freedays,
|
|
|
+ twg.f_begindate,
|
|
|
+ twg.f_enddate,
|
|
|
+ CASE
|
|
|
+ WHEN twg.f_billstatus=1 THEN '保存'
|
|
|
+ WHEN twg.f_billstatus=2 THEN '暂存'
|
|
|
+ WHEN twg.f_billstatus=3 THEN '审批驳回'
|
|
|
+ WHEN twg.f_billstatus=4 THEN '提交审核'
|
|
|
+ WHEN twg.f_billstatus=5 THEN '审核中'
|
|
|
+ WHEN twg.f_billstatus=6 THEN '审核完成'
|
|
|
+ END as f_billstatus,
|
|
|
+ twg.f_status,
|
|
|
+ twg.del_flag,
|
|
|
+ twg.create_by,
|
|
|
+ twg.create_time,
|
|
|
+ twg.update_by,
|
|
|
+ twg.update_time,
|
|
|
+ twg.remark,
|
|
|
+ CASE
|
|
|
+ WHEN twg.f_task_type=1 THEN '车队作业费'
|
|
|
+ WHEN twg.f_task_type=2 THEN '劳务作业费'
|
|
|
+ END as f_task_type_name,
|
|
|
+ twg.f_task_type,
|
|
|
+ twg.f_dc,
|
|
|
+ twg.f_billtype,
|
|
|
+ twg.f_billtype_name,
|
|
|
+ twg.f_warehouseid
|
|
|
+ from t_warehouse_agreement twg
|
|
|
+ LEFT JOIN t_corps corp ON corp.f_id = twg.f_corpid
|
|
|
+ LEFT JOIN sys_dept dept ON dept.dept_id = twg.f_deptid
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ sys_dict_data dictIn
|
|
|
+ WHERE
|
|
|
+ dictIn.dict_label =
|
|
|
+ IF(
|
|
|
+ (
|
|
|
+ (dictIn.dict_type = 'data_stltype_type' AND dictIn.`status`='0' AND dictIn.dict_value=1) OR
|
|
|
+ (dictIn.dict_type = 'data_stltype_type' AND dictIn.`status`='0' AND dictIn.dict_value=0)
|
|
|
+ ),
|
|
|
+ dictIn.dict_label,NULL
|
|
|
+ )
|
|
|
+ ) dict ON dict.dict_value = twg.f_billtype
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ sys_dict_data dictIn
|
|
|
+ WHERE
|
|
|
+ dictIn.dict_label =
|
|
|
+ IF(
|
|
|
+ (dictIn.dict_type = 'data_trademodes' AND dictIn.`status`='0'),
|
|
|
+ dictIn.dict_label,NULL
|
|
|
+ )
|
|
|
+ ) dttradmode ON dttradmode.dict_value = twg.f_billtype
|
|
|
<where>
|
|
|
- <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
|
|
|
- <if test="fContractno != null and fContractno != ''">and f_contractno = #{fContractno}</if>
|
|
|
- <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
|
|
|
- <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
|
|
|
- <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
|
|
|
- <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
|
|
|
- <if test="fFeetypeid != null ">and f_feetypeid = #{fFeetypeid}</if>
|
|
|
- <if test="tPackages != null and tPackages != ''">and t_packages = #{tPackages}</if>
|
|
|
- <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
|
|
|
- <if test="fFreedays != null ">and f_freedays = #{fFreedays}</if>
|
|
|
- <if test="fBegindate != null ">and f_begindate = #{fBegindate}</if>
|
|
|
- <if test="fEnddate != null ">and f_enddate = #{fEnddate}</if>
|
|
|
- <if test="fTaskType != null ">and f_task_type = #{fTaskType}</if>
|
|
|
- <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
|
|
|
- <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
|
|
|
- <if test="fBilltype != null and fBilltype != ''">and f_billtype like concat('%', #{fBilltype}, '%')</if>
|
|
|
- <if test="fBilltypeName != null and fBilltypeName != ''">and f_billtype_name like concat('%',
|
|
|
+ <if test="fBillno != null and fBillno != ''">and twg.f_billno = #{fBillno}</if>
|
|
|
+ <if test="fContractno != null and fContractno != ''">and twg.f_contractno = #{fContractno}</if>
|
|
|
+ <if test="fDeptid != null ">and twg.f_deptid = #{fDeptid}</if>
|
|
|
+ <if test="fCorpid != null ">and twg.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fGoodsid != null ">and twg.f_goodsid = #{fGoodsid}</if>
|
|
|
+ <if test="fStltypeid != null ">and twg.f_stltypeid = #{fStltypeid}</if>
|
|
|
+ <if test="fFeetypeid != null ">and twg.f_feetypeid = #{fFeetypeid}</if>
|
|
|
+ <if test="tPackages != null and tPackages != ''">and twg.t_packages = #{tPackages}</if>
|
|
|
+ <if test="fTrademodeid != null ">and twg.f_trademodeid = #{fTrademodeid}</if>
|
|
|
+ <if test="fFreedays != null ">and twg.f_freedays = #{fFreedays}</if>
|
|
|
+ <if test="fBegindate != null ">and twg.f_begindate = #{fBegindate}</if>
|
|
|
+ <if test="fEnddate != null ">and twg.f_enddate = #{fEnddate}</if>
|
|
|
+ <if test="fTaskType != null ">and twg.f_task_type = #{fTaskType}</if>
|
|
|
+ <if test="fBillstatus != null and fBillstatus != ''">and twg.f_billstatus = #{fBillstatus}</if>
|
|
|
+ <if test="fStatus != null and fStatus != ''">and twg.f_status = #{fStatus}</if>
|
|
|
+ <if test="fBilltype != null and fBilltype != ''">and twg.f_billtype like concat('%', #{fBilltype}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="fBilltypeName != null and fBilltypeName != ''">and twg.f_billtype_name like concat('%',
|
|
|
#{fBilltypeName}, '%')
|
|
|
</if>
|
|
|
</where>
|
|
|
+ ) a,
|
|
|
+ (select @rank:=0) b
|
|
|
</select>
|
|
|
|
|
|
<select id="selectTWarehouseAgreementList1" parameterType="TWarehouseAgreement"
|
|
@@ -253,50 +342,75 @@
|
|
|
|
|
|
<select id="agreementRemind" parameterType="TWarehouseAgreement" resultType="Map">
|
|
|
select distinct
|
|
|
- agre.f_id AS fId,
|
|
|
- agre.f_feetypeid AS fFeetypeid,
|
|
|
- corp.f_name AS fCorpid,
|
|
|
- agre.f_contractno AS fContractno,
|
|
|
- agre.f_begindate AS fBegindate,
|
|
|
- agre.f_enddate AS fEnddate,
|
|
|
- agre.create_by AS createBy,
|
|
|
- agre.create_time AS createTime,
|
|
|
- agre.remark AS remark
|
|
|
+ agre.f_id AS fId,
|
|
|
+ agre.f_feetypeid AS fFeetypeid,
|
|
|
+ corp.f_name AS fCorpid,
|
|
|
+ agre.f_contractno AS fContractno,
|
|
|
+ agre.f_begindate AS fBegindate,
|
|
|
+ agre.f_enddate AS fEnddate,
|
|
|
+ agre.create_by AS createBy,
|
|
|
+ agre.create_time AS createTime,
|
|
|
+ agre.remark AS remark
|
|
|
from t_warehouse_agreement agre
|
|
|
left join t_corps corp on corp.f_id = agre.f_corpid
|
|
|
where
|
|
|
- agre.f_status = '0'
|
|
|
- and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) <= #{remindDays}
|
|
|
- <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
|
|
|
- <if test="fContractno != null and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
|
|
|
- <if test="fBegindate != null ">and agre.f_begindate = #{fBegindate}</if>
|
|
|
- <if test="fEnddate != null ">and agre.f_enddate = #{fEnddate}</if>
|
|
|
+ agre.f_status = '0'
|
|
|
+ and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) <= #{remindDays}
|
|
|
+ <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
|
|
|
+ <if test="fContractno != null and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
|
|
|
+ <if test="fBegindate != null ">and agre.f_begindate = #{fBegindate}</if>
|
|
|
+ <if test="fEnddate != null ">and agre.f_enddate = #{fEnddate}</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="biContractCount" resultType="map">
|
|
|
select count(f_id) as contractCount
|
|
|
from t_warehouse_agreement
|
|
|
where f_feetypeid = 0
|
|
|
- <if test="beginDate != null and beginDate != ''">and f_enddate >= #{beginDate}</if>
|
|
|
- <if test="endDate != null and endDate != ''">and f_enddate < #{endDate}</if>
|
|
|
- <if test="external != null and external != ''">
|
|
|
- and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
|
|
|
- </if>
|
|
|
- <if test="customerId != null">and f_corpid = #{customerId}</if>
|
|
|
+ <if test="beginDate != null and beginDate != ''">and f_enddate >= #{beginDate}</if>
|
|
|
+ <if test="endDate != null and endDate != ''">and f_enddate < #{endDate}</if>
|
|
|
+ <if test="external != null and external != ''">
|
|
|
+ and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null">and f_corpid = #{customerId}</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="biContractList" resultType="map">
|
|
|
select
|
|
|
- ifnull(tc.f_cname, tc.f_name) as customerName,
|
|
|
- ta.f_begindate as beginDate,
|
|
|
- ta.f_enddate as endDate
|
|
|
+ ifnull(tc.f_cname, tc.f_name) as customerName,
|
|
|
+ ta.f_begindate as beginDate,
|
|
|
+ ta.f_enddate as endDate
|
|
|
from t_warehouse_agreement ta left join t_corps tc on tc.f_id = ta.f_corpid
|
|
|
where ta.f_feetypeid = 0
|
|
|
- <if test="external != null and external != ''">
|
|
|
- and ta.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
|
|
|
- </if>
|
|
|
- <if test="customerId != null">and ta.f_corpid = #{customerId}</if>
|
|
|
+ <if test="external != null and external != ''">
|
|
|
+ and ta.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null">and ta.f_corpid = #{customerId}</if>
|
|
|
order by ta.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectTGoodsTypeByTypeId" resultType="com.ruoyi.basicData.domain.TGoods">
|
|
|
+ select
|
|
|
+ f_typeid as typeId,
|
|
|
+ f_name as fName
|
|
|
+ from
|
|
|
+ t_goods
|
|
|
+ WHERE
|
|
|
+ f_typeid in
|
|
|
+ <foreach collection="typeIds" item="typeId" open="(" separator="," close=")">
|
|
|
+ #{typeId}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTWarehouseByIds" resultType="com.ruoyi.common.core.domain.entity.TWarehouse">
|
|
|
+ select
|
|
|
+ f_id as fId,
|
|
|
+ f_name as fName
|
|
|
+ from
|
|
|
+ t_warehouse
|
|
|
+ WHERE
|
|
|
+ f_id in
|
|
|
+ <foreach collection="fIds" item="fId" open="(" separator="," close=")">
|
|
|
+ #{fId}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
</mapper>
|