|
|
@@ -1370,7 +1370,7 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
</select>
|
|
|
|
|
|
<select id="selectDunOrderNewListByPage" resultType="com.goafanti.order.bo.outOrderDunListBo">
|
|
|
- select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,d.name as salesmanName,b.project_status projectStatus,
|
|
|
+ select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,b.project_status projectStatus,
|
|
|
b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,b.settlement_amount as settlementAmount,a.money as accountsReceivable,
|
|
|
if((b.total_amount-b.settlement_amount) < 1,0,(b.total_amount-b.settlement_amount)) as uncollectedAmount,b.order_status as orderStatus,
|
|
|
date_format(a.start_time, '%Y-%m-%d') as startDate,dep.name as depName,date_format(b.sign_time,'%Y-%m-%d') as signDate,
|
|
|
@@ -1383,19 +1383,25 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
from new_order_dun a left join t_order_task e on a.tid=e.id
|
|
|
</if>
|
|
|
left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
|
|
|
- left join admin d on b.salesman_id=d.id left join department dep on d.department_id=dep.id
|
|
|
+ left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
|
|
|
where b.delete_sign != 1
|
|
|
+ <if test="shiroType == 1 and fid !=null">
|
|
|
+ and tm.finance_id= #{fid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="shiroType == 2 and fid !=null">
|
|
|
+ and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
|
|
|
+ </if>
|
|
|
<if test="name != null">
|
|
|
and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="adminName != null">
|
|
|
- and d.name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
|
|
|
+ and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="depId != null">
|
|
|
- and dep.id= #{depId,jdbcType=VARCHAR}
|
|
|
+ and b.order_dep= #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="aid != null">
|
|
|
and b.salesman_id= #{aid,jdbcType=VARCHAR}
|
|
|
@@ -1403,7 +1409,7 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
<if test="starTime !=null and endTime !=null">
|
|
|
and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by b.sign_time desc
|
|
|
+ order by b.sign_time desc,b.create_time desc
|
|
|
<if test="page_sql!=null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -1418,20 +1424,26 @@ where super_id is null ) e on e.order_no=a.order_no
|
|
|
<if test="newStatus == 1 ">
|
|
|
from new_order_dun a left join t_order_task e on a.tid=e.id
|
|
|
</if>
|
|
|
- left join t_order_new b on a.order_no=b.order_no
|
|
|
- left join `user` c on b.buyer_id=c.id
|
|
|
- where b.delete_sign != 1
|
|
|
+ left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
|
|
|
+ left join t_order_mid tm on b.order_no=tm.order_no
|
|
|
+ where b.delete_sign != 1
|
|
|
+ <if test="shiroType == 1 and fid !=null">
|
|
|
+ and tm.finance_id= #{fid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="shiroType == 2 and fid !=null">
|
|
|
+ and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
|
|
|
+ </if>
|
|
|
<if test="name != null">
|
|
|
and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="adminName != null">
|
|
|
- and d.name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
|
|
|
+ and salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
|
|
|
</if>
|
|
|
<if test="depId != null">
|
|
|
- and dep.id= #{depId,jdbcType=VARCHAR}
|
|
|
+ and b.order_dep= #{depId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
<if test="aid != null">
|
|
|
and b.salesman_id= #{aid,jdbcType=VARCHAR}
|