|
|
@@ -92,7 +92,7 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Mon Oct 14 11:33:48 CST 2019.
|
|
|
-->
|
|
|
- id, order_no, corporate_name, amount, receivables_time, aid, remarks, status, create_time,
|
|
|
+ id, order_no, corporate_name, amount, receivables_time, aid, remarks, status, create_time,
|
|
|
financial_pay_no
|
|
|
</sql>
|
|
|
<select id="selectByExample" parameterType="com.goafanti.common.model.TemporaryReceivablesExample" resultMap="BaseResultMap">
|
|
|
@@ -120,7 +120,7 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Mon Oct 14 11:33:48 CST 2019.
|
|
|
-->
|
|
|
- select
|
|
|
+ select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from temporary_receivables
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
@@ -151,13 +151,13 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Mon Oct 14 11:33:48 CST 2019.
|
|
|
-->
|
|
|
- insert into temporary_receivables (id, order_no, corporate_name,
|
|
|
- amount, receivables_time, aid,
|
|
|
- remarks, status, create_time,
|
|
|
+ insert into temporary_receivables (id, order_no, corporate_name,
|
|
|
+ amount, receivables_time, aid,
|
|
|
+ remarks, status, create_time,
|
|
|
financial_pay_no)
|
|
|
- values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{corporateName,jdbcType=VARCHAR},
|
|
|
- #{amount,jdbcType=DECIMAL}, #{receivablesTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
|
|
|
- #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{corporateName,jdbcType=VARCHAR},
|
|
|
+ #{amount,jdbcType=DECIMAL}, #{receivablesTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
|
|
|
+ #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
#{financialPayNo,jdbcType=VARCHAR})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.goafanti.common.model.TemporaryReceivables">
|
|
|
@@ -363,25 +363,25 @@
|
|
|
financial_pay_no = #{financialPayNo,jdbcType=VARCHAR}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
-
|
|
|
+
|
|
|
<delete id="deleteByids" parameterType="java.util.List">
|
|
|
delete from temporary_receivables
|
|
|
- where id in
|
|
|
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
|
|
|
- #{item}
|
|
|
+ where id in
|
|
|
+ <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
|
|
|
+ #{item}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
<delete id="deleteByaid" parameterType="java.lang.String">
|
|
|
delete from temporary_receivables
|
|
|
- where aid = #{aid}
|
|
|
+ where aid = #{aid}
|
|
|
</delete>
|
|
|
<delete id="deleteNormalByaid">
|
|
|
delete from temporary_receivables
|
|
|
where aid = #{aid} and status < 2
|
|
|
</delete>
|
|
|
<select id="selectByaid" resultMap="BaseResultMap">
|
|
|
-
|
|
|
- select
|
|
|
+
|
|
|
+ select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from temporary_receivables
|
|
|
where aid = #{aid,jdbcType=INTEGER}
|
|
|
@@ -391,15 +391,15 @@
|
|
|
b.total_amount totalAmount,d.name depName,a.status ,b.settlement_amount settlementAmount,
|
|
|
a.financial_pay_no financialPayNo,a.amount,date_format(a.receivables_time, '%Y-%m-%d')receivablesTimes,
|
|
|
date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes,a.remarks,c.username
|
|
|
- from temporary_receivables a 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 department d on b.order_dep=d.id left join admin e on b.salesman_id=e.id
|
|
|
+ from temporary_receivables a 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 department d on b.order_dep=d.id left join admin e on b.salesman_id=e.id
|
|
|
where 1=1
|
|
|
<if test="aid != null">
|
|
|
and a.aid= #{aid}
|
|
|
</if>
|
|
|
<if test="contractNo != null">
|
|
|
b.contract_no like concat('%',#{contractNo},'%')
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no = #{orderNo}
|
|
|
</if>
|
|
|
@@ -412,11 +412,17 @@
|
|
|
<if test="corporateName != null">
|
|
|
and a.corporate_name like concat('%',#{corporateName},'%')
|
|
|
</if>
|
|
|
- <if test="orderDepId != null">
|
|
|
- and b.order_dep= #{orderDepId}
|
|
|
+ <if test="orderDeps != null">
|
|
|
+ and b.order_dep in
|
|
|
+ <foreach close=")" collection="orderDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
- <if test="adminDepId != null">
|
|
|
- and e.department_id= #{adminDepId}
|
|
|
+ <if test="adminDeps != null">
|
|
|
+ and e.department_id in
|
|
|
+ <foreach close=")" collection="adminDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
and a.status= #{status}
|
|
|
@@ -428,14 +434,14 @@
|
|
|
</select>
|
|
|
<select id="selectReceivablesCount" resultType="java.lang.Integer">
|
|
|
select count(*) from temporary_receivables a 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 department d on b.order_dep=d.id
|
|
|
- left join admin e on b.salesman_id=e.id
|
|
|
+ left join admin e on b.salesman_id=e.id
|
|
|
where 1=1
|
|
|
<if test="aid != null">
|
|
|
and a.aid= #{aid}
|
|
|
</if>
|
|
|
<if test="contractNo != null">
|
|
|
b.contract_no like concat('%',#{contractNo},'%')
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no = #{orderNo}
|
|
|
</if>
|
|
|
@@ -448,26 +454,32 @@
|
|
|
<if test="corporateName != null">
|
|
|
and a.corporate_name like concat('%',#{corporateName},'%')
|
|
|
</if>
|
|
|
- <if test="orderDepId != null">
|
|
|
- and b.order_dep= #{orderDepId}
|
|
|
- </if>
|
|
|
- <if test="adminDepId != null">
|
|
|
- and e.department_id= #{adminDepId}
|
|
|
- </if>
|
|
|
+ <if test="orderDeps != null">
|
|
|
+ and b.order_dep in
|
|
|
+ <foreach close=")" collection="orderDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="adminDeps != null">
|
|
|
+ and e.department_id in
|
|
|
+ <foreach close=")" collection="adminDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="status != null">
|
|
|
and a.status= #{status}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getCountlistReceivablesAmount" parameterType="Map" resultType="java.lang.String">
|
|
|
- select ifnull(sum(a.amount),0) amount from temporary_receivables a 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 department d on b.order_dep=d.id left join admin e on b.salesman_id=e.id
|
|
|
+ select ifnull(sum(a.amount),0) amount from temporary_receivables a 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 department d on b.order_dep=d.id left join admin e on b.salesman_id=e.id
|
|
|
where 1=1
|
|
|
<if test="aid != null">
|
|
|
and a.aid= #{aid}
|
|
|
</if>
|
|
|
<if test="contractNo != null">
|
|
|
and b.contract_no like concat('%',#{contractNo},'%')
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no = #{orderNo}
|
|
|
</if>
|
|
|
@@ -480,28 +492,34 @@
|
|
|
<if test="corporateName != null">
|
|
|
and a.corporate_name like concat('%',#{corporateName},'%')
|
|
|
</if>
|
|
|
- <if test="orderDepId != null">
|
|
|
- and b.order_dep= #{orderDepId}
|
|
|
- </if>
|
|
|
- <if test="adminDepId != null">
|
|
|
- and e.department_id= #{adminDepId}
|
|
|
- </if>
|
|
|
+ <if test="orderDeps != null">
|
|
|
+ and b.order_dep in
|
|
|
+ <foreach close=")" collection="orderDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="adminDeps != null">
|
|
|
+ and e.department_id in
|
|
|
+ <foreach close=")" collection="adminDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="status != null">
|
|
|
and a.status= #{status}
|
|
|
</if>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="getCountlistReceivablesTotalAmount" parameterType="Map" resultType="java.lang.String">
|
|
|
- select ifnull(sum(x.total_amount),0) from (select b.order_no,b.total_amount from temporary_receivables a
|
|
|
- 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 department d on b.order_dep=d.id
|
|
|
- left join admin e on b.salesman_id=e.id
|
|
|
+ select ifnull(sum(x.total_amount),0) from (select b.order_no,b.total_amount from temporary_receivables a
|
|
|
+ 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 department d on b.order_dep=d.id
|
|
|
+ left join admin e on b.salesman_id=e.id
|
|
|
where 1=1
|
|
|
<if test="aid != null">
|
|
|
and a.aid= #{aid}
|
|
|
</if>
|
|
|
<if test="contractNo != null">
|
|
|
and b.contract_no like concat('%',#{contractNo},'%')
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="orderNo != null">
|
|
|
and a.order_no = #{orderNo}
|
|
|
</if>
|
|
|
@@ -514,43 +532,49 @@
|
|
|
<if test="corporateName != null">
|
|
|
and a.corporate_name like concat('%',#{corporateName},'%')
|
|
|
</if>
|
|
|
- <if test="orderDepId != null">
|
|
|
- and b.order_dep= #{orderDepId}
|
|
|
- </if>
|
|
|
- <if test="adminDepId != null">
|
|
|
- and e.department_id= #{adminDepId}
|
|
|
- </if>
|
|
|
+ <if test="orderDeps != null">
|
|
|
+ and b.order_dep in
|
|
|
+ <foreach close=")" collection="orderDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="adminDeps != null">
|
|
|
+ and e.department_id in
|
|
|
+ <foreach close=")" collection="adminDeps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="status != null">
|
|
|
- and a.status= #{status}
|
|
|
+ and a.status= #{status}
|
|
|
</if>
|
|
|
group by b.order_no)x
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertBatch" parameterType="com.goafanti.common.model.TemporaryReceivables">
|
|
|
insert into temporary_receivables (id, order_no, corporate_name, amount, receivables_time,
|
|
|
aid, remarks, status, create_time, financial_pay_no) values
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
- (#{item.id,jdbcType=INTEGER}, #{item.orderNo,jdbcType=VARCHAR}, #{item.corporateName,jdbcType=VARCHAR},
|
|
|
- #{item.amount,jdbcType=DECIMAL}, #{item.receivablesTime,jdbcType=TIMESTAMP}, #{item.aid,jdbcType=VARCHAR},
|
|
|
- #{item.remarks,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
|
|
|
+ (#{item.id,jdbcType=INTEGER}, #{item.orderNo,jdbcType=VARCHAR}, #{item.corporateName,jdbcType=VARCHAR},
|
|
|
+ #{item.amount,jdbcType=DECIMAL}, #{item.receivablesTime,jdbcType=TIMESTAMP}, #{item.aid,jdbcType=VARCHAR},
|
|
|
+ #{item.remarks,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
|
|
|
#{item.financialPayNo,jdbcType=VARCHAR})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
-
|
|
|
+
|
|
|
<update id="updateRepeatOrderNo" >
|
|
|
- update temporary_receivables x ,(select a.order_no,a.amount,a.receivables_time,a.nickname
|
|
|
- from (select a.order_no,a.corporate_name,a.amount,a.receivables_time,b.nickname,count(1) counts
|
|
|
- from temporary_receivables a left join (select x1.order_no,y1.nickname from t_order_new x1
|
|
|
- left join user y1 on x1.buyer_id=y1.id )b on a.order_no=b.order_no where a.corporate_name=b.nickname
|
|
|
- group by a.order_no,a.corporate_name,a.amount,a.receivables_time)a where a.counts>1 )y set x.status=1
|
|
|
- where x.order_no=y.order_no and x.amount=y.amount and x.receivables_time=y.receivables_time
|
|
|
+ update temporary_receivables x ,(select a.order_no,a.amount,a.receivables_time,a.nickname
|
|
|
+ from (select a.order_no,a.corporate_name,a.amount,a.receivables_time,b.nickname,count(1) counts
|
|
|
+ from temporary_receivables a left join (select x1.order_no,y1.nickname from t_order_new x1
|
|
|
+ left join user y1 on x1.buyer_id=y1.id )b on a.order_no=b.order_no where a.corporate_name=b.nickname
|
|
|
+ group by a.order_no,a.corporate_name,a.amount,a.receivables_time)a where a.counts>1 )y set x.status=1
|
|
|
+ where x.order_no=y.order_no and x.amount=y.amount and x.receivables_time=y.receivables_time
|
|
|
and x.corporate_name=y.nickname and x.aid= #{aid}
|
|
|
</update>
|
|
|
<select id="selectReceivablesNumberRepeats" parameterType="com.goafanti.common.model.TemporaryReceivables" resultType="java.lang.Integer">
|
|
|
select count(*) from t_order_bill_new a left join user b on a.payer_id=b.id
|
|
|
- where a.order_no= #{orderNo}
|
|
|
+ where a.order_no= #{orderNo}
|
|
|
and b.nickname= #{corporateName}
|
|
|
- and a.transaction_amount= #{amount}
|
|
|
+ and a.transaction_amount= #{amount}
|
|
|
and a.financial_pay_time= #{receivablesTime}
|
|
|
</select>
|
|
|
-</mapper>
|
|
|
+</mapper>
|