| | |
| | | |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | */ |
| | | @RequiresPermissions("system:dept:list") |
| | | @GetMapping("/list") |
| | | @ApiOperation("获取部门列表") |
| | | public AjaxResult list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | @RequiresPermissions("system:dept:list") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return success(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @RequiresPermissions("system:dept:query") |
| | | @GetMapping(value = "/{deptId}") |
| | | @ApiOperation("根据部门编号获取详细信息") |
| | | public AjaxResult getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | |
| | | * 新增部门 |
| | | */ |
| | | @RequiresPermissions("system:dept:add") |
| | | @ApiOperation("新增部门") |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(deptService.insertDept(dept)); |
| | | } |
| | |
| | | */ |
| | | @RequiresPermissions("system:dept:edit") |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改部门") |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return error("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(deptService.updateDept(dept)); |
| | | } |
| | |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return warn("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return warn("部门存在用户,不允许删除"); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.query.SysOperLogQuery; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/operlog") |
| | | @Api(tags = "操作日志记录") |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysOperLogService operLogService; |
| | | |
| | | // @RequiresPermissions("system:operlog:list") |
| | | // @GetMapping("/list") |
| | | // public TableDataInfo list(SysOperLog operLog) |
| | | // { |
| | | // startPage(); |
| | | // List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | // return getDataTable(list); |
| | | // } |
| | | |
| | | @ApiOperation(value = "当前车辆操作日志查询") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysOperLogQuery query) |
| | | @RequiresPermissions("system:operlog:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | LambdaQueryWrapper<SysOperLog> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.like(SysOperLog::getTitle,"车辆管理"); |
| | | wrapper.ne(SysOperLog::getBusinessType,1); |
| | | List<SysOperLog> list = operLogService.list(wrapper); |
| | | Iterator<SysOperLog> iterator = list.iterator(); |
| | | while (iterator.hasNext()){ |
| | | SysOperLog sysOperLog = iterator.next(); |
| | | String operParam = sysOperLog.getOperParam(); |
| | | JSONObject jsonObject = JSONObject.parseObject(operParam); |
| | | String carId = jsonObject.getString("carId"); |
| | | if(StringUtils.isNotEmpty(carId) && Objects.nonNull(query.getCarId()) && !carId.equals(String.valueOf(query.getCarId()))){ |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:operlog:export") |
| | | @PostMapping("/export") |
| | |
| | | public AjaxResult list(@Validated @RequestBody SysUserQuery query) { |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | PageInfo<SysUser> page = userService.getList(pageInfo, query.getNickName(), |
| | | query.getPhonenumber(), query.getStatus()); |
| | | query.getPhonenumber(), query.getStatus(),query.getDeptId()); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | |
| | | public AjaxResult add(@Validated(InsertGroup.class) @RequestBody SysUserDTO dto) { |
| | | SysUser user = BeanUtils.copyBean(dto, SysUser.class); |
| | | user.setUserId(null); |
| | | user.setUserType(dto.getIsAuctioneer() == 1 ? "03" : "00"); |
| | | user.setUserType("01"); |
| | | user.setUserName(user.getPhonenumber()); |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(1); |
| | | int i = userService.insertUser(user); |
| | | user.setDept(deptService.selectDeptById(dto.getDeptId())); |
| | | SysDept sysDept= deptService.selectDeptById(dto.getDeptId()); |
| | | user.setDeptName(sysDept.getDeptName()); |
| | | user.setDeptId(dto.getDeptId()); |
| | | SysRole byId = roleService.selectRoleById(dto.getRoleId()); |
| | | user.setRoleName(byId.getRoleName()); |
| | | user.setRoleId(dto.getRoleId()); |
| | | userService.save(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(dto.getRoleId()); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | ajax.put("Dept", deptService.selectDeptList(null)); |
| | | if (StringUtils.isNotNull(userId)) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | ajax.put(AjaxResult.DATA_TAG, sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | | ajax.put("Dept", sysUser.getDept()); |
| | | ajax.put("roleId", sysUser.getRoleId()); |
| | | ajax.put("roleName", sysUser.getRoleName()); |
| | | } |
| | | return AjaxResult.success(ajax); |
| | | } |
| | |
| | | user.setPassword(null); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | | return toAjax(userService.updateUser(user)); |
| | | user.setDept(deptService.selectDeptById(dto.getDeptId())); |
| | | SysDept sysDept= deptService.selectDeptById(dto.getDeptId()); |
| | | user.setDeptName(sysDept.getDeptName()); |
| | | user.setDeptId(dto.getDeptId()); |
| | | SysRole byId = roleService.selectRoleById(dto.getRoleId()); |
| | | user.setRoleName(byId.getRoleName()); |
| | | user.setRoleId(dto.getRoleId()); |
| | | return toAjax(userService.updateById(user)); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @param dto 供应商数据传输对象 |
| | | */ |
| | | @Log(title = "供应商管理", businessType = BusinessType.UPDATE) |
| | | @Log(title = "管理员", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "添加/编辑管理员", notes = "添加/编辑管理员") |
| | | @PostMapping("/save-conservator") |
| | | public R<?> saveConservator(@Validated @RequestBody ConservatorDTO dto) { |
| | |
| | | * |
| | | * @param id 供应商id |
| | | */ |
| | | @ApiOperation(value = "删除供应商", notes = "删除供应商") |
| | | @ApiOperation(value = "删除管理员", notes = "删除管理员") |
| | | @DeleteMapping("/delete-conservator/{id}") |
| | | public R<?> deleteConservator(@PathVariable("id") Long id) { |
| | | userService.deleteConservator(id); |
| | |
| | | @NotNull(message = "角色id不能为空") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty(value = "是否为拍卖师 1=否 2=是") |
| | | @NotNull(message = "是否为拍卖师不能为空") |
| | | private Integer isAuctioneer; |
| | | @ApiModelProperty(value = "所属部门") |
| | | @NotNull(message = "所属部门id不能为空") |
| | | private Long deptId; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("状态 0:正常 1:冻结") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("部門id") |
| | | private Long deptId; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public TreeSelect(SysDept dept) |
| | | { |
| | | this.id = dept.getDeptId(); |
| | | this.label = dept.getDeptName(); |
| | | this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public TreeSelect(SysMenu menu) |
| | | { |
| | |
| | | * @param parentId 父部门ID |
| | | * @return 结果 |
| | | */ |
| | | public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); |
| | | public SysDept checkDeptNameUnique(@Param("deptName") String deptName); |
| | | |
| | | /** |
| | | * 新增部门信息 |
| | |
| | | |
| | | PageInfo<SysUser> getList(@Param("pageInfo") PageInfo<SysUser> pageInfo, |
| | | @Param("nickName") String nickName, @Param("phonenumber") String phonenumber, |
| | | @Param("status") Integer status); |
| | | @Param("status") Integer status, @Param("deptId") Long deptId); |
| | | |
| | | PageInfo<SysUser> getAllList(@Param("pageInfo") PageInfo<SysUser> pageInfo, @Param("ids") List<Integer> collect); |
| | | |
| | |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | |
| | | PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickname, String phonenumber, |
| | | Integer status); |
| | | Integer status,Long deptId); |
| | | |
| | | |
| | | PageInfo<SysUser> getAllList(PageInfo<SysUser> pageInfo, List<Integer> collect); |
| | |
| | | return buildDeptTreeSelect(depts); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 构建前端所需要树结构 |
| | | * |
| | | * @param depts 部门列表 |
| | | * @return 树结构列表 |
| | | */ |
| | | @Override |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts) |
| | | { |
| | | List<SysDept> returnList = new ArrayList<SysDept>(); |
| | | List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); |
| | | for (SysDept dept : depts) |
| | | { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(dept.getParentId())) |
| | | { |
| | | recursionFn(depts, dept); |
| | | returnList.add(dept); |
| | | } |
| | | } |
| | | if (returnList.isEmpty()) |
| | | { |
| | | returnList = depts; |
| | | } |
| | | return returnList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 构建前端所需要下拉树结构 |
| | |
| | | * @param depts 部门列表 |
| | | * @return 下拉树结构列表 |
| | | */ |
| | | @Override |
| | | public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) |
| | | { |
| | | List<SysDept> deptTrees = buildDeptTree(depts); |
| | | return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色ID查询部门树信息 |
| | |
| | | public boolean checkDeptNameUnique(SysDept dept) |
| | | { |
| | | Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); |
| | | SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); |
| | | SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName()); |
| | | if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int insertDept(SysDept dept) { |
| | | int i = deptMapper.insertDept(dept); |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 新增保存部门信息 |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDept(SysDept dept) |
| | | { |
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId()); |
| | | // 如果父节点不为正常状态,则不允许新增子节点 |
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | { |
| | | throw new ServiceException("部门停用,不允许新增"); |
| | | } |
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); |
| | | return deptMapper.insertDept(dept); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改保存部门信息 |
| | |
| | | @Override |
| | | public int updateDept(SysDept dept) |
| | | { |
| | | SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); |
| | | SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) |
| | | { |
| | | String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); |
| | | String oldAncestors = oldDept.getAncestors(); |
| | | dept.setAncestors(newAncestors); |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | int result = deptMapper.updateDept(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) |
| | | { |
| | | // 如果该部门是启用状态,则启用该部门的所有上级部门 |
| | | updateParentDeptStatusNormal(dept); |
| | | } |
| | | return result; |
| | | |
| | | // 果该部门是启用状态,则启用该部门的所有上级部门 |
| | | int i = deptMapper.updateDept(dept); |
| | | |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 修改该部门的父级部门状态 |
| | | * |
| | | * @param dept 当前部门 |
| | | */ |
| | | private void updateParentDeptStatusNormal(SysDept dept) |
| | | { |
| | | String ancestors = dept.getAncestors(); |
| | | Long[] deptIds = Convert.toLongArray(ancestors); |
| | | deptMapper.updateDeptStatusNormal(deptIds); |
| | | } |
| | | |
| | | /** |
| | | * 修改子元素关系 |
| | | * |
| | | * @param deptId 被修改的部门ID |
| | | * @param newAncestors 新的父ID集合 |
| | | * @param oldAncestors 旧的父ID集合 |
| | | */ |
| | | public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) |
| | | { |
| | | List<SysDept> children = deptMapper.selectChildrenDeptById(deptId); |
| | | for (SysDept child : children) |
| | | { |
| | | child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); |
| | | } |
| | | if (children.size() > 0) |
| | | { |
| | | deptMapper.updateDeptChildren(children); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除部门管理信息 |
| | |
| | | return deptMapper.deleteDeptById(deptId); |
| | | } |
| | | |
| | | /** |
| | | * 递归列表 |
| | | */ |
| | | private void recursionFn(List<SysDept> list, SysDept t) |
| | | { |
| | | // 得到子节点列表 |
| | | List<SysDept> childList = getChildList(list, t); |
| | | t.setChildren(childList); |
| | | for (SysDept tChild : childList) |
| | | { |
| | | if (hasChild(list, tChild)) |
| | | { |
| | | recursionFn(list, tChild); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 得到子节点列表 |
| | | */ |
| | | private List<SysDept> getChildList(List<SysDept> list, SysDept t) |
| | | { |
| | | List<SysDept> tlist = new ArrayList<SysDept>(); |
| | | Iterator<SysDept> it = list.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | SysDept n = (SysDept) it.next(); |
| | | if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) |
| | | { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | | return tlist; |
| | | } |
| | | |
| | | /** |
| | | * 判断是否有子节点 |
| | | */ |
| | | private boolean hasChild(List<SysDept> list, SysDept t) |
| | | { |
| | | return getChildList(list, t).size() > 0 ? true : false; |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public PageInfo<SysUser> getList(PageInfo<SysUser> pageInfo, String nickName, |
| | | String phonenumber, Integer status) { |
| | | return this.baseMapper.getList(pageInfo, nickName, phonenumber, status); |
| | | String phonenumber, Integer status ,Long deptId) { |
| | | return this.baseMapper.getList(pageInfo, nickName, phonenumber, status,deptId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Page<SysUser> page = this.lambdaQuery() |
| | | .select(SysUser::getUserId, SysUser::getNickName, SysUser::getPhonenumber) |
| | | .like(StringUtils.isNotBlank(query.getNickName() |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "01") |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "02") |
| | | .eq(SysUser::getDelFlag, "0").orderByDesc(SysUser::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | |
| | | // 添加 |
| | | if (StringUtils.isNull(dto.getUserId())) { |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setUserType("01"); |
| | | user.setUserType("02"); |
| | | user.setCreateTime(new Date()); |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setContacts(dto.getContacts()); |
| | | this.save(user); |
| | | } else { |
| | | // 编辑 |
| | |
| | | user.setPhonenumber(dto.getPhonenumber()); |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setUpdateTime(new Date()); |
| | | user.setContacts(dto.getContacts()); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | this.updateById(user); |
| | | } |
| | |
| | | Page<SysUser> page = this.lambdaQuery() |
| | | .select(SysUser::getUserId, SysUser::getNickName, SysUser::getPhonenumber) |
| | | .like(StringUtils.isNotBlank(query.getNickName() |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "02") |
| | | .eq(SysUser::getPhonenumber,query.getPhonenumber()).eq(SysUser::getRoleType,query.getRoleType()) |
| | | ), SysUser::getNickName, query.getNickName()).eq(SysUser::getUserType, "03") |
| | | .eq(StringUtils.isNotBlank(query.getPhonenumber() |
| | | ),SysUser::getPhonenumber,query.getPhonenumber()) |
| | | .eq(SysUser::getDelFlag, "0").orderByDesc(SysUser::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | |
| | | if (StringUtils.isNull(dto.getUserId())) { |
| | | user.setNickName(dto.getNickName()); |
| | | user.setUserName(dto.getPhonenumber()); |
| | | user.setUserType("02"); |
| | | user.setUserType("03"); |
| | | user.setCreateTime(new Date()); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectDeptVo"> |
| | | select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time |
| | | select d.dept_id, d.dept_name, d.del_flag, d.create_by, d.create_time |
| | | from sys_dept d |
| | | </sql> |
| | | |
| | |
| | | <if test="deptId != null and deptId != 0"> |
| | | AND dept_id = #{deptId} |
| | | </if> |
| | | <if test="parentId != null and parentId != 0"> |
| | | AND parent_id = #{parentId} |
| | | </if> |
| | | <if test="deptName != null and deptName != ''"> |
| | | AND dept_name like concat('%', #{deptName}, '%') |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | order by d.parent_id, d.order_num |
| | | </select> |
| | | |
| | | <select id="selectDeptListByRoleId" resultType="Long"> |
| | |
| | | <insert id="insertDept" parameterType="com.ruoyi.system.api.domain.SysDept"> |
| | | insert into sys_dept( |
| | | <if test="deptId != null and deptId != 0">dept_id,</if> |
| | | <if test="parentId != null and parentId != 0">parent_id,</if> |
| | | <if test="deptName != null and deptName != ''">dept_name,</if> |
| | | <if test="ancestors != null and ancestors != ''">ancestors,</if> |
| | | <if test="orderNum != null">order_num,</if> |
| | | <if test="leader != null and leader != ''">leader,</if> |
| | | <if test="phone != null and phone != ''">phone,</if> |
| | | <if test="email != null and email != ''">email,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | | <if test="deptId != null and deptId != 0">#{deptId},</if> |
| | | <if test="parentId != null and parentId != 0">#{parentId},</if> |
| | | <if test="deptName != null and deptName != ''">#{deptName},</if> |
| | | <if test="ancestors != null and ancestors != ''">#{ancestors},</if> |
| | | <if test="orderNum != null">#{orderNum},</if> |
| | | <if test="leader != null and leader != ''">#{leader},</if> |
| | | <if test="phone != null and phone != ''">#{phone},</if> |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | |
| | | <update id="updateDept" parameterType="com.ruoyi.system.api.domain.SysDept"> |
| | | update sys_dept |
| | | <set> |
| | | <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if> |
| | | <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if> |
| | | <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if> |
| | | <if test="orderNum != null">order_num = #{orderNum},</if> |
| | | <if test="leader != null">leader = #{leader},</if> |
| | | <if test="phone != null">phone = #{phone},</if> |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select su.user_id userId,su.nick_name nickName,su.phonenumber,su.status,sr.role_name |
| | | roleName,sr.role_id roleId,case su.user_type when '01' then 2 |
| | | else 1 end as isAuctioneer |
| | | from |
| | | sys_user su left join sys_user_role sur on su.user_id = sur.user_id left join sys_role sr on |
| | | sr.role_id |
| | | = sur.role_id where 1=1 |
| | | SELECT |
| | | su.user_id userId, |
| | | su.nick_name nickName, |
| | | su.phonenumber, |
| | | su. STATUS, |
| | | sr.role_name roleName, |
| | | dp.dept_name deptName, |
| | | su.dept_id deptId, |
| | | sr.role_id roleId, |
| | | CASE su.user_type |
| | | WHEN '01' THEN |
| | | 2 |
| | | ELSE |
| | | 1 |
| | | END AS isAuctioneer |
| | | FROM |
| | | sys_user su |
| | | LEFT JOIN sys_user_role sur ON su.user_id = sur.user_id |
| | | LEFT JOIN sys_role sr ON sr.role_id = sur.role_id |
| | | LEFT JOIN sys_dept dp ON dp.dept_id = su.dept_id |
| | | where 1=1 |
| | | <if test="nickName !=null and nickName !=''"> |
| | | and su.nick_name like concat("%", #{nickName},"%") |
| | | </if> |
| | | <if test="phonenumber !=null and phonenumber !=''"> |
| | | and su.phonenumber like concat("%", #{phonenumber},"%") |
| | | </if> |
| | | <if test="deptId !=null and deptId !=''"> |
| | | and su.dept_id = #{deptId} |
| | | </if> |
| | | <if test="status !=null and status !=''"> |
| | | and su.status = #{status} |
| | | </if> |
| | | and su.del_flag = '0' and su.user_type in('00','01') |
| | | and su.del_flag = '0' and su.user_type in('00') |
| | | order by su.create_time desc |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |