daijiajun 部门管理中修改部门,查询部门,删除部门

main
admin 3 days ago
parent 51328c28cd
commit 30db383f01
  1. 239
      src/main/java/com/keyware/htey/controller/Department/DepartmentController.java
  2. 2
      src/main/java/com/keyware/htey/controller/project/ProjectKtController.java
  3. 157
      src/main/java/com/keyware/htey/controller/user/UserController.java
  4. 8
      src/main/java/com/keyware/htey/entity/department/Department.java
  5. 8
      src/main/java/com/keyware/htey/mybatis/itf/DepartmentMapper.java
  6. 2
      src/main/java/com/keyware/htey/mybatis/itf/UserMapper.java
  7. 20
      src/main/java/com/keyware/htey/service/impl/DepartmentServiceImpl.java
  8. 5
      src/main/java/com/keyware/htey/service/impl/UserServiceImpl.java
  9. 8
      src/main/java/com/keyware/htey/service/itf/DepartmentService.java
  10. 2
      src/main/java/com/keyware/htey/service/itf/UserService.java
  11. 17
      src/main/java/com/keyware/htey/utli/IdComposeListUtil.java
  12. 181
      src/main/resources/mapper/DepartmentMapper.xml
  13. 59
      src/main/resources/mapper/UserMapper.xml

@ -5,9 +5,15 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.keyware.htey.entity.department.Department; import com.keyware.htey.entity.department.Department;
import com.keyware.htey.entity.user.AuditLog; 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.AuditLogService;
import com.keyware.htey.service.itf.DepartmentService; 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.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 com.keyware.htey.utli.JsonUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse; 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -38,6 +46,8 @@ public class DepartmentController {
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private AuditLogService auditLogService; private AuditLogService auditLogService;
@Autowired
private UserService userService;
@GetMapping("/selectById") @GetMapping("/selectById")
@ResponseBody @ResponseBody
@ -107,7 +117,7 @@ public class DepartmentController {
@ResponseBody @ResponseBody
@Operation(summary = "查询部门父节点信息", description = "返回部门父节点信息") @Operation(summary = "查询部门父节点信息", description = "返回部门父节点信息")
@ApiResponse(responseCode = "200", 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 = ""; String isSys = "";
//if ("sysadmin".equals(this.getUser_idFormSession("userId"))) { //if ("sysadmin".equals(this.getUser_idFormSession("userId"))) {
// isSys = "sysadmin"; // isSys = "sysadmin";
@ -168,4 +178,231 @@ public class DepartmentController {
auditLogService.addAuditLog(auditLog); auditLogService.addAuditLog(auditLog);
return departmentList; 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<Department> 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<Department> 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<Department> 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<Department> departments) {
List<String> 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 "删除成功";
}
} }

@ -150,13 +150,11 @@ public class ProjectKtController {
list.addAll(users); list.addAll(users);
} else if (!"".equals(source)) { } else if (!"".equals(source)) {
user.setDepartId(departId); user.setDepartId(departId);
// users = this.userService.selectByUserInfo17suo(user);
users = userService.selectByUser(user); users = userService.selectByUser(user);
list.addAll(users); list.addAll(users);
} else { } else {
selectByparentId = this.departmentService.selectByparentId(departId); selectByparentId = this.departmentService.selectByparentId(departId);
user.setDepartId(departId); user.setDepartId(departId);
// users = this.userService.selectByUserInfo17suo(user);
users = userService.selectByUser(user); users = userService.selectByUser(user);
list.addAll(users); list.addAll(users);
userIterator = selectByparentId.iterator(); userIterator = selectByparentId.iterator();

@ -6,6 +6,7 @@ import java.util.Base64;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; 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 io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.session.Session; import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionDAO; import org.apache.shiro.session.mgt.eis.SessionDAO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -279,7 +279,7 @@ public class UserController {
return "当前版本只允许新建" + Constant.userCount + "个用户"; return "当前版本只允许新建" + Constant.userCount + "个用户";
} }
} }
this.userService.recovery(IdComposeListUtil.listId(users)); this.userService.recovery(IdComposeListUtil.listUserId(users));
userNames = ""; userNames = "";
for (User user : users) { for (User user : users) {
User u = this.userService.selectByPrimaryKey(user.getId()); User u = this.userService.selectByPrimaryKey(user.getId());
@ -322,7 +322,7 @@ public class UserController {
@Operation(summary = "用户解锁", description = "返回用户解锁信息") @Operation(summary = "用户解锁", description = "返回用户解锁信息")
@ApiResponse(responseCode = "200", description = "成功用户解锁信息") @ApiResponse(responseCode = "200", description = "成功用户解锁信息")
public String updateLock(@RequestBody List<User> users) { public String updateLock(@RequestBody List<User> users) {
List<String> listId = IdComposeListUtil.listId(users); List<String> listId = IdComposeListUtil.listUserId(users);
userService.unlock(listId); userService.unlock(listId);
String userNames = ""; String userNames = "";
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
@ -424,7 +424,7 @@ public class UserController {
@ApiResponse(responseCode = "200", description = "成功删除用户信息") @ApiResponse(responseCode = "200", description = "成功删除用户信息")
public String deleteUser(@RequestBody List<User> users) { public String deleteUser(@RequestBody List<User> users) {
try { try {
List<String> listId = IdComposeListUtil.listId(users); List<String> listId = IdComposeListUtil.listUserId(users);
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
String userNames = ""; String userNames = "";
for (User user : users) { for (User user : users) {
@ -920,4 +920,153 @@ public class UserController {
} }
return userList; 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<User> 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);
}
} }

@ -34,6 +34,14 @@ public class Department implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String parentName; private String parentName;
@TableField(exist = false) @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; private int pageNum;
@TableField(exist = false) @TableField(exist = false)
private int pageSize; private int pageSize;

@ -24,4 +24,12 @@ public interface DepartmentMapper extends BaseMapper<Department> {
List<Department> selectByDeparmentInfo(Department var1); List<Department> selectByDeparmentInfo(Department var1);
List<Department> selectByparentId(@Param("parentId") String var1, @Param("projectSource") String var2); List<Department> selectByparentId(@Param("parentId") String var1, @Param("projectSource") String var2);
List<Department> selectByDeparmentInfoSelect(Department var1);
int insertSelective(Department var1);
int updateByPrimaryKeySelective(Department record);
int deleteByPrimaryKey(List listId);
} }

@ -56,4 +56,6 @@ public interface UserMapper extends BaseMapper<User> {
List<User> selectAllLogin(@Param("list") List<String> var1, @Param("userNameForSerch") String var2, List<User> selectAllLogin(@Param("list") List<String> var1, @Param("userNameForSerch") String var2,
@Param("userName") int userName, @Param("pageNum") int pageNum); @Param("userName") int userName, @Param("pageNum") int pageNum);
int updateByPrimaryKeySelective(User var1);
} }

@ -66,4 +66,24 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
return hashSet; return hashSet;
} }
} }
@Override
public List<Department> 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);
}
} }

@ -133,4 +133,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
return this.userMapper.selectAllLogin(list, userNameForSerch, userName, pageNum); return this.userMapper.selectAllLogin(list, userNameForSerch, userName, pageNum);
} }
@Override
public int updateByPrimaryKeySelective(User record) {
return this.userMapper.updateByPrimaryKeySelective(record);
}
} }

@ -16,4 +16,12 @@ public interface DepartmentService extends IService<Department> {
List<Department> selectByDeparmentInfo(Department var1); List<Department> selectByDeparmentInfo(Department var1);
HashSet<String> selectByparentId(String var1); HashSet<String> selectByparentId(String var1);
List<Department> selectByDeparmentInfoSelect(Department var1);
int insertSelective(Department var1);
int updateByPrimaryKeySelective(Department record);
int deleteByPrimaryKey(List listId);
} }

@ -50,4 +50,6 @@ public interface UserService extends IService<User> {
List<User> selectAllLogin(List<String> var1, String var2, @Param("userName") int userName, List<User> selectAllLogin(List<String> var1, String var2, @Param("userName") int userName,
@Param("pageNum") int pageNum); @Param("pageNum") int pageNum);
int updateByPrimaryKeySelective(User var1);
} }

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.keyware.htey.entity.department.Department;
import com.keyware.htey.entity.user.User; import com.keyware.htey.entity.user.User;
/** /**
@ -13,17 +14,27 @@ import com.keyware.htey.entity.user.User;
* @date 2025/1/13 17:15 * @date 2025/1/13 17:15
*/ */
public class IdComposeListUtil { public class IdComposeListUtil {
public static List<String> listId(List<User> userList) { public static List<String> listUserId(List<User> userList) {
String userIds = stringId(userList); String userIds = stringUserId(userList);
return Arrays.asList(userIds.split(","));
}
public static List<String> listDepartmentId(List<Department> departmentList) {
String userIds = stringDepartmentListId(departmentList);
return Arrays.asList(userIds.split(",")); return Arrays.asList(userIds.split(","));
} }
public static String stringId(List<User> userList) { public static String stringUserId(List<User> userList) {
return userList.stream() return userList.stream()
.map(User::getId) .map(User::getId)
.map(String::valueOf) // 将ID转换为字符串 .map(String::valueOf) // 将ID转换为字符串
.collect(Collectors.joining(", ")); // 使用逗号分隔 .collect(Collectors.joining(", ")); // 使用逗号分隔
} }
public static String stringDepartmentListId(List<Department> userList) {
return userList.stream()
.map(Department::getId)
.map(String::valueOf) // 将ID转换为字符串
.collect(Collectors.joining(", ")); // 使用逗号分隔
}
public static List<String> listId(String Ids) { public static List<String> listId(String Ids) {
return Arrays.asList(Ids.split(",")); return Arrays.asList(Ids.split(","));

@ -79,7 +79,184 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from DEPARTMENT from DEPARTMENT
where PARENT_ID = #{parentId} where PROJECT_SOURCE=#{projectSource}
and PROJECT_SOURCE=#{projectSource} <if test="parentId != null and parentId != ''">
and PARENT_ID = #{parentId}
</if>
<if test="parentId == null and parentId == ''">
and PARENT_ID = #{parentId}
</if>
</select>
<select id="selectByDeparmentInfoSelect" parameterType="com.keyware.htey.entity.department.Department"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from DEPARTMENT
where 1=1
<if test="isSys != 'sysadmin'">
and IS_SYS = '0'
</if>
<if test="deptName != null and deptName != ''">
and DEPT_NAME = #{deptName,jdbcType=VARCHAR}
</if>
<if test="deptNumber != null and deptNumber != ''">
and DEPT_NUMBER = #{deptNumber,jdbcType=VARCHAR}
</if>
order by DEPT_CREATE_TIME DESC
</select> </select>
<insert id="insertSelective" parameterType="com.keyware.htey.entity.department.Department">
insert into DEPARTMENT
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="deptName != null">
DEPT_NAME,
</if>
<if test="parentId != null">
PARENT_ID,
</if>
<if test="orderNo != null">
ORDER_NO,
</if>
<if test="comments != null">
COMMENTS,
</if>
<if test="deptCreateTime != null">
DEPT_CREATE_TIME,
</if>
<if test="deptNumber != null">
DEPT_NUMBER,
</if>
<if test="manager != null">
MANAGER,
</if>
<if test="totalWorkers != null">
TOTAL_WORKERS,
</if>
<if test="superLeader != null">
SUPER_LEADER,
</if>
<if test="interfacePerson != null">
INTERFACE_PERSON,
</if>
<if test="departAbbrevia != null">
DEPART_ABBREVIA,
</if>
<if test="charge != null">
CHARGE,
</if>
<if test="isSys != null">
IS_SYS,
</if>
<if test="projectSource != null">
PROJECT_SOURCE,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="deptName != null">
#{deptName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="orderNo != null">
#{orderNo,jdbcType=DECIMAL},
</if>
<if test="comments != null">
#{comments,jdbcType=VARCHAR},
</if>
<if test="deptCreateTime != null">
#{deptCreateTime,jdbcType=VARCHAR},
</if>
<if test="deptNumber != null">
#{deptNumber,jdbcType=VARCHAR},
</if>
<if test="manager != null">
#{manager,jdbcType=VARCHAR},
</if>
<if test="totalWorkers != null">
#{totalWorkers,jdbcType=DECIMAL},
</if>
<if test="superLeader != null">
#{superLeader,jdbcType=VARCHAR},
</if>
<if test="interfacePerson != null">
#{interfacePerson,jdbcType=VARCHAR},
</if>
<if test="departAbbrevia != null">
#{departAbbrevia,jdbcType=VARCHAR},
</if>
<if test="charge != null">
#{charge,jdbcType=VARCHAR},
</if>
<if test="isSys != null">
#{isSys,jdbcType=VARCHAR},
</if>
<if test="projectSource != null">
#{projectSource,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.keyware.htey.entity.department.Department">
update DEPARTMENT
<set>
<if test="deptName != null">
DEPT_NAME = #{deptName,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
PARENT_ID = #{parentId,jdbcType=VARCHAR},
</if>
<if test="orderNo != null">
ORDER_NO = #{orderNo,jdbcType=DECIMAL},
</if>
<if test="comments != null">
COMMENTS = #{comments,jdbcType=VARCHAR},
</if>
<if test="deptCreateTime != null">
DEPT_CREATE_TIME = #{deptCreateTime,jdbcType=VARCHAR},
</if>
<if test="deptNumber != null">
DEPT_NUMBER = #{deptNumber,jdbcType=VARCHAR},
</if>
<if test="manager != null">
MANAGER = #{manager,jdbcType=VARCHAR},
</if>
<if test="totalWorkers != null">
TOTAL_WORKERS = #{totalWorkers,jdbcType=DECIMAL},
</if>
<if test="superLeader != null">
SUPER_LEADER = #{superLeader,jdbcType=VARCHAR},
</if>
<if test="interfacePerson != null">
INTERFACE_PERSON = #{interfacePerson,jdbcType=VARCHAR},
</if>
<if test="departAbbrevia != null">
DEPART_ABBREVIA = #{departAbbrevia,jdbcType=VARCHAR},
</if>
<if test="charge != null">
CHARGE = #{charge,jdbcType=VARCHAR},
</if>
<if test="isSys != null">
IS_SYS = #{isSys,jdbcType=VARCHAR},
</if>
<if test="projectSource != null">
PROJECT_SOURCE = #{projectSource,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from DEPARTMENT
where ID in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper> </mapper>

@ -111,7 +111,11 @@
<if test="user.userNumber != null and user.userNumber != ''"> <if test="user.userNumber != null and user.userNumber != ''">
and K_USER.USER_NUMBER = #{user.userNumber,jdbcType=VARCHAR} and K_USER.USER_NUMBER = #{user.userNumber,jdbcType=VARCHAR}
</if> </if>
<if test="user.pageNum != null and user.pageNum != ''
and user.pageSize != null and user.pageSize != ''">
LIMIT #{user.pageNum},#{user.pageSize} LIMIT #{user.pageNum},#{user.pageSize}
</if>
order by SORT asc order by SORT asc
</select> </select>
@ -604,7 +608,7 @@
</if> </if>
</select> </select>
<select id="selectAllLogin" parameterType="java.lang.String" resultMap="BaseResultMap" > <select id="selectAllLogin" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
K_USER.ID, K_USER.ID,
K_USER.USER_ID, K_USER.USER_ID,
@ -629,11 +633,62 @@
<if test="userNameForSerch != null and userNameForSerch != ''"> <if test="userNameForSerch != null and userNameForSerch != ''">
and (K_USER.USER_NAME like '%'||#{userNameForSerch,jdbcType=VARCHAR}||'%' ) and (K_USER.USER_NAME like '%'||#{userNameForSerch,jdbcType=VARCHAR}||'%' )
</if> </if>
and K_USER.ID in <foreach item="item" index="index" collection="list" and K_USER.ID in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{item} #{item}
LIMIT #{pageNum},#{pageSize} LIMIT #{pageNum},#{pageSize}
</foreach> </foreach>
</select> </select>
<update id="updateByPrimaryKeySelective" parameterType="com.keyware.htey.entity.user.User">
update K_USER
<set>
<if test="userId != null">
USER_ID = #{userId,jdbcType=VARCHAR},
</if>
<if test="userName != null">
USER_NAME = #{userName,jdbcType=VARCHAR},
</if>
<if test="password != null">
PASSWORD = #{password,jdbcType=VARCHAR},
</if>
<if test="departId != null">
DEPART_ID = #{departId,jdbcType=VARCHAR},
</if>
<if test="userCreationTime != null">
USER_CREATION_TIME = #{userCreationTime,jdbcType=VARCHAR},
</if>
<if test="userPwdModifTime != null">
USER_PWD_MODIF_TIME = #{userPwdModifTime,jdbcType=VARCHAR},
</if>
<if test="userStatus != null">
USER_STATUS = #{userStatus,jdbcType=DECIMAL},
</if>
<if test="userLock != null">
USER_LOCK = #{userLock,jdbcType=DECIMAL},
</if>
<if test="userPwdError != null">
USER_PWD_ERROR = #{userPwdError,jdbcType=DECIMAL},
</if>
<if test="userPwdErrorDate != null">
USER_PWD_ERROR_DATE = #{userPwdErrorDate,jdbcType=VARCHAR},
</if>
<if test="logoutTime != null">
LOGOUT_TIME = #{logoutTime,jdbcType=VARCHAR},
</if>
<if test="uesrRankId != null">
UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR},
</if>
<if test="uesrRankId != null">
UESR_RANK_ID = #{uesrRankId,jdbcType=VARCHAR},
</if>
<if test="imgData != null">
IMG_DATA = #{imgData,jdbcType=VARCHAR},
</if>
</set>
where ID = #{id,jdbcType=VARCHAR}
</update>
</mapper> </mapper>

Loading…
Cancel
Save