| | |
| | | </where> |
| | | order by tep.pay_time desc |
| | | </select> |
| | | <select id="branchPerformanceReport" resultType="com.ruoyi.system.vo.BranchPerformanceReportVO"> |
| | | select tep.id, tep.procurement_code, tep.pay_money, tep.status,tep.pay_time,tep.clinic_id, tep.supplier_id, |
| | | tep.money,tep.supplier_money, |
| | | tcs.supplier_name as supplierName, tcc.clinic_name as clinicName,tcc.person_charge_name,tcc.phone, |
| | | tcb.branch_name as branchName |
| | | from t_erp_procurement tep |
| | | left join t_crm_supplier tcs on tep.supplier_id = tcs.id |
| | | left join t_crm_clinic tcc on tep.clinic_id = tcc.id |
| | | left join t_crm_branch tcb on tcc.branch_id = tcb.id |
| | | <where> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and tep.procurement_code like concat('%',#{query.procurementCode},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and tcs.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | <if test="query.clinicName != null and query.clinicName != ''"> |
| | | and tcc.clinic_name like concat('%',#{query.clinicName},'%') |
| | | </if> |
| | | <if test="query.status != null and query.status != ''"> |
| | | and tep.status = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND tep.pay_time >= #{query.startTime} |
| | | AND tep.pay_time <= #{query.endTime} |
| | | </if> |
| | | <if test="query.clinicIds != null and query.clinicIds.size()>0"> |
| | | and tep.clinic_id in |
| | | <foreach item="item" collection="query.clinicIds" separator="," open="(" close=")" index=""> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.personChargeName != null and query.personChargeName != ''"> |
| | | and tep.person_charge_name like concat('%',#{query.personChargeName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and tep.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | AND tep.status in (3,4,5) |
| | | AND tep.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by tep.pay_time desc |
| | | </select> |
| | | <select id="salespersonPerformanceReport" resultType="com.ruoyi.system.vo.SalespersonPerformanceReportVO"> |
| | | select tep.id, tep.procurement_code, tep.pay_money, tep.status,tep.pay_time,tep.clinic_id, tep.supplier_id, |
| | | tep.money,tep.supplier_money, |
| | | tcs.supplier_name as supplierName, tcc.clinic_name as clinicName,tcc.person_charge_name,tcc.phone, |
| | | tcb.branch_name as branchName,tcsa.salesperson_name as salespersonName |
| | | from t_erp_procurement tep |
| | | left join t_crm_supplier tcs on tep.supplier_id = tcs.id |
| | | left join t_crm_clinic tcc on tep.clinic_id = tcc.id |
| | | left join t_crm_branch tcb on tcc.branch_id = tcb.id |
| | | left join t_crm_salesperson tcsa on tcc.salesperson_id = tcsa.id |
| | | <where> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and tep.procurement_code like concat('%',#{query.procurementCode},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and tcs.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | <if test="query.clinicName != null and query.clinicName != ''"> |
| | | and tcc.clinic_name like concat('%',#{query.clinicName},'%') |
| | | </if> |
| | | <if test="query.status != null and query.status != ''"> |
| | | and tep.status = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND tep.pay_time >= #{query.startTime} |
| | | AND tep.pay_time <= #{query.endTime} |
| | | </if> |
| | | <if test="query.clinicIds != null and query.clinicIds.size()>0"> |
| | | and tep.clinic_id in |
| | | <foreach item="item" collection="query.clinicIds" separator="," open="(" close=")" index=""> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.personChargeName != null and query.personChargeName != ''"> |
| | | and tep.person_charge_name like concat('%',#{query.personChargeName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and tep.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | AND tep.status in (3,4,5) |
| | | AND tep.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by tep.pay_time desc |
| | | </select> |
| | | <select id="exportBranchPerformanceReport" resultType="com.ruoyi.system.vo.BranchPerformanceReportVO"> |
| | | select tep.id, tep.procurement_code, tep.pay_money, tep.status,tep.pay_time,tep.clinic_id, tep.supplier_id, |
| | | tep.money,tep.supplier_money, |
| | | tcs.supplier_name as supplierName, tcc.clinic_name as clinicName,tcc.person_charge_name,tcc.phone, |
| | | tcb.branch_name as branchName |
| | | from t_erp_procurement tep |
| | | left join t_crm_supplier tcs on tep.supplier_id = tcs.id |
| | | left join t_crm_clinic tcc on tep.clinic_id = tcc.id |
| | | left join t_crm_branch tcb on tcc.branch_id = tcb.id |
| | | <where> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and tep.procurement_code like concat('%',#{query.procurementCode},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and tcs.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | <if test="query.clinicName != null and query.clinicName != ''"> |
| | | and tcc.clinic_name like concat('%',#{query.clinicName},'%') |
| | | </if> |
| | | <if test="query.status != null and query.status != ''"> |
| | | and tep.status = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND tep.pay_time >= #{query.startTime} |
| | | AND tep.pay_time <= #{query.endTime} |
| | | </if> |
| | | <if test="query.clinicIds != null and query.clinicIds.size()>0"> |
| | | and tep.clinic_id in |
| | | <foreach item="item" collection="query.clinicIds" separator="," open="(" close=")" index=""> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.personChargeName != null and query.personChargeName != ''"> |
| | | and tep.person_charge_name like concat('%',#{query.personChargeName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and tep.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | AND tep.status in (3,4,5) |
| | | AND tep.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by tep.pay_time desc |
| | | </select> |
| | | <select id="exportSalespersonPerformanceReport" |
| | | resultType="com.ruoyi.system.vo.SalespersonPerformanceReportVO"> |
| | | select tep.id, tep.procurement_code, tep.pay_money, tep.status,tep.pay_time,tep.clinic_id, tep.supplier_id, |
| | | tep.money,tep.supplier_money, |
| | | tcs.supplier_name as supplierName, tcc.clinic_name as clinicName,tcc.person_charge_name,tcc.phone, |
| | | tcb.branch_name as branchName,tcsa.salesperson_name as salespersonName |
| | | from t_erp_procurement tep |
| | | left join t_crm_supplier tcs on tep.supplier_id = tcs.id |
| | | left join t_crm_clinic tcc on tep.clinic_id = tcc.id |
| | | left join t_crm_branch tcb on tcc.branch_id = tcb.id |
| | | left join t_crm_salesperson tcsa on tcc.salesperson_id = tcsa.id |
| | | <where> |
| | | <if test="query.procurementCode != null and query.procurementCode != ''"> |
| | | and tep.procurement_code like concat('%',#{query.procurementCode},'%') |
| | | </if> |
| | | <if test="query.supplierName != null and query.supplierName != ''"> |
| | | and tcs.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | <if test="query.clinicName != null and query.clinicName != ''"> |
| | | and tcc.clinic_name like concat('%',#{query.clinicName},'%') |
| | | </if> |
| | | <if test="query.status != null and query.status != ''"> |
| | | and tep.status = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND tep.pay_time >= #{query.startTime} |
| | | AND tep.pay_time <= #{query.endTime} |
| | | </if> |
| | | <if test="query.clinicIds != null and query.clinicIds.size()>0"> |
| | | and tep.clinic_id in |
| | | <foreach item="item" collection="query.clinicIds" separator="," open="(" close=")" index=""> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.personChargeName != null and query.personChargeName != ''"> |
| | | and tep.person_charge_name like concat('%',#{query.personChargeName},'%') |
| | | </if> |
| | | <if test="query.phone != null and query.phone != ''"> |
| | | and tep.phone like concat('%',#{query.phone},'%') |
| | | </if> |
| | | AND tep.status in (3,4,5) |
| | | AND tep.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by tep.pay_time desc |
| | | </select> |
| | | |
| | | </mapper> |