代码提交

This commit is contained in:
luozhun 2024-12-19 14:29:26 +08:00
parent b086e5a49f
commit 7656519f5b
2 changed files with 43 additions and 34 deletions

View File

@ -1,6 +1,7 @@
package com.changhu.pojo.dto;
import com.alibaba.fastjson2.annotation.JSONField;
import com.changhu.common.db.enums.EducationLevel;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.common.db.enums.Sex;
import com.changhu.pojo.model.LegalPersonInfo;
@ -81,6 +82,9 @@ public class ServiceProjectDTO {
static class SecurityUserInfo {
@Schema(description = "id")
private Long snowFlakeId;
@JSONField(serializeUsing = MinioPrefixSerializer.class)
@Schema(description = "照片")
private String photo;
@Schema(description = "名字")
private String name;
@Schema(description = "手机号")
@ -103,5 +107,7 @@ public class ServiceProjectDTO {
private String remark;
@Schema(description = "创建时间")
private String createTime;
@Schema(description = "文化程度")
private EducationLevel educationLevel;
}
}

View File

@ -43,42 +43,43 @@
property="securityUserList" />
</resultMap>
<select id="getServiceProjectByEnterprisesUnitId" resultMap="ServiceProjectDTOResultMap">
SELECT
sp.*,
IF(mpu.snow_flake_id IS NOT NULL,json_object( 'name', mpu.NAME, 'sex', mpu.sex, 'telephone', mpu.telephone, 'idCard', mpu.id_card ),NULL) AS 'projectManagerInfo',
json_object(
'name',su1.name,
'socialCode',su1.social_code,
'businessLicense',su1.business_license,
'legalPersonInfo',su1.legal_person_info,
'address',su1.address,
'nature',su1.nature
) as 'securityUnitInfo',
if(COUNT(su.snow_flake_id)>0,JSON_ARRAYAGG(json_object(
'snowFlakeId',su.snow_flake_id,
'name',su.name,
'telephone',su.telephone,
'workPost',su.work_post,
'sex',su.sex,
'nativePlace',su.native_place,
'idCard',su.id_card,
'dateOfBirth',su.date_of_birth,
'securityNumber',su.security_number,
'homeAddress',su.home_address,
'remark',su.remark,
'createTime',su.create_time
)),JSON_ARRAY()) as 'securityUserList'
FROM
service_project sp
left join security_unit su1 on sp.security_unit_id = su1.snow_flake_id
LEFT JOIN mini_program_user mpu ON sp.project_manager_mini_program_user_id = mpu.snow_flake_id AND mpu.identity = 'project_manager'
left join security_user su on su.service_project_id = sp.snow_flake_id and su.delete_flag = 0
WHERE
sp.delete_flag = 0
SELECT sp.*,
IF(mpu.snow_flake_id IS NOT NULL,
json_object('name', mpu.NAME, 'sex', mpu.sex, 'telephone', mpu.telephone, 'idCard', mpu.id_card),
NULL) AS 'projectManagerInfo',
json_object(
'name', su1.name,
'socialCode', su1.social_code,
'businessLicense', su1.business_license,
'legalPersonInfo', su1.legal_person_info,
'address', su1.address,
'nature', su1.nature
) as 'securityUnitInfo',
if(COUNT(su.snow_flake_id) > 0, JSON_ARRAYAGG(json_object(
'snowFlakeId', su.snow_flake_id,
'photo', su.photo,
'name', su.name,
'telephone', su.telephone,
'workPost', su.work_post,
'sex', su.sex,
'nativePlace', su.native_place,
'idCard', su.id_card,
'dateOfBirth', su.date_of_birth,
'securityNumber', su.security_number,
'homeAddress', su.home_address,
'remark', su.remark,
'educationLevel', su.education_level,
'createTime', su.create_time
)), JSON_ARRAY()) as 'securityUserList'
FROM service_project sp
left join security_unit su1 on sp.security_unit_id = su1.snow_flake_id
LEFT JOIN mini_program_user mpu ON sp.project_manager_mini_program_user_id = mpu.snow_flake_id AND
mpu.identity = 'project_manager'
left join security_user su on su.service_project_id = sp.snow_flake_id and su.delete_flag = 0
WHERE sp.delete_flag = 0
AND sp.enterprises_unit_id = #{enterprisesUnitId}
group by sp.snow_flake_id
ORDER BY
sp.create_time DESC
ORDER BY sp.create_time DESC
</select>
<resultMap id="SecurityUnitUseStatisticsDTOResultMap" type="com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO">
<result
@ -170,6 +171,7 @@
TIMESTAMPDIFF(YEAR, su.date_of_birth, CURDATE()) AS 'age',
su.id_card,
su.telephone,
su.education_level,
eu.name as 'enterprisesUnitName',
suu.name as 'securityUnitName',
su.security_number
@ -199,6 +201,7 @@
TIMESTAMPDIFF(YEAR, su.date_of_birth, CURDATE()) AS 'age',
su.id_card,
su.telephone,
su.education_level,
eu.name as 'enterprisesUnitName',
suu.name as 'securityUnitName',
su.security_number