|
|
@@ -330,4 +330,190 @@
|
|
|
grant_time = #{grantTime,jdbcType=DATE}
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</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,
|
|
|
+ t.commodity_quantity as commodityQuantity, t.project_status as projectStatus,
|
|
|
+ accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
|
|
|
+ o.liquidation_status as liquidationStatus, ga.name as byName,
|
|
|
+ bonus_subject as bonusSubject, grant_status as grantStatus, a.name as targetName
|
|
|
+ from t_order_bonus b
|
|
|
+ left join t_order_new o on o.order_no = b.order_no
|
|
|
+ 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
|
|
|
+ left join admin ga on ga.id = b.grant_by
|
|
|
+ where b.bonus_subject >= 20
|
|
|
+ <if test="b.grantBy != null">
|
|
|
+ and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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 != ""'>
|
|
|
+ <bind name="sn" value="'%' + b.salesName + '%'"/>
|
|
|
+ and oa.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='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'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ order by b.grant_status ,b.create_time
|
|
|
+ <if test="page_sql != null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="technicianBonusCount" 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 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.bonus_subject >= 20
|
|
|
+ <if test="b.grantBy != null">
|
|
|
+ and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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 != ""'>
|
|
|
+ <bind name="sn" value="'%' + b.salesName + '%'"/>
|
|
|
+ and oa.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='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'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 财务专员统计营销员奖金 -->
|
|
|
+ <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.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
|
|
|
+
|
|
|
+ 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.bonus_subject <20
|
|
|
+
|
|
|
+ <if test="b.grantBy != null">
|
|
|
+ and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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 !=""'>
|
|
|
+ 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'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ order by b.grant_status , b.create_time
|
|
|
+ <if test="page_sql != null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </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
|
|
|
+ left join `user` u on o.buyer_id = u.id
|
|
|
+ where b.bonus_subject <20
|
|
|
+ <if test="b.grantBy != null">
|
|
|
+ and b.grant_by = #{b.grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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 !=""'>
|
|
|
+ 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'"/>
|
|
|
+ and o.sign_time between #{a,jdbcType=VARCHAR} and #{e,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 获得技术员有奖金数据的部门 -->
|
|
|
+ <select id="getDeptBySome" parameterType="com.goafanti.order.bo.TOrderBonusBo" resultType="com.goafanti.order.bo.TOrderBonusBo">
|
|
|
+ select distinct
|
|
|
+ d.id as departmentId, d.name as departmentName
|
|
|
+ from t_order_bonus b
|
|
|
+ left join t_order_new o on o.order_no = b.order_no
|
|
|
+ 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.bonus_subject <20
|
|
|
+ <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='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>
|
|
|
+ </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,
|
|
|
+ t.commodity_quantity as commodityQuantity, t.project_status as projectStatus,
|
|
|
+ accept_time as acceptTime, review_time as reviewTime, licence_time as licenceTime,
|
|
|
+ o.liquidation_status as liquidationStatus, ga.name as byName,
|
|
|
+ bonus_subject as bonusSubject, grant_status as grantStatus, a.name as targetName
|
|
|
+ from t_order_bonus b
|
|
|
+ left join t_order_new o on o.order_no = b.order_no
|
|
|
+ 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
|
|
|
+ left join admin ga on ga.id = b.grant_by
|
|
|
+ where b.bonus_subject >= 20
|
|
|
+ <if test="grantBy != null">
|
|
|
+ and b.grant_by = #{grantBy,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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 != ""'>
|
|
|
+ <bind name="sn" value="'%' + salesName + '%'"/>
|
|
|
+ and oa.name like #{sn,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <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>
|
|
|
+ order by b.grant_status ,b.create_time
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|