|
|
@@ -361,24 +361,27 @@
|
|
|
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
|
|
|
- where b.grant_status = 1
|
|
|
+ where b.grant_type = 1
|
|
|
<if test="b.grantBy != null">
|
|
|
and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.targetName != null and b.targetName != """>
|
|
|
+ <if test='b.targetName != null and b.targetName != ""'>
|
|
|
<bind name="tn" value="'%' + b.targetName + '%'" />
|
|
|
and a.name like #{tn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.salesName != null and b.salesName != """>
|
|
|
+ <if test='b.salesName != null and b.salesName != ""'>
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and oa.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.departmentId != null and b.departmentId !=""">
|
|
|
+ <if test='b.departmentId != null and b.departmentId != ""'>
|
|
|
and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != """>
|
|
|
- <bind name="a" value="b.startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="b.endTime + ' 23:59:59'" />
|
|
|
+ <if test="b.grantStatus != null">
|
|
|
+ and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
+ </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'"/>
|
|
|
and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
order by b.grant_status ,b.create_time
|
|
|
@@ -393,24 +396,27 @@
|
|
|
left join t_order_task t on t.order_no = b.order_no and t.main=1
|
|
|
left join admin a on a.id = t.task_receiver
|
|
|
left join admin oa on oa.id = o.salesman_id
|
|
|
- where b.grant_status = 1
|
|
|
+ where b.grant_type = 1
|
|
|
<if test="b.grantBy != null">
|
|
|
and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.targetName != null and b.targetName != """>
|
|
|
+ <if test='b.targetName != null and b.targetName != ""'>
|
|
|
<bind name="tn" value="'%' + b.targetName + '%'" />
|
|
|
and a.name like #{tn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.salesName != null and b.salesName != """>
|
|
|
+ <if test='b.salesName != null and b.salesName != ""'>
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and oa.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.departmentId != null and b.departmentId !=""">
|
|
|
+ <if test='b.departmentId != null and b.departmentId != ""'>
|
|
|
and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != """>
|
|
|
- <bind name="a" value="b.startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="b.endTime + ' 23:59:59'" />
|
|
|
+ <if test="b.grantStatus != null">
|
|
|
+ and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
+ </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'"/>
|
|
|
and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</select>
|
|
|
@@ -420,27 +426,31 @@
|
|
|
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 grant_status, a.name as salesName
|
|
|
-
|
|
|
+ o.proof_count as proofCount, b.grant_status as grantStatus, a.name as salesName, o.proof_status as proofStatus,
|
|
|
+ ad.name as byName
|
|
|
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
|
|
|
left join `user` u on o.buyer_id = u.id
|
|
|
- where b.grant_status = 0
|
|
|
+ left join admin ad on b.grant_by = ad.id
|
|
|
+ where b.grant_type = 0
|
|
|
|
|
|
<if test="b.grantBy != null">
|
|
|
and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.salesName != null and b.salesName != """>
|
|
|
+ <if test='b.salesName != null and b.salesName != ""'>
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.departmentId != null and b.departmentId !=""">
|
|
|
+ <if test='b.departmentId != null and b.departmentId !=""'>
|
|
|
and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != """>
|
|
|
- <bind name="a" value="b.startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="b.endTime + ' 23:59:59'" />
|
|
|
+ <if test="b.grantStatus != null">
|
|
|
+ and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
+ </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'"/>
|
|
|
and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
order by b.grant_status , b.create_time
|
|
|
@@ -455,20 +465,23 @@
|
|
|
left join t_order_new o on o.order_no = b.order_no
|
|
|
left join admin a on o.salesman_id = a.id
|
|
|
left join `user` u on o.buyer_id = u.id
|
|
|
- where b.grant_status = 0
|
|
|
+ where b.grant_type = 0
|
|
|
<if test="b.grantBy != null">
|
|
|
and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.salesName != null and b.salesName != """>
|
|
|
+ <if test='b.salesName != null and b.salesName != ""'>
|
|
|
<bind name="sn" value="'%' + b.salesName + '%'" />
|
|
|
and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.departmentId != null and b.departmentId !=""">
|
|
|
+ <if test='b.departmentId != null and b.departmentId !=""'>
|
|
|
and a.department_id = #{b.departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="b.startTime != null and b.startTime != "" and b.endTime != null and b.endTime != """>
|
|
|
- <bind name="a" value="b.startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="b.endTime + ' 23:59:59'" />
|
|
|
+ <if test="b.grantStatus != null">
|
|
|
+ and b.grant_status = #{b.grantStatus,jdbcType=INTEGER}
|
|
|
+ </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'"/>
|
|
|
and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</select>
|
|
|
@@ -481,21 +494,24 @@
|
|
|
left join admin a on b.grant_target = a.id
|
|
|
left join `user` u on o.buyer_id = u.id
|
|
|
left join department d on d.id = a.department_id
|
|
|
- where b.grant_status = 0
|
|
|
+ where b.grant_type = #{grantType,jdbcType=INTEGER}
|
|
|
<if test="grantBy != null">
|
|
|
and b.grant_by = #{grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="salesName != null and salesName != """>
|
|
|
+ <if test='salesName != null and salesName != ""'>
|
|
|
<bind name="sn" value="'%' + salesName + '%'" />
|
|
|
and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="departmentId != null and departmentId !=""">
|
|
|
+ <if test='departmentId != null and departmentId != ""'>
|
|
|
and a.department_id = #{departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="startTime != null and startTime != "" and endTime != null and endTime != """>
|
|
|
- <bind name="a" value="startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="endTime + ' 23:59:59'" />
|
|
|
- and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ <if test="grantStatus != null">
|
|
|
+ and b.grant_status = #{grantStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test='startTime != null and startTime != "" and endTime != null and endTime != ""'>
|
|
|
+ <bind name="a" value="startTime +'-01'"/>
|
|
|
+ <bind name="e" value="endTime +'-31'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
</select>
|
|
|
<!-- 获得及技术员奖金数据 -->
|
|
|
@@ -511,26 +527,61 @@
|
|
|
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
|
|
|
- where b.grant_status = 0
|
|
|
+ where b.grant_type = 1
|
|
|
<if test="grantBy != null">
|
|
|
and b.grant_by = #{grantBy,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="targetName != null and targetName != """>
|
|
|
+ <if test='targetName != null and targetName != ""'>
|
|
|
<bind name="tn" value="'%' + targetName + '%'" />
|
|
|
and a.name like #{tn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="salesName != null and salesName != """>
|
|
|
+ <if test='salesName != null and salesName != ""'>
|
|
|
<bind name="sn" value="'%' + salesName + '%'" />
|
|
|
and oa.name like #{sn,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="departmentId != null and departmentId !=""">
|
|
|
+ <if test='departmentId != null and departmentId !=""'>
|
|
|
and a.department_id = #{departmentId,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
- <if test="startTime != null and startTime != "" and endTime != null and endTime != """>
|
|
|
- <bind name="a" value="b.startTime + ' 00:00:00'" />
|
|
|
- <bind name="e" value="b.endTime + ' 23:59:59'" />
|
|
|
- and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ <if test="grantStatus != null">
|
|
|
+ and b.grant_status = #{grantStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test='startTime != null and startTime != "" and endTime != null and endTime != ""'>
|
|
|
+ <bind name="a" value="startTime +'-01'"/>
|
|
|
+ <bind name="e" value="endTime +'-31'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
order by b.grant_status ,b.create_time
|
|
|
</select>
|
|
|
+ <!-- 查看营销员的奖金数据 -->
|
|
|
+ <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.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
|
|
|
+
|
|
|
+ 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
|
|
|
+ left join `user` u on o.buyer_id = u.id
|
|
|
+ where b.grant_type = 0
|
|
|
+ <if test="grantBy != null">
|
|
|
+ and b.grant_by = #{grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test='salesName != null and salesName != ""'>
|
|
|
+ <bind name="sn" value="'%' + salesName + '%'" />
|
|
|
+ and a.name like #{sn,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test='departmentId != null and departmentId !=""'>
|
|
|
+ and a.department_id = #{departmentId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="grantStatus != null">
|
|
|
+ and b.grant_status = #{grantStatus,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test='startTime != null and startTime != "" and endTime != null and endTime != ""'>
|
|
|
+ <bind name="a" value="startTime +'-01'"/>
|
|
|
+ <bind name="e" value="endTime +'-31'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|