@ -36,7 +36,13 @@
t_service_applications.activity_name_id,
t_service_applications.activity_name_id,
t_service_applications.attachment_ids,
t_service_applications.attachment_ids,
t_service_applications.report_time,
t_service_applications.report_time,
t_service_applications.position_id
t_service_applications.position_id,
t_service_applications.is_batch,
t_service_applications.declarer_id,
t_service_applications.declarer_name,
t_service_applications.parent_application_id,
t_service_applications.participant_names,
t_service_applications.draft_participant_ids
</sql>
</sql>
<!-- 分页查询 -->
<!-- 分页查询 -->
@ -123,8 +129,8 @@
<if test= "queryForm.positionId != null and queryForm.positionId != ''" >
<if test= "queryForm.positionId != null and queryForm.positionId != ''" >
and position_id = #{queryForm.positionId}
and position_id = #{queryForm.positionId}
</if>
</if>
<if test= "queryForm.filingNo != null and queryForm.filing No != ''" >
<if test= "queryForm.recordNo != null and queryForm.record No != ''" >
and filing_no like CONCAT('%', #{queryForm.filing No}, '%')
and record_no like CONCAT('%', #{queryForm.record No}, '%')
</if>
</if>
<!-- 协会角色过滤条件:只在没有明确指定任一审核状态时才应用此规则,且对自己创建的数据不过滤 -->
<!-- 协会角色过滤条件:只在没有明确指定任一审核状态时才应用此规则,且对自己创建的数据不过滤 -->
<if test= "queryForm.includeAssociationReviewed != null and queryForm.includeAssociationReviewed and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '') and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '')" >
<if test= "queryForm.includeAssociationReviewed != null and queryForm.includeAssociationReviewed and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '') and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '')" >
@ -170,28 +176,11 @@
</if>
</if>
<!-- 律所管理员过滤条件:查看部门内已审核数据以及自己创建的所有数据(不包括未提交的草稿) -->
<!-- 律所管理员过滤条件:查看部门内已审核数据以及自己创建的所有数据(不包括未提交的草稿) -->
<if test= "queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '') and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '')" >
<if test= "queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '') and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '')" >
AND (
AND t_service_applications.firm_audit_status IN (1, 3, 4)
(t_service_applications.firm_audit_status IS NOT NULL
AND (t_service_applications.firm_audit_status = 1 OR t_service_applications.firm_audit_status = 3 OR t_service_applications.firm_audit_status = 4)
AND t_service_applications.user_id IN
<foreach collection= "queryForm.employeeIdList" item= "item" separator= "," open= "(" close= ")" >
#{item}
</foreach> )
OR (t_service_applications.user_id = #{queryForm.currentUserId}
AND t_service_applications.firm_audit_status != 0) <!-- 查看自己创建的所有数据,明确排除未提交的草稿 -->
)
</if>
</if>
<!-- 当用户指定了律所审核状态时,查看部门内指定状态的数据以及自己创建的所有数据(不包括未提交的草稿) -->
<!-- 当用户指定了律所审核状态时,查看部门内指定状态的数据以及自己创建的所有数据(不包括未提交的草稿) -->
<if test= "queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus != null and queryForm.firmAuditStatus != '')" >
<if test= "queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus != null and queryForm.firmAuditStatus != '')" >
AND (
AND t_service_applications.firm_audit_status = #{queryForm.firmAuditStatus}
(firm_audit_status = #{queryForm.firmAuditStatus}
AND t_service_applications.user_id IN
<foreach collection= "queryForm.employeeIdList" item= "item" separator= "," open= "(" close= ")" >
#{item}
</foreach> )
OR (t_service_applications.user_id = #{queryForm.currentUserId}
AND t_service_applications.firm_audit_status != 0) <!-- 查看自己创建的所有数据,明确排除未提交的草稿 -->
)
</if>
</if>
</where>
</where>
ORDER BY
ORDER BY
@ -300,10 +289,10 @@
SELECT
SELECT
e.actual_name AS lawyerName,
e.actual_name AS lawyerName,
tsa.certificate_number AS certificateNumber,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(CASE WHEN tsa.service_start >= DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m-01') THEN tsa.service_duration ELSE 0 END), 0) AS quarterlyServiceDuration,
COALESCE(SUM(CASE WHEN tsa.service_end >= DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m-01') THEN tsa.service_duration ELSE 0 END), 0) AS quarterlyServiceDuration,
COALESCE(SUM(CASE WHEN tsa.service_start >= DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m-01') THEN tsa.workload_score ELSE 0 END), 0) AS quarterlyServiceCost,
COALESCE(SUM(CASE WHEN tsa.service_end >= DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m-01') THEN tsa.workload_score ELSE 0 END), 0) AS quarterlyServiceCost,
COALESCE(SUM(CASE WHEN YEAR(tsa.service_start ) = YEAR(NOW()) THEN tsa.service_duration ELSE 0 END), 0) AS annualServiceDuration,
COALESCE(SUM(CASE WHEN YEAR(tsa.service_end ) = YEAR(NOW()) THEN tsa.service_duration ELSE 0 END), 0) AS annualServiceDuration,
COALESCE(SUM(CASE WHEN YEAR(tsa.service_start ) = YEAR(NOW()) THEN tsa.workload_score ELSE 0 END), 0) AS annualServiceCost
COALESCE(SUM(CASE WHEN YEAR(tsa.service_end ) = YEAR(NOW()) THEN tsa.workload_score ELSE 0 END), 0) AS annualServiceCost
FROM t_service_applications tsa
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
@ -333,10 +322,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
AND tsa.user_id = #{queryForm.userId}
AND tsa.user_id = #{queryForm.userId}
@ -378,10 +367,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
AND tsa.user_id = #{queryForm.userId}
AND tsa.user_id = #{queryForm.userId}
@ -424,10 +413,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
AND tsa.user_id = #{queryForm.userId}
AND tsa.user_id = #{queryForm.userId}
@ -464,10 +453,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -493,10 +482,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -525,10 +514,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
AND tsa.user_id = #{queryForm.userId}
AND tsa.user_id = #{queryForm.userId}
@ -555,10 +544,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -583,10 +572,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id IS NOT NULL
AND tsa.firm_id IS NOT NULL
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -603,7 +592,9 @@
SELECT
SELECT
d.department_id AS firmId,
d.department_id AS firmId,
d.department_name AS firmName,
d.department_name AS firmName,
COUNT(DISTINCT e.employee_id) AS lawyerCount,
(SELECT COUNT(*) FROM t_employee e
WHERE e.department_id = d.department_id
AND e.deleted_flag = 0) AS lawyerCount,
COUNT(CASE WHEN tsa.association_audit_status != 0 THEN 1 END) AS reportCount,
COUNT(CASE WHEN tsa.association_audit_status != 0 THEN 1 END) AS reportCount,
COUNT(CASE WHEN tsa.association_audit_status = 3 THEN 1 END) AS approvedCount,
COUNT(CASE WHEN tsa.association_audit_status = 3 THEN 1 END) AS approvedCount,
COUNT(CASE WHEN tsa.association_audit_status = 4 THEN 1 END) AS rejectCount,
COUNT(CASE WHEN tsa.association_audit_status = 4 THEN 1 END) AS rejectCount,
@ -612,18 +603,17 @@
COALESCE(SUM(CASE WHEN tsa.association_audit_status = 3 THEN tsa.service_duration ELSE 0 END), 0) AS totalServiceDuration
COALESCE(SUM(CASE WHEN tsa.association_audit_status = 3 THEN tsa.service_duration ELSE 0 END), 0) AS totalServiceDuration
FROM
FROM
t_department d
t_department d
LEFT JOIN t_employee e ON e.department_id = d.department_id AND e.deleted_flag = 0
LEFT JOIN t_service_applications tsa ON tsa.firm_id = d.department_id
LEFT JOIN t_service_applications tsa ON tsa.user_id = e.employee_id
AND tsa.deleted_flag = 0
AND tsa.deleted_flag = 0
AND tsa.association_audit_status IN (1, 2, 3, 4)
AND tsa.association_audit_status IN (1, 2, 3, 4)
<if test= "queryForm.firmId != null" >
<if test= "queryForm.firmId != null" >
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
</if>
</if>
<if test= "queryForm.startTime != null" >
<if test= "queryForm.startTime != null" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null" >
<if test= "queryForm.endTime != null" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
WHERE
WHERE
1 = 1
1 = 1
@ -667,10 +657,10 @@
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
AND tsa.firm_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null" >
<if test= "queryForm.firmId != null" >
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
@ -688,10 +678,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -711,10 +701,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
AND tsa.firm_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -728,6 +718,7 @@
resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
SELECT
SELECT
tsa.application_id AS applicationId,
tsa.application_id AS applicationId,
tsa.parent_application_id AS parentApplicationId,
tsa.user_id AS userId,
tsa.user_id AS userId,
te.actual_name AS userName,
te.actual_name AS userName,
tsa.firm_id AS firmId,
tsa.firm_id AS firmId,
@ -750,10 +741,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.userId != null and queryForm.userId != ''" >
<if test= "queryForm.userId != null and queryForm.userId != ''" >
and tsa.user_id = #{queryForm.userId}
and tsa.user_id = #{queryForm.userId}
@ -773,10 +764,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
and d.department_id = #{queryForm.firmId}
and d.department_id = #{queryForm.firmId}
@ -802,10 +793,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
and d.department_id = #{queryForm.firmId}
and d.department_id = #{queryForm.firmId}
@ -870,6 +861,7 @@
FROM t_service_applications tsa
FROM t_service_applications tsa
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.firm_audit_status = 1
AND tsa.firm_audit_status = 1
AND tsa.firm_id = #{departmentId}
AND tsa.firm_id NOT IN (
AND tsa.firm_id NOT IN (
SELECT DISTINCT e.department_id
SELECT DISTINCT e.department_id
FROM t_employee e
FROM t_employee e
@ -893,6 +885,7 @@
FROM t_service_applications tsa
FROM t_service_applications tsa
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.firm_audit_status = 1
AND tsa.firm_audit_status = 1
AND tsa.firm_id = #{departmentId}
AND tsa.firm_id IN (
AND tsa.firm_id IN (
SELECT DISTINCT e.department_id
SELECT DISTINCT e.department_id
FROM t_employee e
FROM t_employee e
@ -967,8 +960,8 @@
LEFT JOIN t_goods tg ON tsa.activity_name_id = tg.goods_id
LEFT JOIN t_goods tg ON tsa.activity_name_id = tg.goods_id
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.firm_id = #{firmId}
AND tsa.firm_id = #{firmId}
AND tsa.report_time > = #{startTime}
AND tsa.service_end > = #{startTime}
AND tsa.report_time < = #{endTime}
AND tsa.service_end < = #{endTime}
</select>
</select>
<!-- 查询律师列表(分页) -->
<!-- 查询律师列表(分页) -->
@ -995,10 +988,10 @@
tsa.deleted_flag = 0
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
@ -1026,10 +1019,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.user_id = #{userId}
AND tsa.user_id = #{userId}
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
GROUP BY tsa.activity_name_id
GROUP BY tsa.activity_name_id
) stats ON g.goods_id = stats.activity_name_id
) stats ON g.goods_id = stats.activity_name_id
@ -1053,10 +1046,10 @@
#{uid}
#{uid}
</foreach>
</foreach>
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
</where>
</where>
GROUP BY tsa.user_id, tsa.activity_name_id, g.goods_name
GROUP BY tsa.user_id, tsa.activity_name_id, g.goods_name
@ -1077,10 +1070,10 @@
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
</if>
</if>
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
GROUP BY d.department_id, d.department_name
GROUP BY d.department_id, d.department_name
ORDER BY totalCount DESC
ORDER BY totalCount DESC
@ -1153,10 +1146,10 @@
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
AND tsa.firm_id = #{firmId}
AND tsa.firm_id = #{firmId}
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
GROUP BY tsa.activity_name_id
GROUP BY tsa.activity_name_id
) stats ON g.goods_id = stats.activity_name_id
) stats ON g.goods_id = stats.activity_name_id
@ -1187,20 +1180,20 @@
WHERE deleted_flag = 0
WHERE deleted_flag = 0
AND association_audit_status = 3
AND association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND report_time > = #{queryForm.startTime}
AND service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND report_time < = #{queryForm.endTime}
AND service_end < = #{queryForm.endTime}
</if>
</if>
GROUP BY user_id
GROUP BY user_id
) user_stats ON tsa.user_id = user_stats.user_id
) user_stats ON tsa.user_id = user_stats.user_id
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
@ -1229,20 +1222,20 @@
WHERE deleted_flag = 0
WHERE deleted_flag = 0
AND association_audit_status = 3
AND association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND report_time > = #{queryForm.startTime}
AND service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND report_time < = #{queryForm.endTime}
AND service_end < = #{queryForm.endTime}
</if>
</if>
GROUP BY firm_id
GROUP BY firm_id
) firm_stats ON tsa.firm_id = firm_stats.firm_id
) firm_stats ON tsa.firm_id = firm_stats.firm_id
WHERE tsa.deleted_flag = 0
WHERE tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
AND tsa.association_audit_status = 3
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
<if test= "queryForm.startTime != null and queryForm.startTime != ''" >
AND tsa.report_time > = #{queryForm.startTime}
AND tsa.service_end > = #{queryForm.startTime}
</if>
</if>
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
<if test= "queryForm.endTime != null and queryForm.endTime != ''" >
AND tsa.report_time < = #{queryForm.endTime}
AND tsa.service_end < = #{queryForm.endTime}
</if>
</if>
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
<if test= "queryForm.firmId != null and queryForm.firmId != ''" >
AND tsa.firm_id = #{queryForm.firmId}
AND tsa.firm_id = #{queryForm.firmId}
@ -1315,12 +1308,4 @@
ORDER BY tsa.create_time DESC
ORDER BY tsa.create_time DESC
</select>
</select>
<!-- 获取指定前缀的最大备案编号 -->
<select id= "getMaxFilingNo" resultType= "java.lang.String" >
SELECT filing_no
FROM t_service_applications
WHERE filing_no LIKE CONCAT(#{prefix}, '%')
ORDER BY filing_no DESC
LIMIT 1
</select>
</mapper>
</mapper>