律所系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

573 lines
28 KiB

4 months ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.lab1024.sa.admin.module.service.dao.ServiceApplicationsDao">
<!-- 查询结果列 -->
<sql id="base_columns">
t_service_applications.application_id,
t_service_applications.user_id,
t_service_applications.firm_id,
t_service_applications.service_start,
t_service_applications.service_end,
t_service_applications.service_duration,
t_service_applications.beneficiary_count,
t_service_applications.organizer_name,
t_service_applications.organizer_contact,
t_service_applications.organizer_phone,
t_service_applications.service_content,
t_service_applications.workload_score,
t_service_applications.firm_audit_status,
t_service_applications.firm_audit_opinion,
t_service_applications.firm_audit_user,
t_service_applications.firm_audit_time,
t_service_applications.association_audit_status,
t_service_applications.association_audit_opinion,
t_service_applications.association_audit_user,
t_service_applications.association_audit_time,
t_service_applications.record_no,
t_service_applications.record_status,
t_service_applications.record_time,
t_service_applications.update_time,
t_service_applications.create_time,
t_service_applications.deleted_flag,
t_service_applications.certificate_number,
t_service_applications.activity_category_id,
t_service_applications.activity_name_id,
t_service_applications.attachment_ids,
3 months ago
t_service_applications.report_time,
t_service_applications.position_id
4 months ago
</sql>
<!-- 分页查询 -->
<select id="queryPage" resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
SELECT
<include refid="base_columns"/>
FROM t_service_applications
<where>
deleted_flag = 0
<if test="queryForm.applicationId != null and queryForm.applicationId != ''">
and application_id = #{queryForm.applicationId}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and firm_id = #{queryForm.firmId}
</if>
<if test="queryForm.serviceStart != null and queryForm.serviceStart != ''">
and service_start &gt;= #{queryForm.serviceStart}
</if>
<if test="queryForm.serviceEnd != null and queryForm.serviceEnd != ''">
and service_end &lt;= #{queryForm.serviceEnd}
</if>
<if test="queryForm.serviceDuration != null and queryForm.serviceDuration != ''">
and service_duration = #{queryForm.serviceDuration}
</if>
<if test="queryForm.beneficiaryCount != null and queryForm.beneficiaryCount != ''">
and beneficiary_count = #{queryForm.beneficiaryCount}
</if>
<if test="queryForm.organizerName != null and queryForm.organizerName != ''">
and organizer_name like CONCAT('%', #{queryForm.organizerName}, '%')
4 months ago
</if>
<if test="queryForm.organizerContact != null and queryForm.organizerContact != ''">
and organizer_contact like CONCAT('%', #{queryForm.organizerContact}, '%')
4 months ago
</if>
3 months ago
<if test="queryForm.certificateNumber != null and queryForm.certificateNumber != ''">
and certificate_number = #{queryForm.certificateNumber}
</if>
<if test="queryForm.activityCategoryId != null and queryForm.activityCategoryId != ''">
and activity_category_id = #{queryForm.activityCategoryId}
</if>
3 months ago
<if test="queryForm.associationAuditStatus != null and queryForm.associationAuditStatus != ''">
and association_audit_status = #{queryForm.associationAuditStatus}
</if>
<if test="queryForm.firmAuditStatus != null and queryForm.firmAuditStatus != ''">
and firm_audit_status = #{queryForm.firmAuditStatus}
</if>
3 months ago
<if test="queryForm.activityNameId != null and queryForm.activityNameId != ''">
and activity_name_id = #{queryForm.activityNameId}
</if>
<if test="queryForm.employeeIdList != null and !queryForm.employeeIdList.isEmpty() ">
and user_id in
<foreach collection="queryForm.employeeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
3 months ago
<if test="queryForm.positionId != null and queryForm.positionId != ''">
and position_id = #{queryForm.positionId}
</if>
<!-- 协会角色过滤条件:只在没有明确指定任一审核状态时才应用此规则,且对自己创建的数据不过滤 -->
<if test="queryForm.includeAssociationReviewed != null and queryForm.includeAssociationReviewed and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '') and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '')">
AND (
(t_service_applications.association_audit_status IS NOT NULL
AND t_service_applications.association_audit_status &gt;= 1)
2 months ago
OR (t_service_applications.association_audit_status >= 1 and t_service_applications.user_id = #{queryForm.currentUserId}) <!-- 对自己创建的数据不过滤 -->
3 months ago
)
</if>
3 months ago
<!-- 当用户指定了协会审核状态时,仍然允许查看自己创建的数据 -->
<if test="queryForm.includeAssociationReviewed != null and queryForm.includeAssociationReviewed and (queryForm.associationAuditStatus != null and queryForm.associationAuditStatus != '')">
AND (
(association_audit_status = #{queryForm.associationAuditStatus})
OR t_service_applications.user_id = #{queryForm.currentUserId} <!-- 对自己创建的数据不过滤 -->
)
</if>
3 months ago
<!-- 普通律所用户不过滤审核状态,当noStatusFilter为true时,不应用firm审核状态过滤 -->
<if test="queryForm.noStatusFilter != null and queryForm.noStatusFilter">
<!-- 普通律所用户:不过滤firm_audit_status,可以看到所有状态的数据 -->
</if>
2 months ago
<!-- 律所管理员过滤条件:查看部门内已审核数据以及自己创建的所有数据(包括未提交的草稿) -->
3 months ago
<if test="queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus == null or queryForm.firmAuditStatus == '') and (queryForm.associationAuditStatus == null or queryForm.associationAuditStatus == '')">
AND (
(t_service_applications.firm_audit_status IS NOT NULL
2 months ago
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}) <!-- 查看自己创建的所有数据,包括未提交的草稿 -->
3 months ago
)
</if>
2 months ago
<!-- 当用户指定了律所审核状态时,查看部门内指定状态的数据以及自己创建的所有数据 -->
3 months ago
<if test="queryForm.includeFirmReviewed != null and queryForm.includeFirmReviewed and (queryForm.firmAuditStatus != null and queryForm.firmAuditStatus != '')">
AND (
2 months ago
(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}) <!-- 查看自己创建的所有数据 -->
3 months ago
)
</if>
4 months ago
</where>
ORDER BY t_service_applications.association_audit_status Asc,
t_service_applications.firm_audit_status Asc
4 months ago
</select>
<update id="batchUpdateDeleted">
update t_service_applications set deleted_flag = #{deletedFlag}
where application_id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<update id="updateDeleted">
update t_service_applications set deleted_flag = #{deletedFlag}
where application_id = #{applicationId}
</update>
3 months ago
4 months ago
<update id="batchSubmit">
3 months ago
update t_service_applications set firm_audit_status = #{deletedFlag}, report_time = NOW()
where application_id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<update id="batchSubmitAsFirm">
3 months ago
update t_service_applications set
association_audit_status = #{firmAuditStatus},
3 months ago
firm_audit_user = #{userId},
firm_audit_time = #{submitTime},
report_time = NOW()
4 months ago
where application_id in
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
3 months ago
<update id="batchSubmitAsAssociation">
update t_service_applications set
association_audit_status = #{associationAuditStatus},
association_audit_time = now()
where association_audit_status = 0 and application_id in
3 months ago
<foreach collection="idList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<update id="batchReview">
update t_service_applications set firm_audit_status = #{value}
where application_id in
<foreach collection="fileKeyList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<!-- 律所审核 -->
<update id="batchReviewAsFirm">
update t_service_applications set
firm_audit_status = #{value},
firm_audit_user = #{userId},
firm_audit_time = #{reviewTime}
where application_id in
<foreach collection="fileKeyList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
<!-- 协会审核 -->
<update id="batchReviewAsAssociation">
update t_service_applications set
association_audit_status = #{value},
association_audit_user = #{userId},
association_audit_time = #{reviewTime}
where application_id in
<foreach collection="fileKeyList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</update>
3 months ago
<update id="batchReviewByDepartmentId">
update t_service_applications set
association_audit_status = #{queryForm.associationAuditStatus},
association_audit_user = #{queryForm.associationAuditUser},
association_audit_time = #{queryForm.associationAuditTime}
where association_audit_status = 1 and firm_id = #{queryForm.firmId}
</update>
3 months ago
<!-- 律师统计查询(无参数,保持向后兼容) -->
<select id="getLawyerStatistics" resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
e.actual_name AS lawyerName,
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_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 YEAR(tsa.service_start) = 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
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
WHERE tsa.deleted_flag = 0
3 months ago
AND tsa.firm_audit_status = 3 <!-- PASS -->
GROUP BY tsa.user_id, tsa.certificate_number, e.actual_name
ORDER BY e.actual_name
</select>
<!-- 律师统计查询(带参数) -->
<select id="getLawyerStatisticsWithParam" resultType="net.lab1024.sa.admin.module.service.domain.form.ServiceLawyerImportForm">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
3 months ago
AND tsa.firm_audit_status = 3 <!-- PASS -->
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.firm_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.firm_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and user_id = #{queryForm.userId}
</if>
<if test="queryForm.lawyerName != null and queryForm.lawyerName != ''">
AND e.actual_name LIKE CONCAT('%', #{queryForm.lawyerName}, '%')
</if>
<if test="queryForm.firmName != null and queryForm.firmName != ''">
AND d.department_name LIKE CONCAT('%', #{queryForm.firmName}, '%')
</if>
3 months ago
<if test="queryForm.firmId != null and queryForm.firmId != ''">
AND tsa.firm_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id
ORDER BY e.actual_name
</select>
<select id="getLawyerStatisticsWithParamYear"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
3 months ago
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.firm_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.firm_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.lawyerName != null and queryForm.lawyerName != ''">
AND e.actual_name LIKE CONCAT('%', #{queryForm.lawyerName}, '%')
</if>
<if test="queryForm.firmName != null and queryForm.firmName != ''">
AND d.department_name LIKE CONCAT('%', #{queryForm.firmName}, '%')
</if>
3 months ago
<if test="queryForm.firmId != null and queryForm.firmId != ''">
AND d.department_id = #{queryForm.firmId}
</if>
</where>
GROUP BY tsa.user_id
</select>
<select id="getLawyerStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
e.actual_name AS lawyerName,
e.employee_id as userId,
tsa.certificate_number AS certificateNumber,
COALESCE(SUM(tsa.service_duration), 0) AS quarterlyServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_employee e ON tsa.user_id = e.employee_id
<where>
tsa.deleted_flag = 0
3 months ago
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.firm_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.firm_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
</where>
</select>
3 months ago
<select id="getdepartmentStatistics"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
d.department_name AS firmName,
d.department_id as firmId,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
3 months ago
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
3 months ago
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
</select>
<select id="getdepartmentMothStatistic"
resultType="net.lab1024.sa.admin.module.service.domain.vo.LawyerStatisticsVO">
SELECT
d.department_name AS firmName,
d.department_id as firmId,
COALESCE(SUM(tsa.service_duration), 0) AS quarterlyServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
3 months ago
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
3 months ago
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
</select>
<select id="getDepartmentStatisticsWithParam"
resultType="net.lab1024.sa.admin.module.service.domain.form.ServiceDepartmentImportForm">
SELECT
d.department_name AS firmName,
d.department_id as firmId,
COALESCE(SUM(tsa.service_duration), 0) AS annualServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
3 months ago
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
3 months ago
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
3 months ago
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
3 months ago
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
group by d.department_id
3 months ago
</select>
3 months ago
<!-- 服务上报统计 -->
<select id="getServiceReportStatistics" resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceReportStatisticsVO">
SELECT
3 months ago
d.department_id AS firmId,
d.department_name AS firmName,
COUNT(DISTINCT e.employee_id) AS lawyerCount,
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 = 4 THEN 1 END) AS rejectCount,
COUNT(CASE WHEN tsa.association_audit_status !=0 THEN 1 END) - COUNT(CASE WHEN tsa.association_audit_status in (3,4) THEN 1 END )
AS pendingCount,
COALESCE(SUM(tsa.service_duration), 0) AS totalServiceDuration
FROM
t_department d
LEFT JOIN t_employee e ON e.department_id = d.department_id
LEFT JOIN t_service_applications tsa ON tsa.user_id = e.employee_id
AND tsa.deleted_flag = 0
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
<if test="queryForm.startTime != null">
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
GROUP BY
d.department_id,
d.department_name
ORDER BY
approvedCount DESC,pendingCount DESC,lawyerCount DESC
</select>
<select id="getServiceApplicationsCost" resultType="java.lang.Long">
SELECT
SUM(tsa.service_duration) AS totalServiceCost
3 months ago
FROM t_service_applications tsa
3 months ago
WHERE tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.firmId != null">
AND tsa.firm_id = #{queryForm.firmId}
</if>
3 months ago
</select>
<select id="getLawyerStatisticsByMonth"
resultType="net.lab1024.sa.admin.module.service.domain.form.ServiceLawyerImportForm">
SELECT
d.department_name AS firmName,
d.department_id as firmId,
COALESCE(SUM(tsa.service_duration), 0) AS quarterlyServiceDuration
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.firm_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
</select>
3 months ago
<select id="getServiceApplicationsAmount" resultType="java.math.BigDecimal">
SELECT
2 months ago
COALESCE(SUM(tsa.workload_score), 0) as workloadScore
3 months ago
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
</select>
<select id="selectByRecordNo"
resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
SELECT
tsa.application_id AS applicationId,
tsa.user_id AS userId,
te.actual_name AS userName,
tsa.firm_id AS firmId,
tsa.service_start AS serviceStart,
tsa.service_end AS serviceEnd,
tsa.service_duration AS serviceDuration,
tsa.beneficiary_count AS beneficiaryCount,
tsa.organizer_name AS organizerName,
tsa.organizer_contact AS organizerContact,
tsa.organizer_phone AS organizerPhone
FROM t_service_applications tsa left join t_employee te on tsa.user_id = te.employee_id
2 months ago
WHERE tsa.deleted_flag = 0 and tsa.record_no = #{recordNo}
3 months ago
</select>
<select id="getServiceAmount" resultType="java.math.BigDecimal">
SELECT
2 months ago
COALESCE(SUM(tsa.workload_score), 0)
3 months ago
FROM t_service_applications tsa
LEFT JOIN t_department d ON tsa.firm_id = d.department_id
<where>
tsa.deleted_flag = 0
AND tsa.association_audit_status = 3
<if test="queryForm.startTime != null and queryForm.startTime != ''">
AND tsa.association_audit_time &gt;= #{queryForm.startTime}
</if>
<if test="queryForm.endTime != null and queryForm.endTime != ''">
AND tsa.association_audit_time &lt;= #{queryForm.endTime}
</if>
<if test="queryForm.userId != null and queryForm.userId != ''">
and tsa.user_id = #{queryForm.userId}
</if>
<if test="queryForm.firmId != null and queryForm.firmId != ''">
and d.department_id = #{queryForm.firmId}
</if>
</where>
</select>
<select id="selectByRecordNoNotMy"
resultType="net.lab1024.sa.admin.module.service.domain.vo.ServiceApplicationsVO">
SELECT
tsa.application_id AS applicationId,
tsa.user_id AS userId,
te.actual_name AS userName,
tsa.firm_id AS firmId,
tsa.service_start AS serviceStart,
tsa.service_end AS serviceEnd,
tsa.service_duration AS serviceDuration,
tsa.beneficiary_count AS beneficiaryCount,
tsa.organizer_name AS organizerName,
tsa.organizer_contact AS organizerContact,
tsa.organizer_phone AS organizerPhone
FROM t_service_applications tsa left join t_employee te on tsa.user_id = te.employee_id
<where>
tsa.deleted_flag = 0
<if test="userId != null">
and tsa.user_id != #{userId}
</if>
<if test="recordNo != null">
and tsa.record_no = #{recordNo}
</if>
</where>
</select>
4 months ago
</mapper>