16 files modified
1 files added
| | |
| | | @ApiOperation(value = "分页", notes = "传入notice") |
| | | public R<IPage<NoticeVO>> page(@ApiIgnore NoticeVO notice, Query query) { |
| | | //通过deptId获取组织机构信息 |
| | | Dept dept = iDeptService.getById(notice.getDeptId()); |
| | | // Dept dept = iDeptService.getById(notice.getDeptId()); |
| | | // if (dept.getDeptCategory() == 1) { |
| | | // notice.setCategory(1); |
| | | // } else { |
| | |
| | | <select id="selectNoticePage" resultMap="noticeVOResultMap"> |
| | | SELECT |
| | | n.*, |
| | | d.dict_value AS categoryName |
| | | d.dict_value AS categoryName, |
| | | bd.dept_name deptName |
| | | FROM |
| | | blade_notice n |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = n.dept_id |
| | | LEFT JOIN |
| | | ( SELECT * FROM blade_dict WHERE code = 'notice' ) d |
| | | ON |
| | |
| | | // 若不使用mybatis-plus自带的分页方法,则不会自动带入tenantId,所以我们需要自行注入 |
| | | notice.setTenantId(AuthUtil.getTenantId()); |
| | | List<NoticeVO> noticeVOS = baseMapper.selectNoticePage(page, notice); |
| | | noticeVOS.forEach(noticeVO -> { |
| | | noticeVO.setDeptName(deptService.getById(noticeVO.getDeptId()).getDeptName()); |
| | | }); |
| | | // noticeVOS.forEach(noticeVO -> { |
| | | // noticeVO.setDeptName(deptService.getById(noticeVO.getDeptId()).getDeptName()); |
| | | // }); |
| | | return page.setRecords(noticeVOS); |
| | | } |
| | | |
| | |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.exam.util.SecurityPaperUtil; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.system.entity.Role; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IRoleService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private final IUserService userService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | private final IRoleService roleService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | |
| | | result = pre + (decimalFormat.format(count++)); |
| | | } |
| | | user.setSecuritynumber(result); |
| | | //修改为持证保安 |
| | | user.setHold("1"); |
| | | //分配保安角色 |
| | | Role role = new Role(); |
| | | role.setRoleAlias("保安"); |
| | | Role oneRole = roleService.getOne(Condition.getQueryWrapper(role)); |
| | | user.setRoleId(oneRole.getId().toString()); |
| | | //更新保安数据 |
| | | userService.updateById(user); |
| | | } |
| | |
| | | import org.springblade.modules.exam.util.SecurityPaperUtil; |
| | | import org.springblade.modules.exam.vo.ExamResultVO; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.system.entity.Role; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IRoleService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | |
| | | private final ApplyService applyService; |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | private final IRoleService roleService; |
| | | |
| | | /** |
| | | * 自定义分页数据 |
| | |
| | | result = pre + (decimalFormat.format(count++)); |
| | | } |
| | | user.setSecuritynumber(result); |
| | | //修改为持证保安 |
| | | user.setHold("1"); |
| | | //分配保安角色 |
| | | Role role = new Role(); |
| | | role.setRoleAlias("保安"); |
| | | Role oneRole = roleService.getOne(Condition.getQueryWrapper(role)); |
| | | user.setRoleId(oneRole.getId().toString()); |
| | | //更新保安数据 |
| | | userService.updateById(user); |
| | | } |
| | |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据),只查下一级的数据 |
| | | * @return |
| | | */ |
| | | @GetMapping("/lazy-tree-users") |
| | | public R<List<TreeNodes>> lazyTreeUsers(String tenantId, Long parentId, BladeUser bladeUser) { |
| | | List<TreeNodes> tree = deptService.lazyTreeUsers(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据)app |
| | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> pages(@ApiIgnore UserVO user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<UserVO> pages = userService.selectUserPages(Condition.getPage(query), user, deptId, "000000"); |
| | | public R<IPage<UserVO>> pages(@ApiIgnore UserVO user, Query query) { |
| | | IPage<UserVO> pages = userService.selectUserPages(Condition.getPage(query), user); |
| | | return R.data(pages); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.SqlParser; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.MapKey; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | @SqlParser(filter=true) |
| | | List<DeptVO> lazyTreeUserApp(@Param("type")Integer type,@Param("jurisdiction")String jurisdiction); |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据),只查下一级的数据 |
| | | * @return |
| | | */ |
| | | @MapKey(value = "id") |
| | | @SqlParser(filter=true) |
| | | Map<Long, TreeNodes> lazyTreeUsers(@Param("parentId") Long parentId); |
| | | } |
| | |
| | | <!--懒加载获取部门树形结构(包含用户数据)app--> |
| | | <select id="lazyTreeUserApp" resultType="org.springblade.modules.system.vo.DeptAndUserVO" > |
| | | select DISTINCT |
| | | c.id, |
| | | c.parent_id, |
| | | c.title, |
| | | c.value, |
| | | c.key, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | where |
| | | id = c.parent_id |
| | | and dept_category=1 |
| | | ) AS "has_children" |
| | | * |
| | | from ( |
| | | (SELECT |
| | | dept.id, |
| | |
| | | dept.is_deleted = 0 |
| | | <if test="parentId!=null and parentId!=''"> |
| | | and dept_category=1 |
| | | AND dept.id = #{parentId} |
| | | AND dept.parent_id = #{parentId} |
| | | </if> |
| | | ) |
| | | |
| | |
| | | </select> |
| | | |
| | | |
| | | <!--懒加载获取部门树形结构(包含用户数据)--> |
| | | <select id="lazyTreeUsers" resultType="org.springblade.modules.system.node.TreeNodes" > |
| | | select DISTINCT |
| | | * |
| | | from ( |
| | | (SELECT |
| | | dept.id, |
| | | dept.parent_id parentId, |
| | | dept.dept_name AS title, |
| | | dept.id AS "value", |
| | | dept.id AS "key", |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | blade_dept |
| | | WHERE |
| | | parent_id = dept.id and is_deleted = 0 |
| | | ) AS "has_children" |
| | | FROM |
| | | blade_dept dept |
| | | WHERE |
| | | dept.is_deleted = 0 |
| | | <if test="parentId!=null and parentId!='' or parentId==0"> |
| | | and dept_category=1 |
| | | AND dept.parent_id = #{parentId} |
| | | </if> |
| | | ) |
| | | |
| | | union |
| | | |
| | | (select |
| | | bu.id, |
| | | bu.dept_id parentId, |
| | | bu.real_name AS title, |
| | | bu.id AS "value", |
| | | bu.id AS "key", |
| | | 0 as "has_children" |
| | | from blade_user bu |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = bu.dept_id |
| | | where 1=1 |
| | | and bu.is_deleted = 0 |
| | | <if test="parentId!=null and parentId!='' or parentId==0"> |
| | | and dept_category=1 |
| | | AND bu.dept_id = #{parentId} |
| | | </if> |
| | | ) |
| | | )c |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="lazyTrees" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | |
| | | blade_dict_biz bdb |
| | | where |
| | | 1=1 |
| | | |
| | | and bdb.parent_id = 0 |
| | | </select> |
| | | |
| | |
| | | * @param tenantId |
| | | * @return |
| | | */ |
| | | List<UserVO> selectUserPages(IPage<UserVO> page, @Param("user") UserVO user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | List<UserVO> selectUserPages(IPage<UserVO> page, @Param("user") UserVO user); |
| | | |
| | | |
| | | /** |
| | |
| | | br.id = bu.role_id |
| | | where |
| | | bu.is_deleted = 0 |
| | | <if test="tenantId!=null and tenantId != ''"> |
| | | and bu.tenant_id = #{tenantId} |
| | | </if> |
| | | <if test="user.tenantId!=null and user.tenantId != ''"> |
| | | and bu.tenant_id = #{user.tenantId} |
| | | </if> |
| | | <if test="user.account!=null and user.account != ''"> |
| | | and bu.account = #{user.account} |
| | | </if> |
| | |
| | | and bu.hold = #{user.hold} |
| | | </if> |
| | | <if test="user.deptId!=null and user.deptId != ''"> |
| | | and (bd.parent_id = #{user.deptId} or bd.id = #{user.deptId}) |
| | | and bu.dept_id = #{user.deptId} |
| | | </if> |
| | | <if test="user.roleId!=null and user.roleId != ''"> |
| | | and bu.role_id = #{user.roleId} |
| | |
| | | </if> |
| | | <if test="user.examinationType!=null and user.examinationType != ''"> |
| | | and bu.examination_type = #{user.examinationType} |
| | | </if> |
| | | <if test="deptIdList!=null and deptIdList.size>0"> |
| | | and bu.id in ( |
| | | SELECT |
| | | user_id |
| | | FROM |
| | | blade_user_dept |
| | | WHERE |
| | | dept_id IN |
| | | <foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | ORDER BY bu.id |
| | | </select> |
| New file |
| | |
| | | package org.springblade.modules.system.node; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | /** |
| | | * @author zhongrj |
| | | * avue 返回格式 |
| | | */ |
| | | @Data |
| | | public class TreeNodes { |
| | | /** |
| | | * id |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * key |
| | | */ |
| | | private Long key; |
| | | |
| | | /** |
| | | * 父id |
| | | */ |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 树节点名称 |
| | | */ |
| | | private String title; |
| | | |
| | | /** |
| | | * 子节点 |
| | | */ |
| | | private List<TreeNodes> children = new ArrayList<>(); |
| | | |
| | | /** |
| | | * 是否有子节点 |
| | | */ |
| | | private Boolean hasChildren; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<DeptVO> lazyTreeUserApp(Integer type,String jurisdiction); |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据),只查下一级的数据 |
| | | * @return |
| | | */ |
| | | List<TreeNodes> lazyTreeUsers(String tenantId, Long parentId); |
| | | } |
| | |
| | | * |
| | | * @param page |
| | | * @param user |
| | | * @param deptId |
| | | * @param tenantId |
| | | * @return |
| | | */ |
| | | IPage<UserVO> selectUserPages(IPage<UserVO> page, UserVO user, Long deptId, String tenantId); |
| | | IPage<UserVO> selectUserPages(IPage<UserVO> page, UserVO user); |
| | | |
| | | /** |
| | | * 自定义分页 |
| | |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.mapper.DeptMapper; |
| | | import org.springblade.modules.system.node.TreeNode; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | import org.springblade.modules.system.wrapper.DeptWrapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | public List<DeptVO> lazyTreeUserApp(Integer type,String jurisdiction) { |
| | | return ForestNodeMerger.merge(baseMapper.lazyTreeUserApp(type,jurisdiction)); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据),只查下一级的数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TreeNodes> lazyTreeUsers(String tenantId, Long parentId) { |
| | | Map<Long,TreeNodes> map = baseMapper.lazyTreeUsers(parentId); |
| | | System.out.println("map = " + map.size()); |
| | | List<TreeNodes> tree = new ArrayList<>(); |
| | | map.forEach((id,treeNodes) ->{ |
| | | if (map.containsKey(treeNodes.getParentId())){ |
| | | map.get(treeNodes.getParentId()).getChildren().add(treeNodes); |
| | | }else { |
| | | tree.add(treeNodes); |
| | | } |
| | | }); |
| | | return tree; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<UserVO> selectUserPages(IPage<UserVO> page, UserVO user, Long deptId, String tenantId) { |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | return page.setRecords(baseMapper.selectUserPages(page, user, deptIdList, tenantId)); |
| | | public IPage<UserVO> selectUserPages(IPage<UserVO> page, UserVO user) { |
| | | return page.setRecords(baseMapper.selectUserPages(page, user)); |
| | | } |
| | | |
| | | @Override |