From 30db383f01730e6a783aa676322965822cb25d61 Mon Sep 17 00:00:00 2001 From: admin <1094254749@qq.com> Date: Thu, 16 Jan 2025 16:56:10 +0800 Subject: [PATCH] =?UTF-8?q?daijiajun=20=E9=83=A8=E9=97=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=B8=AD=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8=EF=BC=8C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=83=A8=E9=97=A8=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Department/DepartmentController.java | 239 +++++++++++++++++- .../project/ProjectKtController.java | 2 - .../htey/controller/user/UserController.java | 157 +++++++++++- .../htey/entity/department/Department.java | 8 + .../htey/mybatis/itf/DepartmentMapper.java | 8 + .../keyware/htey/mybatis/itf/UserMapper.java | 2 + .../service/impl/DepartmentServiceImpl.java | 20 ++ .../htey/service/impl/UserServiceImpl.java | 5 + .../htey/service/itf/DepartmentService.java | 8 + .../keyware/htey/service/itf/UserService.java | 2 + .../keyware/htey/utli/IdComposeListUtil.java | 17 +- .../resources/mapper/DepartmentMapper.xml | 181 ++++++++++++- src/main/resources/mapper/UserMapper.xml | 71 +++++- 13 files changed, 700 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/keyware/htey/controller/Department/DepartmentController.java b/src/main/java/com/keyware/htey/controller/Department/DepartmentController.java index a2c101a..559aafb 100644 --- a/src/main/java/com/keyware/htey/controller/Department/DepartmentController.java +++ b/src/main/java/com/keyware/htey/controller/Department/DepartmentController.java @@ -5,9 +5,15 @@ import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.keyware.htey.entity.department.Department; import com.keyware.htey.entity.user.AuditLog; +import com.keyware.htey.entity.user.User; import com.keyware.htey.service.itf.AuditLogService; import com.keyware.htey.service.itf.DepartmentService; +import com.keyware.htey.service.itf.UserService; +import com.keyware.htey.utli.AjaxMessage; import com.keyware.htey.utli.Constant; +import com.keyware.htey.utli.DateUtils; +import com.keyware.htey.utli.IdComposeListUtil; +import com.keyware.htey.utli.IdGenerator; import com.keyware.htey.utli.JsonUtils; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -15,7 +21,9 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -38,6 +46,8 @@ public class DepartmentController { private DepartmentService departmentService; @Autowired private AuditLogService auditLogService; + @Autowired + private UserService userService; @GetMapping("/selectById") @ResponseBody @@ -107,7 +117,7 @@ public class DepartmentController { @ResponseBody @Operation(summary = "查询部门父节点信息", description = "返回部门父节点信息") @ApiResponse(responseCode = "200", description = "成功部门父节点信息") - public String getParentId(@RequestParam String id, @RequestParam String projectResource) { + public String getParentId(@RequestParam String id, @RequestParam(required = false) String projectResource) { String isSys = ""; //if ("sysadmin".equals(this.getUser_idFormSession("userId"))) { // isSys = "sysadmin"; @@ -168,4 +178,231 @@ public class DepartmentController { auditLogService.addAuditLog(auditLog); return departmentList; } + + @RequestMapping( + value = {"/checkDepartMentName"}, + method = {RequestMethod.POST}, + produces = {"application/json; charset=utf-8"} + ) + @ResponseBody + @Operation(summary = "部门校验", description = "返回部门校验是否成功") + @ApiResponse(responseCode = "200", description = "部门校验成功") + public AjaxMessage checkDepartMentName(String name) { + AjaxMessage ajaxMessage = new AjaxMessage(); + if (StringUtils.hasText(name)) { + List selectByDeparmentName = this.departmentService.selectByDeparmentName(name); + if (selectByDeparmentName.size() > 0) { + ajaxMessage.setCode("1"); + ajaxMessage.setMessage("部门名称已存在"); + } + } + + return ajaxMessage; + } + + @RequestMapping( + value = {"/add"}, + method = {RequestMethod.POST}, + produces = {"application/json; charset=utf-8"} + ) + @ResponseBody + @Operation(summary = "部门添加", description = "返回部门添加是否成功") + @ApiResponse(responseCode = "200", description = "部门添加成功") + public AjaxMessage add(@ModelAttribute Department department) { + AjaxMessage ajaxMessage = new AjaxMessage(); + AuditLog auditLog = new AuditLog(); + try { + Department departmentSelect = new Department(); + departmentSelect.setDeptName(department.getDeptName()); + List selectByDeparmentInfo = this.departmentService.selectByDeparmentInfoSelect( + departmentSelect); + if (selectByDeparmentInfo.size() > 0) { + ajaxMessage.setCode("0"); + ajaxMessage.setMessage("部门名称已存在"); + return ajaxMessage; + } + + Department departmentSelect1 = new Department(); + departmentSelect1.setDeptNumber(department.getDeptNumber()); + List selectByDeparmentInfo1 = this.departmentService.selectByDeparmentInfoSelect( + departmentSelect1); + if (selectByDeparmentInfo1.size() > 0) { + ajaxMessage.setCode("0"); + ajaxMessage.setMessage("部门编号已存在"); + return ajaxMessage; + } + + String deptId = IdGenerator.uuid32(); + department.setId(deptId); + department.setIsSys("0"); + department.setDeptCreateTime(DateUtils.getDateTime()); + department.setTotalWorkers(0); + this.departmentService.insertSelective(department); + User user = new User(); + user.setId(department.getCharge()); + user.setDepartId(deptId); + this.userService.updateByPrimaryKeySelective(user); + ajaxMessage.setCode("1"); + ajaxMessage.setMessage("保存成功"); + StringBuilder info = new StringBuilder(); + info.append("部门简称:" + department.getDepartAbbrevia() + ";"); + info.append("上级部门:" + department.getParentName() + ";"); + info.append("部门负责:" + department.getChargeName() + ";"); + info.append("部门接口人:" + department.getInterfacePersonName() + ";"); + info.append("上级主管领导:" + department.getSuperLeaderName() + ";"); + info.append("部门管理人:" + department.getManagerName() + ";"); + info.append("部门描述:" + department.getComments() + ";"); + String logName = "添加部门"; + String logNameType = "部门管理"; + /*String comments = this.getUser_idFormSession("userName") + "添加" + department.getDeptName() + "部门,详细信息:" + + info;*/ + //todo 获取登录人信息 + String comments = "添加" + department.getDeptName() + "部门,详细信息:" + info; + auditLog.setLogName(logName); + auditLog.setLogNameType(logNameType); + auditLog.setComments(comments); + auditLogService.addAuditLog(auditLog); + } catch (Exception var10) { + log.error("部门添加失败", var10); + var10.printStackTrace(); + ajaxMessage.setCode("0"); + ajaxMessage.setMessage(Constant.ERROE_MESSAGE); + } + return ajaxMessage; + } + + @RequestMapping(value = "/edit", method = RequestMethod.POST, produces = "application/json; charset=utf-8") + @ResponseBody + @Operation(summary = "部门修改", description = "返回部门修改是否成功") + @ApiResponse(responseCode = "200", description = "部门添加修改") + public AjaxMessage edit(@ModelAttribute Department department) { + AjaxMessage ajaxMessage = new AjaxMessage(); + AuditLog auditLog = new AuditLog(); + try { + Department oldDepartment = departmentService.selectByPrimaryKey(department.getId()); + departmentService.updateByPrimaryKeySelective(department); + ajaxMessage.setCode("1"); + ajaxMessage.setMessage("保存成功"); + + StringBuilder info = new StringBuilder(); + if (oldDepartment.getDepartAbbrevia() == null) {oldDepartment.setDepartAbbrevia("");} + if (!oldDepartment.getDepartAbbrevia().equals(department.getDepartAbbrevia())) { + info.append( + "部门简称从" + oldDepartment.getDepartAbbrevia() + "修改为" + department.getDepartAbbrevia() + ";"); + } + if (oldDepartment.getParentId() == null) {oldDepartment.setParentId("");} + if (!oldDepartment.getParentId().equals(department.getParentId())) { + String oldName = "空"; + String newName = "空"; + if (StringUtils.hasText(oldDepartment.getParentId())) { + Department department1 = departmentService.selectByPrimaryKey(oldDepartment.getParentId()); + oldName = department1.getDeptName(); + } + if (StringUtils.hasText(department.getParentId())) { + Department department1 = departmentService.selectByPrimaryKey(department.getParentId()); + newName = department1.getDeptName(); + } + info.append("上级部门从" + oldName + "修改为" + newName + ";"); + } + if (oldDepartment.getCharge() == null) {oldDepartment.setCharge("");} + if (!oldDepartment.getCharge().equals(department.getCharge())) { + String oldName = "空"; + if (StringUtils.hasText(oldDepartment.getCharge())) { + User user = userService.selectByPrimaryKey(oldDepartment.getCharge()); + oldName = user.getUserName(); + } + info.append("部门负责人从" + oldName + "修改为" + department.getChargeName() + ";"); + } + if (oldDepartment.getInterfacePerson() == null) {oldDepartment.setInterfacePerson("");} + if (!oldDepartment.getInterfacePerson().equals(department.getInterfacePerson())) { + String oldName = "空"; + if (StringUtils.hasText(oldDepartment.getInterfacePerson())) { + String interfacePerson = oldDepartment.getInterfacePerson(); + String[] split = interfacePerson.split(","); + for (String s : split) { + User user = userService.selectByPrimaryKey(s); + oldName += user.getUserName() + ","; + } + oldName = oldName.substring(0, oldName.length() - 1); + } + info.append("部门接口人从" + oldName + "修改为" + department.getInterfacePersonName() + ";"); + } + if (oldDepartment.getSuperLeader() == null) {oldDepartment.setSuperLeader("");} + if (!oldDepartment.getSuperLeader().equals(department.getSuperLeader())) { + String oldName = "空"; + if (StringUtils.hasText(oldDepartment.getSuperLeader())) { + String interfacePerson = oldDepartment.getSuperLeader(); + String[] split = interfacePerson.split(","); + for (String s : split) { + User user = userService.selectByPrimaryKey(s); + oldName += user.getUserName() + ","; + } + oldName = oldName.substring(0, oldName.length() - 1); + } + info.append("上级主管领导从" + oldName + "修改为" + department.getSuperLeaderName() + ";"); + } + if (oldDepartment.getManager() == null) {oldDepartment.setManager("");} + if (!oldDepartment.getManager().equals(department.getManager())) { + StringBuilder oldName = new StringBuilder("空"); + if (StringUtils.hasText(oldDepartment.getManager())) { + String interfacePerson = oldDepartment.getManager(); + String[] split = interfacePerson.split(","); + for (String s : split) { + User user = userService.selectByPrimaryKey(s); + oldName.append(user.getUserName()).append(","); + } + oldName = new StringBuilder(oldName.substring(0, oldName.length() - 1)); + } + info.append("部门管理人从" + oldName + "修改为" + department.getManagerName() + ";"); + } + if (oldDepartment.getComments() == null) {oldDepartment.setComments("");} + if (!oldDepartment.getComments().equals(department.getComments())) { + info.append("部门描述从" + oldDepartment.getComments() + "修改为" + department.getComments() + ";"); + } + String logName = "修改部门信息"; + String logNameType = "部门管理"; + /*String comments = getUser_idFormSession("userName")+"修改了"+department.getDeptName()+"部门详细信息:" + info;*/ + //todo 获取登录人信息 + String comments = "修改了" + department.getDeptName() + "部门详细信息:" + info; + auditLog.setLogName(logName); + auditLog.setLogNameType(logNameType); + auditLog.setComments(comments); + auditLogService.addAuditLog(auditLog); + } catch (Exception e) { + log.error("修改失败", e); + e.printStackTrace(); + ajaxMessage.setCode("0"); + ajaxMessage.setMessage("系统错误,请联系管理员"); + } + return ajaxMessage; + } + + @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = "application/json; charset=utf-8") + @ResponseBody + @Operation(summary = "部门删除", description = "返回部门删除是否成功") + @ApiResponse(responseCode = "200", description = "部门删除修改") + public String delete(@RequestBody List departments) { + List listId = IdComposeListUtil.listDepartmentId(departments); + StringBuilder deparNames = new StringBuilder(); + for (String id : listId) { + Department selectByPrimaryKey = departmentService.selectByPrimaryKey(id); + deparNames.append(selectByPrimaryKey.getDeptName()).append(","); + } + departmentService.deleteByPrimaryKey(listId); + if (deparNames.length() > 0) { + AuditLog auditLog = new AuditLog(); + String logName = "删除部门"; + String logNameType = "部门管理"; + /*String comments = getUser_idFormSession("userName")+"删除了"+deparNames.substring(0, deparNames.length() + -1)+"部门";*/ + //todo 获取登录人信息 + String comments = "删除了" + deparNames.substring(0, deparNames.length() - 1) + "部门"; + auditLog.setLogName(logName); + auditLog.setLogNameType(logNameType); + auditLog.setComments(comments); + auditLogService.addAuditLog(auditLog); + } + + return "删除成功"; + } } diff --git a/src/main/java/com/keyware/htey/controller/project/ProjectKtController.java b/src/main/java/com/keyware/htey/controller/project/ProjectKtController.java index 9267ea5..94079f8 100644 --- a/src/main/java/com/keyware/htey/controller/project/ProjectKtController.java +++ b/src/main/java/com/keyware/htey/controller/project/ProjectKtController.java @@ -150,13 +150,11 @@ public class ProjectKtController { list.addAll(users); } else if (!"".equals(source)) { user.setDepartId(departId); - // users = this.userService.selectByUserInfo17suo(user); users = userService.selectByUser(user); list.addAll(users); } else { selectByparentId = this.departmentService.selectByparentId(departId); user.setDepartId(departId); - // users = this.userService.selectByUserInfo17suo(user); users = userService.selectByUser(user); list.addAll(users); userIterator = selectByparentId.iterator(); diff --git a/src/main/java/com/keyware/htey/controller/user/UserController.java b/src/main/java/com/keyware/htey/controller/user/UserController.java index 063515a..da7b146 100644 --- a/src/main/java/com/keyware/htey/controller/user/UserController.java +++ b/src/main/java/com/keyware/htey/controller/user/UserController.java @@ -6,6 +6,7 @@ import java.util.Base64; import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -36,7 +37,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.annotations.Param; import org.apache.shiro.session.Session; import org.apache.shiro.session.mgt.eis.SessionDAO; import org.springframework.beans.factory.annotation.Autowired; @@ -279,7 +279,7 @@ public class UserController { return "当前版本只允许新建" + Constant.userCount + "个用户"; } } - this.userService.recovery(IdComposeListUtil.listId(users)); + this.userService.recovery(IdComposeListUtil.listUserId(users)); userNames = ""; for (User user : users) { User u = this.userService.selectByPrimaryKey(user.getId()); @@ -322,7 +322,7 @@ public class UserController { @Operation(summary = "用户解锁", description = "返回用户解锁信息") @ApiResponse(responseCode = "200", description = "成功用户解锁信息") public String updateLock(@RequestBody List users) { - List listId = IdComposeListUtil.listId(users); + List listId = IdComposeListUtil.listUserId(users); userService.unlock(listId); String userNames = ""; AuditLog auditLog = new AuditLog(); @@ -424,7 +424,7 @@ public class UserController { @ApiResponse(responseCode = "200", description = "成功删除用户信息") public String deleteUser(@RequestBody List users) { try { - List listId = IdComposeListUtil.listId(users); + List listId = IdComposeListUtil.listUserId(users); AuditLog auditLog = new AuditLog(); String userNames = ""; for (User user : users) { @@ -920,4 +920,153 @@ public class UserController { } return userList; } + + @RequestMapping( + value = {"/selectDepartUser"}, + method = {RequestMethod.POST}, + produces = {"application/json; charset=utf-8"} + ) + @ResponseBody + @Operation(summary = "查询部门管理人", description = "返回查询部门管理人信息") + @ApiResponse(responseCode = "200", description = "查询部门管理人成功") + public String selectDepartUser(@RequestBody User user, @RequestParam(required = false) String setDocumentDepartId) { + List list = new ArrayList(); + String departId = user.getDepartId() == null ? "" : user.getDepartId(); + String set_document_departId = setDocumentDepartId == null ? "" : setDocumentDepartId; + String source = user.getSecret() == null ? "" : user.getSecret(); + String userName = user.getUserNameForSerch(); + log.info("查询条件=" + userName); + String projectClassIficationName = user.getUesrRankName() == null ? "" : user.getUesrRankName(); + String customer = Constant.customer; + if ("sysadmin".equals(Constant.userId)) { + user.setIsSys("sysadmin"); + } + user.setFlag("1"); + List users; + Iterator userIterator; + if (!"".equals(set_document_departId)) { + Department department = this.departmentService.selectByPrimaryKey(set_document_departId); + if (department != null) { + users = null; + if (customer != null && customer.equals("siyuan17suo")) { + if (userName != null && !"搜索您想寻找的...".equals(userName)) { + user.setUserNameForSerch(userName); + user.setDepartId(department.getParentId()); + user.setProjectSource(Constant.projectName); + users = this.userService.selectByUserInfo17suo(user); + } else { + users = this.userService.selectDepartUser17suo(department.getParentId()); + } + + userIterator = users.iterator(); + + while (userIterator.hasNext()) { + User u = (User)userIterator.next(); + if (("内部".equals(projectClassIficationName) || "秘密".equals(projectClassIficationName)) + && !"10".equals(u.getSecret()) && !"20".equals(u.getSecret()) && !"30".equals( + u.getSecret())) { + userIterator.remove(); + } + + if ("机密".equals(projectClassIficationName) && !"20".equals(u.getSecret()) && !"30".equals( + u.getSecret())) { + userIterator.remove(); + } + } + } else if (userName != null && !"搜索您想寻找的...".equals(userName)) { + user.setUserNameForSerch(userName); + user.setDepartId(department.getParentId()); + user.setProjectSource(Constant.projectName); + users = this.userService.selectByUserInfo(user); + } else { + users = this.userService.selectDepartUser(department.getParentId()); + } + + return JsonUtils.arrayListToJsonString(users); + } + } else { + HashSet selectByparentId; + String deptId; + if (customer == null || !customer.equals("siyuan17suo") && !customer.equals("guiyangshiyuan")) { + if (org.springframework.util.StringUtils.hasText(userName)) { + if (!"搜索您想寻找的...".equals(userName)) { + user.setUserNameForSerch(userName); + } + + users = this.userService.selectByUserInfo(user); + list.addAll(users); + } else if (!"".equals(source)) { + user.setDepartId(departId); + users = this.userService.selectByUserInfo(user); + list.addAll(users); + } else { + selectByparentId = this.departmentService.selectByparentId(departId); + user.setDepartId(departId); + users = this.userService.selectByUserInfo(user); + list.addAll(users); + userIterator = selectByparentId.iterator(); + + while (userIterator.hasNext()) { + deptId = (String)userIterator.next(); + user.setDepartId(deptId); + users = this.userService.selectByUserInfo(user); + list.addAll(users); + } + } + } else { + if (org.springframework.util.StringUtils.hasText(userName)) { + if (!"搜索您想寻找的...".equals(userName)) { + user.setUserNameForSerch(userName); + } + + users = this.userService.selectByUserInfo17suo(user); + list.addAll(users); + } else if (!"".equals(source)) { + user.setDepartId(departId); + users = this.userService.selectByUserInfo17suo(user); + list.addAll(users); + } else { + selectByparentId = this.departmentService.selectByparentId(departId); + user.setDepartId(departId); + users = this.userService.selectByUserInfo17suo(user); + list.addAll(users); + userIterator = selectByparentId.iterator(); + + while (userIterator.hasNext()) { + deptId = (String)userIterator.next(); + user.setDepartId(deptId); + users = this.userService.selectByUserInfo17suo(user); + list.addAll(users); + } + } + + userIterator = list.iterator(); + + while (userIterator.hasNext()) { + User u = (User)userIterator.next(); + if (("内部".equals(projectClassIficationName) || "秘密".equals(projectClassIficationName)) + && !"10".equals(u.getSecret()) && !"20".equals(u.getSecret()) && !"30".equals(u.getSecret())) { + userIterator.remove(); + } + + if ("机密".equals(projectClassIficationName) && !"20".equals(u.getSecret()) && !"30".equals( + u.getSecret())) { + userIterator.remove(); + } + } + } + } + + List listnew = new ArrayList(); + Iterator var21 = list.iterator(); + + while (var21.hasNext()) { + User user1 = (User)var21.next(); + if (!listnew.contains(user1)) { + listnew.add(user1); + } + } + return JsonUtils.toJson(listnew); + } + } diff --git a/src/main/java/com/keyware/htey/entity/department/Department.java b/src/main/java/com/keyware/htey/entity/department/Department.java index f447451..f82a86d 100644 --- a/src/main/java/com/keyware/htey/entity/department/Department.java +++ b/src/main/java/com/keyware/htey/entity/department/Department.java @@ -34,6 +34,14 @@ public class Department implements Serializable { @TableField(exist = false) private String parentName; @TableField(exist = false) + private String chargeName; + @TableField(exist = false) + private String interfacePersonName; + @TableField(exist = false) + private String superLeaderName; + @TableField(exist = false) + private String managerName; + @TableField(exist = false) private int pageNum; @TableField(exist = false) private int pageSize; diff --git a/src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java b/src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java index f9f2eaf..baf35d7 100644 --- a/src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java +++ b/src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java @@ -24,4 +24,12 @@ public interface DepartmentMapper extends BaseMapper { List selectByDeparmentInfo(Department var1); List selectByparentId(@Param("parentId") String var1, @Param("projectSource") String var2); + + List selectByDeparmentInfoSelect(Department var1); + + int insertSelective(Department var1); + + int updateByPrimaryKeySelective(Department record); + + int deleteByPrimaryKey(List listId); } diff --git a/src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java b/src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java index 033cad0..35c7abd 100644 --- a/src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java +++ b/src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java @@ -56,4 +56,6 @@ public interface UserMapper extends BaseMapper { List selectAllLogin(@Param("list") List var1, @Param("userNameForSerch") String var2, @Param("userName") int userName, @Param("pageNum") int pageNum); + + int updateByPrimaryKeySelective(User var1); } diff --git a/src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java b/src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java index cf3fcfb..ef39296 100644 --- a/src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java +++ b/src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java @@ -66,4 +66,24 @@ public class DepartmentServiceImpl extends ServiceImpl selectByDeparmentInfoSelect(Department departmentSelect) { + return this.departmentMapper.selectByDeparmentInfoSelect(departmentSelect); + } + + @Override + public int insertSelective(Department record) { + record.setProjectSource(Constant.projectName); + return this.departmentMapper.insertSelective(record); + } + @Override + public int updateByPrimaryKeySelective(Department record) { + return departmentMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int deleteByPrimaryKey(List listId) { + return departmentMapper.deleteByPrimaryKey(listId); + } } diff --git a/src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java b/src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java index ae9f42d..d513287 100644 --- a/src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java +++ b/src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java @@ -133,4 +133,9 @@ public class UserServiceImpl extends ServiceImpl implements Us return this.userMapper.selectAllLogin(list, userNameForSerch, userName, pageNum); } + @Override + public int updateByPrimaryKeySelective(User record) { + return this.userMapper.updateByPrimaryKeySelective(record); + } + } diff --git a/src/main/java/com/keyware/htey/service/itf/DepartmentService.java b/src/main/java/com/keyware/htey/service/itf/DepartmentService.java index cd160bd..7b2f035 100644 --- a/src/main/java/com/keyware/htey/service/itf/DepartmentService.java +++ b/src/main/java/com/keyware/htey/service/itf/DepartmentService.java @@ -16,4 +16,12 @@ public interface DepartmentService extends IService { List selectByDeparmentInfo(Department var1); HashSet selectByparentId(String var1); + + List selectByDeparmentInfoSelect(Department var1); + + int insertSelective(Department var1); + + int updateByPrimaryKeySelective(Department record); + + int deleteByPrimaryKey(List listId); } diff --git a/src/main/java/com/keyware/htey/service/itf/UserService.java b/src/main/java/com/keyware/htey/service/itf/UserService.java index f97ebc4..dd451b8 100644 --- a/src/main/java/com/keyware/htey/service/itf/UserService.java +++ b/src/main/java/com/keyware/htey/service/itf/UserService.java @@ -50,4 +50,6 @@ public interface UserService extends IService { List selectAllLogin(List var1, String var2, @Param("userName") int userName, @Param("pageNum") int pageNum); + + int updateByPrimaryKeySelective(User var1); } diff --git a/src/main/java/com/keyware/htey/utli/IdComposeListUtil.java b/src/main/java/com/keyware/htey/utli/IdComposeListUtil.java index cb91e6a..b8be266 100644 --- a/src/main/java/com/keyware/htey/utli/IdComposeListUtil.java +++ b/src/main/java/com/keyware/htey/utli/IdComposeListUtil.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import com.keyware.htey.entity.department.Department; import com.keyware.htey.entity.user.User; /** @@ -13,17 +14,27 @@ import com.keyware.htey.entity.user.User; * @date 2025/1/13 17:15 */ public class IdComposeListUtil { - public static List listId(List userList) { - String userIds = stringId(userList); + public static List listUserId(List userList) { + String userIds = stringUserId(userList); + return Arrays.asList(userIds.split(",")); + } + public static List listDepartmentId(List departmentList) { + String userIds = stringDepartmentListId(departmentList); return Arrays.asList(userIds.split(",")); } - public static String stringId(List userList) { + public static String stringUserId(List userList) { return userList.stream() .map(User::getId) .map(String::valueOf) // 将ID转换为字符串 .collect(Collectors.joining(", ")); // 使用逗号分隔 } + public static String stringDepartmentListId(List userList) { + return userList.stream() + .map(Department::getId) + .map(String::valueOf) // 将ID转换为字符串 + .collect(Collectors.joining(", ")); // 使用逗号分隔 + } public static List listId(String Ids) { return Arrays.asList(Ids.split(",")); diff --git a/src/main/resources/mapper/DepartmentMapper.xml b/src/main/resources/mapper/DepartmentMapper.xml index 00018f6..f7444f8 100644 --- a/src/main/resources/mapper/DepartmentMapper.xml +++ b/src/main/resources/mapper/DepartmentMapper.xml @@ -79,7 +79,184 @@ select from DEPARTMENT - where PARENT_ID = #{parentId} - and PROJECT_SOURCE=#{projectSource} + where PROJECT_SOURCE=#{projectSource} + + and PARENT_ID = #{parentId} + + + and PARENT_ID = #{parentId} + + + + + + insert into DEPARTMENT + + + ID, + + + DEPT_NAME, + + + PARENT_ID, + + + ORDER_NO, + + + COMMENTS, + + + DEPT_CREATE_TIME, + + + DEPT_NUMBER, + + + MANAGER, + + + TOTAL_WORKERS, + + + SUPER_LEADER, + + + INTERFACE_PERSON, + + + DEPART_ABBREVIA, + + + CHARGE, + + + IS_SYS, + + + PROJECT_SOURCE, + + + + + #{id,jdbcType=VARCHAR}, + + + #{deptName,jdbcType=VARCHAR}, + + + #{parentId,jdbcType=VARCHAR}, + + + #{orderNo,jdbcType=DECIMAL}, + + + #{comments,jdbcType=VARCHAR}, + + + #{deptCreateTime,jdbcType=VARCHAR}, + + + #{deptNumber,jdbcType=VARCHAR}, + + + #{manager,jdbcType=VARCHAR}, + + + #{totalWorkers,jdbcType=DECIMAL}, + + + #{superLeader,jdbcType=VARCHAR}, + + + #{interfacePerson,jdbcType=VARCHAR}, + + + #{departAbbrevia,jdbcType=VARCHAR}, + + + #{charge,jdbcType=VARCHAR}, + + + #{isSys,jdbcType=VARCHAR}, + + + #{projectSource,jdbcType=VARCHAR}, + + + + + update DEPARTMENT + + + DEPT_NAME = #{deptName,jdbcType=VARCHAR}, + + + PARENT_ID = #{parentId,jdbcType=VARCHAR}, + + + ORDER_NO = #{orderNo,jdbcType=DECIMAL}, + + + COMMENTS = #{comments,jdbcType=VARCHAR}, + + + DEPT_CREATE_TIME = #{deptCreateTime,jdbcType=VARCHAR}, + + + DEPT_NUMBER = #{deptNumber,jdbcType=VARCHAR}, + + + MANAGER = #{manager,jdbcType=VARCHAR}, + + + TOTAL_WORKERS = #{totalWorkers,jdbcType=DECIMAL}, + + + SUPER_LEADER = #{superLeader,jdbcType=VARCHAR}, + + + INTERFACE_PERSON = #{interfacePerson,jdbcType=VARCHAR}, + + + DEPART_ABBREVIA = #{departAbbrevia,jdbcType=VARCHAR}, + + + CHARGE = #{charge,jdbcType=VARCHAR}, + + + IS_SYS = #{isSys,jdbcType=VARCHAR}, + + + PROJECT_SOURCE = #{projectSource,jdbcType=VARCHAR}, + + + where ID = #{id,jdbcType=VARCHAR} + + + delete from DEPARTMENT + where ID in + + #{item} + + diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index 48a949a..4921ce6 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -111,7 +111,11 @@ and K_USER.USER_NUMBER = #{user.userNumber,jdbcType=VARCHAR} - LIMIT #{user.pageNum},#{user.pageSize} + + LIMIT #{user.pageNum},#{user.pageSize} + + order by SORT asc @@ -604,7 +608,7 @@ - select K_USER.ID, K_USER.USER_ID, @@ -625,15 +629,66 @@ DEPARTMENT.DEPT_NAME from K_USER left join DEPARTMENT on K_USER.DEPART_ID = DEPARTMENT.ID - where 1=1 + where 1=1 and (K_USER.USER_NAME like '%'||#{userNameForSerch,jdbcType=VARCHAR}||'%' ) - and K_USER.ID in - #{item} - LIMIT #{pageNum},#{pageSize} - + and K_USER.ID in + + #{item} + LIMIT #{pageNum},#{pageSize} + + + + update K_USER + + + USER_ID = #{userId,jdbcType=VARCHAR}, + + + USER_NAME = #{userName,jdbcType=VARCHAR}, + + + PASSWORD = #{password,jdbcType=VARCHAR}, + + + DEPART_ID = #{departId,jdbcType=VARCHAR}, + + + USER_CREATION_TIME = #{userCreationTime,jdbcType=VARCHAR}, + + + USER_PWD_MODIF_TIME = #{userPwdModifTime,jdbcType=VARCHAR}, + + + USER_STATUS = #{userStatus,jdbcType=DECIMAL}, + + + USER_LOCK = #{userLock,jdbcType=DECIMAL}, + + + USER_PWD_ERROR = #{userPwdError,jdbcType=DECIMAL}, + + + USER_PWD_ERROR_DATE = #{userPwdErrorDate,jdbcType=VARCHAR}, + + + LOGOUT_TIME = #{logoutTime,jdbcType=VARCHAR}, + + + UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR}, + + + UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR}, + + + IMG_DATA = #{imgData,jdbcType=VARCHAR}, + + + where ID = #{id,jdbcType=VARCHAR} + +