用户部门筛选bug修改

添加员工逻辑调整(正式/分正式)
This commit is contained in:
hejiayang
2025-10-14 18:48:34 +08:00
parent 77f8a2eddd
commit 081cc168eb
2 changed files with 39 additions and 12 deletions
@@ -116,10 +116,14 @@
NULL AS work_strength,
sus.del_flag,
sus.is_sync,
NULL AS secondDepartName, -- 对应字段在 sys_user_sub 中不存在,填 NULL
NULL AS thirdDepartName,
NULL AS dep_id,
NULL AS depart_name,
parent_depart.depart_name AS secondDepartName,
direct_depart.depart_name AS thirdDepartName,
CONCAT(
IFNULL(parent_depart.depart_name, ''),
IF(parent_depart.depart_name IS NOT NULL AND direct_depart.depart_name IS NOT NULL, '->', ''),
IFNULL(direct_depart.depart_name, '')
) AS departNames,
sus.depart_ids as departIds,
sus.username,
sus.realname,
sus.avatar,
@@ -132,24 +136,44 @@
sus.main_user_relation,
sus.canteen_id,
sus.status,
sus.card_code,
sus.card_code_status,
sus.remark
FROM
sys_user_sub sus
LEFT JOIN sys_pay_depart direct_depart
ON sus.depart_ids = direct_depart.id
AND direct_depart.del_flag = '0'
LEFT JOIN sys_pay_depart parent_depart
ON direct_depart.parent_id = parent_depart.id
AND parent_depart.del_flag = '0'
WHERE 1 = 1
AND sus.user_identity = 6 -- 根据需求过滤条件
AND sus.del_flag = 0
<if test="(vo.realname == null or vo.realname == '') and (vo.phone == null or vo.phone == '')">
and sus.main_user_id is null -- 默认只查询正式员工+非正式员工,搜索姓名或者手机号查询全部用户
</if>
and sus.main_user_id is null -- 默认只查询正式员工+非正式员工,搜索姓名或者手机号查询全部用户
<if test="vo.realname != null and vo.realname != ''">
and sus.realname like CONCAT('%', #{vo.realname},'%')
</if>
<if test="vo.phone != null and vo.phone != ''">
and sus.phone = #{vo.phone}
</if>
<if test="vo.cardCode != null and vo.cardCode != ''">
and sus.card_code like CONCAT('%',#{vo.cardCode,jdbcType=VARCHAR},'%')
</if>
<if test="vo.cardCodeStatus != null and vo.cardCodeStatus != ''">
and sus.card_code_status = #{vo.cardCodeStatus}
</if>
<if test="vo.mainUserRelation != null and vo.mainUserRelation != ''">
and sus.main_ser_relation = #{vo.mainUserRelation}
</if>
<if test="vo.list != null">
and sus.depart_ids in
<foreach item="departId" collection="vo.list" open="(" separator="," close=")">
#{departId}
</foreach>
</if>
<if test="vo.userType != null and vo.userType != ''">
and sus.user_type = #{vo.userType}
</if>
@@ -61,12 +61,15 @@ public class CqBaseEmployeeServiceImpl extends ServiceImpl<CqBaseEmployeeMapper,
user.setDelFlag(CommonConstant.DEL_FLAG_0);
user.setSysOrgCode("A01A54");//20250411 余:同一放采气六厂的,orgCode A01A54
user.setUserIdentity(6);
if(StringUtils.isBlank(user.getMainUserId())){
user.setMainUserId(null);
user.setUserType(1);//非正式员工
} else {
user.setUserType(2);//家庭用户
if(user.getUserType() == null){
if(StringUtils.isBlank(user.getMainUserId())){
user.setMainUserId(null);
user.setUserType(1);//非正式员工
} else {
user.setUserType(2);//家庭用户
}
}
Result result1 = sysUserService.saveUserSub(user);
if(result1.getCode() != 200){
return result1;