diff --git a/src/main/java/com/ydool/integrated/controller/MeetingController.java b/src/main/java/com/ydool/integrated/controller/MeetingController.java index 51696d4..a1161e7 100644 --- a/src/main/java/com/ydool/integrated/controller/MeetingController.java +++ b/src/main/java/com/ydool/integrated/controller/MeetingController.java @@ -142,4 +142,10 @@ public class MeetingController extends BaseController { public AjaxResult vote(@Validated @RequestBody MeetingUserVo vo) { return meetingService.vote(vo); } + + @GetMapping("/user") + @ApiOperation(value = "关联人员") + public AjaxResult user() { + return meetingService.user(); + } } diff --git a/src/main/java/com/ydool/integrated/service/MeetingService.java b/src/main/java/com/ydool/integrated/service/MeetingService.java index c43464f..cdcd137 100644 --- a/src/main/java/com/ydool/integrated/service/MeetingService.java +++ b/src/main/java/com/ydool/integrated/service/MeetingService.java @@ -17,6 +17,8 @@ import com.ydool.integrated.vo.MeetingVo; import com.ydool.integrated.wrapper.MeetingWrapper; import com.ydool.oa.workFlow.data.entity.WorkFlowNotice; import com.ydool.oa.workFlow.service.WorkFlowNoticeService; +import com.ydool.system.entity.User; +import com.ydool.system.service.impl.UserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -40,6 +42,9 @@ public class MeetingService extends BaseService { @Autowired private WorkFlowNoticeService workFlowNoticeService; + @Autowired + private UserServiceImpl userService; + /** * 校验 * @@ -236,5 +241,12 @@ public class MeetingService extends BaseService { return AjaxResult.ok().data(MeetingWrapper.INSTANCE.toDto(pageList)); } + public AjaxResult user() { + List userList = userService.list(new QueryWrapper() + .lambda() + .in(User::getUserName, "沈佳峰", "屠勇", "王焕", "朱宗华", "王孟卓") + ); + return AjaxResult.ok().data(userList); + } } diff --git a/src/main/java/com/ydool/system/controller/UserController.java b/src/main/java/com/ydool/system/controller/UserController.java index d65b2d2..8f054e8 100644 --- a/src/main/java/com/ydool/system/controller/UserController.java +++ b/src/main/java/com/ydool/system/controller/UserController.java @@ -13,6 +13,7 @@ import com.ydool.system.request.ImageRequest; import com.ydool.system.request.UserRequest; import com.ydool.system.request.UserRolesRequest; import com.ydool.system.service.IUserService; +import com.ydool.system.vo.UserVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -203,4 +204,10 @@ public class UserController extends BaseController { public AjaxResult editImage(@RequestBody @Validated ImageRequest imageRequest) { return userService.editImage(imageRequest); } + + @PostMapping(value = "/user") + @ApiOperation(value = "关联人员") + public AjaxResult user(@RequestBody @Validated UserVo userVo) { + return userService.user(userVo); + } } diff --git a/src/main/java/com/ydool/system/service/IUserService.java b/src/main/java/com/ydool/system/service/IUserService.java index 82c0313..065cd6f 100644 --- a/src/main/java/com/ydool/system/service/IUserService.java +++ b/src/main/java/com/ydool/system/service/IUserService.java @@ -8,6 +8,7 @@ import com.ydool.system.request.IdsRequest; import com.ydool.system.request.ImageRequest; import com.ydool.system.request.UserRequest; import com.ydool.system.request.UserRolesRequest; +import com.ydool.system.vo.UserVo; import java.util.List; @@ -134,5 +135,7 @@ public interface IUserService { * @return */ AjaxResult editImage(ImageRequest imageRequest); + + AjaxResult user(UserVo userVo); } diff --git a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java index 838d29d..f9d643d 100644 --- a/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/UserServiceImpl.java @@ -28,6 +28,7 @@ import com.ydool.system.request.ImageRequest; import com.ydool.system.request.UserRequest; import com.ydool.system.request.UserRolesRequest; import com.ydool.system.service.IUserService; +import com.ydool.system.vo.UserVo; import com.ydool.system.wrapper.UserWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -429,6 +430,31 @@ public class UserServiceImpl extends BaseService implements IU return flag ? AjaxResult.ok().msg("更换头像成功") : AjaxResult.fail("更换头像失败"); } + @Override + public AjaxResult user(UserVo userVo) { + String value = userVo.getValue(); + String job = userVo.getJob(); + MPJQueryWrapper qw = new MPJQueryWrapper(); + qw.selectAll(User.class).leftJoin("t_sys_dept dept on dept.id = t.dept"); + if (StrUtil.isNotBlank(value)) { + qw.and(query -> + query.like("AES_DECRYPT(from_base64 (t.phone),'" + CodecUtils.KEY + "')", value).lambda() + .or().like(User::getLoginName, value) + .or().like(User::getRemarks, value) + .or().like(User::getUserName, value)); + } + + qw.lambda() + .in(CollUtil.isNotEmpty(userVo.getDeptIds()), User::getDept, userVo.getDeptIds()) + .eq(StrUtil.isNotBlank(job), User::getJob, job); + qw.orderByAsc("dept.sort_no"); + + + Page pageList = page(new Page<>(userVo.getCurrent(), userVo.getSize()), qw); + + return AjaxResult.ok().data(UserWrapper.INSTANCE.toDto(pageList)); + } + /** * 校验用户 diff --git a/src/main/java/com/ydool/system/vo/UserVo.java b/src/main/java/com/ydool/system/vo/UserVo.java new file mode 100644 index 0000000..5e09c18 --- /dev/null +++ b/src/main/java/com/ydool/system/vo/UserVo.java @@ -0,0 +1,21 @@ +package com.ydool.system.vo; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +import java.util.List; + +@Data +public class UserVo { + @ApiModelProperty(value = "当前页") + private Integer current; + @ApiModelProperty(value = "每页条数") + private Integer size; + @ApiModelProperty(value = "部门") + private List deptIds; + @ApiModelProperty(value = "岗位") + private String job; + @ApiModelProperty(value = "搜索框中的内容(只支持字符串类型)") + private String value; +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9cebcdf..4b24fad 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,7 +16,7 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource - url: jdbc:mysql://192.168.2.57:3306/lc_oa?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF8&autoReconnect=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/lc_oa?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF8&autoReconnect=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: root password: Wang09211108 druid: