检测员工更新

This commit is contained in:
许允枞 2025-02-06 09:11:14 +08:00
parent 1e6d1a68c2
commit dc4fcb297f
3 changed files with 18 additions and 14 deletions

View File

@ -56,6 +56,6 @@ public interface InspectionStaffService extends IService<InspectionStaff> {
* @param inspectionStaffVo * @param inspectionStaffVo
* @return * @return
*/ */
boolean saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo); Long saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo);
} }

View File

@ -153,27 +153,28 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo) { public Long saveInspectionStaff(InspectionStaffSaveVo inspectionStaffVo) {
//新增system_users主表 //新增system_users主表
UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class); UserSaveReqVO userDTO = BeanUtil.copyProperties(inspectionStaffVo, UserSaveReqVO.class);
userDTO.setId(inspectionStaffVo.getUserId()); userDTO.setId(inspectionStaffVo.getUserId());
Long userId = userService.createUser(userDTO); Long userId = userService.createUser(userDTO);
//查询检测基础员工角色 // //查询检测基础员工角色
List<RoleDO> role = roleService.getRoleListByCodesTenant(Collections.singletonList(InspectionConstants.INSPECTION_BASE_STAFF_ROLE)); // List<RoleDO> role = roleService.getRoleListByCodesTenant(Collections.singletonList(InspectionConstants.INSPECTION_BASE_STAFF_ROLE));
//
if (ObjectUtil.isNull(role)) { // if (ObjectUtil.isNull(role)) {
throw new RuntimeException("检测基础员工角色不存在"); // throw new RuntimeException("检测基础员工角色不存在");
} // }
//
Set<Long> roleIds = role.stream().map(RoleDO::getId).collect(Collectors.toSet()); // Set<Long> roleIds = role.stream().map(RoleDO::getId).collect(Collectors.toSet());
//设置角色为检测基础员工 // //设置角色为检测基础员工
permissionService.assignUserRole(userId, roleIds); // permissionService.assignUserRole(userId, roleIds);
InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class); InspectionStaff inspectionStaff = BeanUtil.copyProperties(inspectionStaffVo, InspectionStaff.class);
inspectionStaff.setUserId(userId); inspectionStaff.setUserId(userId);
//新增检测员工子表 //新增检测员工子表
return this.save(inspectionStaff); this.save(inspectionStaff);
return inspectionStaff.getUserId();
} }
/** /**
@ -229,6 +230,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
* @return * @return
*/ */
public String removeFileExtension(String filename) { public String removeFileExtension(String filename) {
if (filename == null) {
return null; // 或者你可以选择返回一个空字符串取决于你的业务需求
}
int lastDotIndex = filename.lastIndexOf('.'); int lastDotIndex = filename.lastIndexOf('.');
if (lastDotIndex == -1) { if (lastDotIndex == -1) {
return filename; // 如果没有找到点则返回原文件名 return filename; // 如果没有找到点则返回原文件名

View File

@ -32,7 +32,7 @@
left join system_role sr on sur.role_id = sr.id left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id left join inspection_staff iss on iss.user_id = su.id
<where> <where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh' sr.service_package_id = 'jiance' and sr.code != 'jcyh' and su.deleted = 0
<if test="query.nickname != null and query.nickname != ''"> <if test="query.nickname != null and query.nickname != ''">
and su.nickname like concat('%', #{query.nickname}, '%') and su.nickname like concat('%', #{query.nickname}, '%')
</if> </if>