feat(service): 新增单位下安保人员花名册功能并添加文化程度字段

- 新增 EducationLevel 枚举类,用于表示不同的教育水平
- 在 SecurityUser 和相关 DTO 中添加 educationLevel 字段
- 新增 unitSecurityUserRoster 接口和实现方法- 更新数据库查询以包含新的教育水平字段
This commit is contained in:
luozhun 2024-12-19 14:15:31 +08:00
parent 849ae8593c
commit 078d4f5606
10 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.changhu.common.db.enums;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.changhu.common.db.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20252
* @createTime 2024/12/19 上午9:31
* @desc EducationLevel...
*/
@Getter
@AllArgsConstructor
public enum EducationLevel implements BaseEnum<String>, IEnum<String> {
PRIMARY_SCHOOL("primary_school", "小学"),
JUNIOR_SCHOOL("junior_school", "初中"),
HIGH_SCHOOL("high_school", "高中"),
COLLEGE("college", "大专"),
UNDERGRADUATE("undergraduate", "本科"),
UNDERGRADUATE_MORE("undergraduate_more", "本科以上"),
;
private final String value;
private final String label;
}

View File

@ -68,4 +68,11 @@ public class OpenController {
return openApiService.securityUserRoster(id, type);
}
@Operation(summary = "单位下的安保人员花名册")
@GetMapping("/unitSecurityUserRoster")
public List<SecurityUserRosterDTO> unitSecurityUserRoster(@Schema(description = "代码") @RequestParam String code,
@Schema(description = "等级") @RequestParam Integer level) {
return openApiService.unitSecurityUserRoster(code, level);
}
}

View File

@ -51,4 +51,9 @@ public interface OpenApiMapper {
*/
List<SecurityUserRosterDTO> securityUserRoster(@Param("id") Long id,
@Param("type") EnterprisesUnitOrServiceProjectType type);
/**
* 单位下的服务人员花名册
*/
List<SecurityUserRosterDTO> unitSecurityUserRoster(String code, Integer level);
}

View File

@ -1,5 +1,6 @@
package com.changhu.module.miniProgram.pojo.params;
import com.changhu.common.db.enums.EducationLevel;
import com.changhu.common.db.enums.Sex;
import com.changhu.common.validator.annotation.IdCard;
import io.swagger.v3.oas.annotations.media.Schema;
@ -66,4 +67,8 @@ public class SecurityUserSaveOrUpdateParams {
@Schema(description = "备注")
private String remark;
@NotNull(message = "文化程度为必选")
@Schema(description = "文化程度")
private EducationLevel educationLevel;
}

View File

@ -2,6 +2,7 @@ package com.changhu.module.miniProgram.pojo.vo;
import cn.hutool.core.util.DesensitizedUtil;
import com.changhu.common.annotation.Desensitized;
import com.changhu.common.db.enums.EducationLevel;
import com.changhu.common.db.enums.Sex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -63,6 +64,9 @@ public class ServiceProjectSecurityUserPagerVo {
@Schema(description = "备注")
private String remark;
@Schema(description = "文化程度")
private EducationLevel educationLevel;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -1,8 +1,11 @@
package com.changhu.pojo.dto;
import cn.hutool.core.util.DesensitizedUtil;
import com.alibaba.fastjson2.annotation.JSONField;
import com.changhu.common.annotation.Desensitized;
import com.changhu.common.db.enums.EducationLevel;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.fastjson2.serializer.MinioPrefixSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -15,6 +18,9 @@ import lombok.Data;
public class SecurityUserRosterDTO {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "照片")
@JSONField(serializeUsing = MinioPrefixSerializer.class)
private String photo;
@Schema(description = "名称")
private String name;
@Schema(description = "性别")
@ -33,4 +39,6 @@ public class SecurityUserRosterDTO {
private String securityUnitName;
@Schema(description = "保安证号")
private String securityNumber;
@Schema(description = "文化程度")
private EducationLevel educationLevel;
}

View File

@ -1,6 +1,7 @@
package com.changhu.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.changhu.common.db.enums.EducationLevel;
import com.changhu.common.db.enums.Sex;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.AllArgsConstructor;
@ -99,5 +100,9 @@ public class SecurityUser extends BaseEntity implements Serializable {
*/
private String remark;
/**
* 文化程度
*/
private EducationLevel educationLevel;
}

View File

@ -56,4 +56,9 @@ public interface OpenApiService {
* @return 花名册
*/
List<SecurityUserRosterDTO> securityUserRoster(Long id, EnterprisesUnitOrServiceProjectType type);
/**
* 单位下的安保人员花名册
*/
List<SecurityUserRosterDTO> unitSecurityUserRoster(String code, Integer level);
}

View File

@ -123,4 +123,10 @@ public class OpenApiServiceImpl implements OpenApiService {
public List<SecurityUserRosterDTO> securityUserRoster(Long id, EnterprisesUnitOrServiceProjectType type) {
return openApiMapper.securityUserRoster(id, type);
}
@Override
public List<SecurityUserRosterDTO> unitSecurityUserRoster(String code, Integer level) {
return openApiMapper.unitSecurityUserRoster(code, level);
}
}

View File

@ -166,6 +166,7 @@
select su.snow_flake_id,
su.name,
su.sex,
su.photo,
TIMESTAMPDIFF(YEAR, su.date_of_birth, CURDATE()) AS 'age',
su.id_card,
su.telephone,
@ -190,4 +191,40 @@
</choose>
order by su.create_time desc
</select>
<select id="unitSecurityUserRoster" resultType="com.changhu.pojo.dto.SecurityUserRosterDTO">
select su.snow_flake_id,
su.name,
su.sex,
su.photo,
TIMESTAMPDIFF(YEAR, su.date_of_birth, CURDATE()) AS 'age',
su.id_card,
su.telephone,
eu.name as 'enterprisesUnitName',
suu.name as 'securityUnitName',
su.security_number
from enterprises_unit eu
LEFT JOIN service_project sp ON sp.enterprises_unit_id = eu.snow_flake_id AND sp.delete_flag = 0
JOIN security_user su ON su.service_project_id = sp.snow_flake_id AND su.delete_flag = 0
LEFT JOIN security_unit suu ON su.security_unit_id = suu.snow_flake_id AND suu.delete_flag = 0
where eu.delete_flag = 0
<choose>
<when test="level==1">
and eu.province = #{code}
</when>
<when test="level==2">
and eu.city = #{code}
</when>
<when test="level==3">
and eu.districts = #{code}
</when>
<when test="level==4">
and eu.street = #{code}
</when>
<when test="level==5">
and pu.code = #{code}
</when>
<otherwise>and eu.snow_flake_id = -1</otherwise>
</choose>
order by su.create_time desc
</select>
</mapper>