From 441eb455e1e8a9283cd569c132b14ba8da4c54a6 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 11 十月 2025 17:49:47 +0800
Subject: [PATCH] 导出,短信,模板消息

---
 ruoyi-system/src/main/resources/mapper/system/TCrmClinicMapper.xml |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 110 insertions(+), 9 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TCrmClinicMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TCrmClinicMapper.xml
index d106520..127ccde 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TCrmClinicMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TCrmClinicMapper.xml
@@ -17,6 +17,7 @@
         <result column="qualification_picture" property="qualificationPicture" />
         <result column="status" property="status" />
         <result column="audit_remark" property="auditRemark" />
+        <result column="performance_count" property="performanceCount" />
         <result column="create_time" property="createTime" />
         <result column="update_time" property="updateTime" />
         <result column="create_by" property="createBy" />
@@ -27,13 +28,13 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id, branch_id, salesperson_id, warehouse_id,user_id, clinic_name, person_charge_name, phone, low_procurement_money,
-          clinic_address, qualification_picture, status,audit_remark, create_time, update_time, create_by, update_by, disabled
+          clinic_address, qualification_picture, status,audit_remark,performance_count, create_time, update_time, create_by, update_by, disabled
     </sql>
     <select id="pageList" resultType="com.ruoyi.system.vo.TCrmClinicVO">
         SELECT
         tcc.id, tcc.branch_id, tcc.salesperson_id, tcc.warehouse_id,tcc.user_id, tcc.clinic_name, tcc.person_charge_name,
         tcc.phone, tcc.low_procurement_money, tcc.clinic_address, tcc.qualification_picture, tcc.status,tcc.audit_remark,
-        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,
+        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,tcc.performance_count,
         tcb.branch_name, tcs.salesperson_name, tcw.warehouse_name
         from t_crm_clinic tcc
         left join t_crm_branch tcb on tcc.branch_id = tcb.id
@@ -55,9 +56,22 @@
             <if test="query.salespersonId != null and query.salespersonId != ''">
                 and tcc.salesperson_id = #{query.salespersonId}
             </if>
-<!--            <if test="query.performanceStatus != null">-->
-<!--                and tcc.salesperson_id = #{query.performanceStatus}-->
-<!--            </if>-->
+            <if test="query.performanceStatus != null and query.performanceStatus == 1">
+                and tcc.low_procurement_money &lt; (SELECT IFNULL(SUM(pay_money),0) FROM
+                t_erp_procurement
+                WHERE clinic_id = tcc.id AND status in (3,4,5)
+                AND create_time LIKE concat(#{query.createTime},'%')
+                AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+                )
+            </if>
+            <if test="query.performanceStatus != null and query.performanceStatus == 2">
+                and tcc.low_procurement_money &gt;= (SELECT IFNULL(SUM(pay_money),0) FROM
+                t_erp_procurement
+                WHERE clinic_id = tcc.id AND status in (3,4,5)
+                AND create_time LIKE concat(#{query.createTime},'%')
+                AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+                )
+            </if>
             <if test="query.status != null">
                 and tcc.status = #{query.status}
             </if>
@@ -76,7 +90,7 @@
         SELECT
         tcc.id, tcc.branch_id, tcc.salesperson_id, tcc.warehouse_id,tcc.user_id, tcc.clinic_name, tcc.person_charge_name,
         tcc.phone, tcc.low_procurement_money, tcc.clinic_address, tcc.qualification_picture, tcc.status,tcc.audit_remark,
-        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,
+        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,tcc.performance_count,
         tcb.branch_name, tcs.salesperson_name, tcw.warehouse_name
         from t_crm_clinic tcc
         left join t_crm_branch tcb on tcc.branch_id = tcb.id
@@ -98,9 +112,6 @@
             <if test="query.salespersonId != null and query.salespersonId != ''">
                 and tcc.salesperson_id = #{query.salespersonId}
             </if>
-<!--            <if test="query.performanceStatus != null">-->
-<!--                and tcc.salesperson_id = #{query.performanceStatus}-->
-<!--            </if>-->
             <if test="query.status != null">
                 and tcc.status = #{query.status}
             </if>
@@ -109,5 +120,95 @@
         </where>
         ORDER BY tcc.create_time DESC
     </select>
+    <select id="exportAudit" resultType="com.ruoyi.system.export.TCrmClinicAuditExport">
+        SELECT
+        tcc.id, tcc.branch_id, tcc.salesperson_id, tcc.warehouse_id,tcc.user_id, tcc.clinic_name, tcc.person_charge_name,
+        tcc.phone, tcc.low_procurement_money, tcc.clinic_address, tcc.qualification_picture, tcc.status,tcc.audit_remark,
+        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,tcc.performance_count,
+        tcb.branch_name, tcs.salesperson_name, tcw.warehouse_name
+        from t_crm_clinic tcc
+        left join t_crm_branch tcb on tcc.branch_id = tcb.id
+        left join t_crm_salesperson tcs on tcc.salesperson_id = tcs.id
+        left join t_crm_warehouse tcw on tcc.warehouse_id = tcw.id
+        <where>
+            <if test="query.clinicName != null and query.clinicName != ''">
+                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
+            </if>
+            <if test="query.personChargeName != null and query.personChargeName != ''">
+                and tcc.person_charge_name like concat('%',#{query.personChargeName},'%')
+            </if>
+            <if test="query.phone != null and query.phone != ''">
+                and tcc.phone like concat('%',#{query.phone},'%')
+            </if>
+            <if test="query.branchId != null and query.branchId != ''">
+                and tcc.branch_id = #{query.branchId}
+            </if>
+            <if test="query.salespersonId != null and query.salespersonId != ''">
+                and tcc.salesperson_id = #{query.salespersonId}
+            </if>
+            <if test="query.status != null">
+                and tcc.status = #{query.status}
+            </if>
+            and tcc.status in (1,2)
+            AND tcc.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tcc.create_time DESC
+    </select>
+    <select id="exportList" resultType="com.ruoyi.system.export.TCrmClinicListExport">
+        SELECT
+        tcc.id, tcc.branch_id, tcc.salesperson_id, tcc.warehouse_id,tcc.user_id, tcc.clinic_name, tcc.person_charge_name,
+        tcc.phone, tcc.low_procurement_money, tcc.clinic_address, tcc.qualification_picture, tcc.status,tcc.audit_remark,
+        tcc.create_time, tcc.update_time, tcc.create_by, tcc.update_by, tcc.disabled,tcc.performance_count,
+        tcb.branch_name, tcs.salesperson_name, tcw.warehouse_name
+        from t_crm_clinic tcc
+        left join t_crm_branch tcb on tcc.branch_id = tcb.id
+        left join t_crm_salesperson tcs on tcc.salesperson_id = tcs.id
+        left join t_crm_warehouse tcw on tcc.warehouse_id = tcw.id
+        <where>
+            <if test="query.clinicName != null and query.clinicName != ''">
+                and tcc.clinic_name like concat('%',#{query.clinicName},'%')
+            </if>
+            <if test="query.personChargeName != null and query.personChargeName != ''">
+                and tcc.person_charge_name like concat('%',#{query.personChargeName},'%')
+            </if>
+            <if test="query.phone != null and query.phone != ''">
+                and tcc.phone like concat('%',#{query.phone},'%')
+            </if>
+            <if test="query.branchId != null and query.branchId != ''">
+                and tcc.branch_id = #{query.branchId}
+            </if>
+            <if test="query.salespersonId != null and query.salespersonId != ''">
+                and tcc.salesperson_id = #{query.salespersonId}
+            </if>
+            <if test="query.performanceStatus != null and query.performanceStatus == 1">
+                and tcc.low_procurement_money &lt; (SELECT IFNULL(SUM(pay_money),0) FROM
+                t_erp_procurement
+                WHERE clinic_id = tcc.id AND status in (3,4,5)
+                AND create_time LIKE concat(#{query.createTime},'%')
+                AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+                )
+            </if>
+            <if test="query.performanceStatus != null and query.performanceStatus == 2">
+                and tcc.low_procurement_money &gt;= (SELECT IFNULL(SUM(pay_money),0) FROM
+                t_erp_procurement
+                WHERE clinic_id = tcc.id AND status in (3,4,5)
+                AND create_time LIKE concat(#{query.createTime},'%')
+                AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+                )
+            </if>
+            <if test="query.status != null">
+                and tcc.status = #{query.status}
+            </if>
+            <if test="query.branchId != null and query.userId == 2">
+                and tcc.branch_id = #{query.branchId}
+            </if>
+            <if test="query.salespersonId != null and query.userId == 3">
+                and tcc.salesperson_id = #{query.salespersonId}
+            </if>
+            and tcc.status in (3,4)
+            AND tcc.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+        ORDER BY tcc.create_time DESC
+    </select>
 
 </mapper>

--
Gitblit v1.7.1