|
|
@@ -92,7 +92,7 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Tue Nov 27 11:15:28 CST 2018.
|
|
|
-->
|
|
|
- id, create_time, order_no, bonus_subject, grant_status, grant_target, grant_by, grant_time,
|
|
|
+ id, create_time, order_no, bonus_subject, grant_status, grant_target, grant_by, grant_time,
|
|
|
grant_type, task_id
|
|
|
</sql>
|
|
|
<select id="selectByExample" parameterType="com.goafanti.common.model.TOrderBonusExample" resultMap="BaseResultMap">
|
|
|
@@ -120,7 +120,7 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Tue Nov 27 11:15:28 CST 2018.
|
|
|
-->
|
|
|
- select
|
|
|
+ select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from t_order_bonus
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
@@ -151,12 +151,12 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Tue Nov 27 11:15:28 CST 2018.
|
|
|
-->
|
|
|
- insert into t_order_bonus (id, create_time, order_no,
|
|
|
- bonus_subject, grant_status, grant_target,
|
|
|
+ insert into t_order_bonus (id, create_time, order_no,
|
|
|
+ bonus_subject, grant_status, grant_target,
|
|
|
grant_by, grant_time, grant_type, task_id
|
|
|
)
|
|
|
- values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{orderNo,jdbcType=VARCHAR},
|
|
|
- #{bonusSubject,jdbcType=INTEGER}, #{grantStatus,jdbcType=INTEGER}, #{grantTarget,jdbcType=VARCHAR},
|
|
|
+ values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{orderNo,jdbcType=VARCHAR},
|
|
|
+ #{bonusSubject,jdbcType=INTEGER}, #{grantStatus,jdbcType=INTEGER}, #{grantTarget,jdbcType=VARCHAR},
|
|
|
#{grantBy,jdbcType=VARCHAR}, #{grantTime,jdbcType=DATE}, #{grantType,jdbcType=INTEGER}, #{taskId,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
@@ -365,7 +365,7 @@
|
|
|
</update>
|
|
|
<!-- 财务专员统计技术员的奖金 -->
|
|
|
<select id="technicianBonusList" parameterType="Map" resultType="com.goafanti.order.bo.TOrderBonusBo">
|
|
|
- select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
|
|
|
+ select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
|
|
|
t.commodity_quantity as commodityQuantity, t.project_status as projectStatus, t.commodity_name as commodityName,
|
|
|
accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
|
|
|
o.liquidation_status as liquidationStatus, ga.name as byName,
|
|
|
@@ -374,9 +374,9 @@
|
|
|
from t_order_bonus b
|
|
|
left join t_order_task t on b.task_id = t.id
|
|
|
left join t_order_new o on o.order_no = t.order_no
|
|
|
- left join admin a on a.id = t.task_receiver
|
|
|
+ left join admin a on a.id = t.task_receiver
|
|
|
left join admin oa on oa.id = o.salesman_id
|
|
|
- left join admin ga on ga.id = b.grant_by
|
|
|
+ left join admin ga on ga.id = b.grant_by
|
|
|
where b.grant_type = 1
|
|
|
<if test="fids != null and fids.size > 0">
|
|
|
and b.grant_by in
|
|
|
@@ -411,7 +411,7 @@
|
|
|
<bind name="e1" value="b.endTime1 +' 23:59:59'"/>
|
|
|
and b.create_time between #{a1,jdbcType=VARCHAR} and #{e1,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- order by b.grant_status ,b.create_time
|
|
|
+ order by b.grant_status ,b.create_time
|
|
|
<if test="page_sql != null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -421,7 +421,7 @@
|
|
|
from t_order_bonus b
|
|
|
left join t_order_task t on b.task_id = t.id
|
|
|
left join t_order_new o on o.order_no = t.order_no
|
|
|
- left join admin a on a.id = t.task_receiver
|
|
|
+ left join admin a on a.id = t.task_receiver
|
|
|
left join admin oa on oa.id = o.salesman_id
|
|
|
where b.grant_type = 1
|
|
|
<if test="fids != null">
|
|
|
@@ -447,7 +447,7 @@
|
|
|
<if test='b.orderNo != null and b.orderNo !=""'>
|
|
|
and b.order_no = #{b.orderNo,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
-
|
|
|
+
|
|
|
<if test='b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != ""'>
|
|
|
<bind name="a" value="b.startTime +'-01'"/>
|
|
|
<bind name="e" value="b.endTime +'-31'"/>
|
|
|
@@ -462,7 +462,7 @@
|
|
|
<!-- 财务专员统计营销员奖金 -->
|
|
|
<select id="saleBonusList" parameterType="Map" resultType="com.goafanti.order.bo.TOrderBonusBo">
|
|
|
select b.id, o.order_no as orderNo, o.salesman_id as salesmanId, o.sign_time as signTime,
|
|
|
- o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
|
|
|
+ o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
|
|
|
o.first_amount as firstAmount, o.settlement_amount as settlementAmount, o.refund_amount as refundAmount,
|
|
|
o.order_status as orderStatus, o.project_status as projectStatus, b.bonus_subject as bonusSubject,
|
|
|
o.proof_count as proofCount, b.grant_status as grantStatus, a.name as salesName, o.proof_status as proofStatus,
|
|
|
@@ -486,8 +486,11 @@
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test='b.departmentId != null and b.departmentId !=""'>
|
|
|
- and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
+ <if test='deps !=null'>
|
|
|
+ and a.department_id in
|
|
|
+ <foreach close=")" collection="deps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
</if>
|
|
|
<if test="b.grantStatus != null">
|
|
|
and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
@@ -512,7 +515,7 @@
|
|
|
</select>
|
|
|
<select id="saleBonusCount" parameterType="Map" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
-
|
|
|
+
|
|
|
from t_order_bonus b
|
|
|
left join t_order_new o on o.order_no = b.order_no
|
|
|
left join admin a on o.salesman_id = a.id
|
|
|
@@ -525,9 +528,12 @@
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test='b.departmentId != null and b.departmentId !=""'>
|
|
|
- and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
- </if>
|
|
|
+ <if test='deps !=null'>
|
|
|
+ and a.department_id in
|
|
|
+ <foreach close=")" collection="deps" item="depId" open="(" separator=",">
|
|
|
+ #{depId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="b.grantStatus != null">
|
|
|
and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
@@ -581,7 +587,7 @@
|
|
|
</select>
|
|
|
<!-- 获得及技术员奖金数据 -->
|
|
|
<select id="getBonusData" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="com.goafanti.order.bo.TOrderBonusBo">
|
|
|
- select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
|
|
|
+ select b.id, t.id as tid, b.order_no as orderNo, t.task_receiver as taskReceiver, t.task_status as taskStatus,
|
|
|
t.commodity_quantity as commodityQuantity, t.project_status as projectStatus, t.commodity_name as commodityName,
|
|
|
accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
|
|
|
o.liquidation_status as liquidationStatus, ga.name as byName,
|
|
|
@@ -590,9 +596,9 @@
|
|
|
from t_order_bonus b
|
|
|
left join t_order_task t on b.task_id = t.id
|
|
|
left join t_order_new o on o.order_no = t.order_no
|
|
|
- left join admin a on a.id = t.task_receiver
|
|
|
+ left join admin a on a.id = t.task_receiver
|
|
|
left join admin oa on oa.id = o.salesman_id
|
|
|
- left join admin ga on ga.id = b.grant_by
|
|
|
+ left join admin ga on ga.id = b.grant_by
|
|
|
where b.grant_type = 1
|
|
|
<if test="grantBy != null">
|
|
|
and b.grant_by = #{grantBy,jdbcType=VARCHAR}
|
|
|
@@ -626,7 +632,7 @@
|
|
|
<!-- 查看营销员的奖金数据 -->
|
|
|
<select id="getSaleBounsList" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="com.goafanti.order.bo.TOrderBonusBo">
|
|
|
select b.id, o.order_no as orderNo, o.salesman_id as salesmanId, o.sign_time as signTime,
|
|
|
- o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
|
|
|
+ o.buyer_id as buyerId, u.nickname as buyName, o.total_amount as totalAmount,
|
|
|
o.first_amount as firstAmount, o.settlement_amount as settlementAmount, o.refund_amount as refundAmount,
|
|
|
o.order_status as orderStatus, o.project_status as projectStatus, b.bonus_subject as bonusSubject,
|
|
|
o.proof_count as proofCount, b.grant_status as grantStatus, a.name as salesName
|
|
|
@@ -662,7 +668,7 @@
|
|
|
</select>
|
|
|
<!-- 根据订单编号和科目和奖金发放人检查这个奖金是否存在 -->
|
|
|
<select id="checkByOnoAndSub" parameterType="com.goafanti.common.model.TOrderBonus" resultType="java.lang.Integer">
|
|
|
- select count(*) from t_order_bonus where order_no = #{orderNo,jdbcType=VARCHAR} and bonus_subject = #{bonusSubject,jdbcType=INTEGER}
|
|
|
+ select count(*) from t_order_bonus where order_no = #{orderNo,jdbcType=VARCHAR} and bonus_subject = #{bonusSubject,jdbcType=INTEGER}
|
|
|
and grant_target = #{grantTarget,jdbcType=VARCHAR} and grant_type = #{grantType,jdbcType=INTEGER}
|
|
|
<if test="taskId != null">
|
|
|
and task_id = #{taskId,jdbcType=INTEGER}
|
|
|
@@ -672,8 +678,8 @@
|
|
|
<select id="checkNoPay" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="java.lang.Integer">
|
|
|
select bonus_subject from t_order_bonus
|
|
|
where id = #{id,jdbcType=VARCHAR} and bonus_subject > (
|
|
|
- select min(bonus_subject) from t_order_bonus
|
|
|
+ select min(bonus_subject) from t_order_bonus
|
|
|
where order_no = #{orderNo,jdbcType=VARCHAR} and grant_status = 0 and grant_type = 0)
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
</mapper>
|