6 files modified
1 files added
| | |
| | | * 行政区划编码 |
| | | */ |
| | | private String adCode; |
| | | |
| | | /** |
| | | * 职位名 |
| | | */ |
| | | private String jobName; |
| | | } |
| | |
| | | import cn.gistack.system.user.service.IUserService; |
| | | import cn.gistack.system.user.service.impl.UserServiceImpl; |
| | | import cn.gistack.system.user.vo.UserVO; |
| | | import cn.gistack.system.user.wrapper.UserVOWrapper; |
| | | import cn.gistack.system.user.wrapper.UserWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> page(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<User> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | public R<IPage<UserVO>> page(@ApiIgnore UserVO user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<UserVO> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | return R.data(UserVOWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param tenantId |
| | | * @return |
| | | */ |
| | | List<User> selectUserPage(IPage<User> page, @Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | List<UserVO> selectUserPage(IPage<UserVO> page, @Param("user") UserVO user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | |
| | | /** |
| | | * 获取用户 |
| | |
| | | <result column="post_id" property="postId"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectUserPage" resultMap="userResultMap"> |
| | | select * from blade_user where is_deleted = 0 |
| | | <select id="selectUserPage" resultType="cn.gistack.system.user.vo.UserVO"> |
| | | select bu.*,armp.jobName from blade_user bu |
| | | left join ( |
| | | select "user_phone" as userPhone,CONCAT_WS('-',"user_unit","position") jobName from SJZT_MD."att_res_manage_person" where "guid" in ( |
| | | select max("guid") as guid from SJZT_MD."att_res_manage_person" group by "user_phone" |
| | | ) |
| | | ) armp on bu.phone = armp.userPhone |
| | | where bu.is_deleted = 0 |
| | | <if test="tenantId!=null and tenantId != ''"> |
| | | and tenant_id = #{tenantId} |
| | | and bu.tenant_id = #{tenantId} |
| | | </if> |
| | | <if test="user.tenantId!=null and user.tenantId != ''"> |
| | | and tenant_id = #{user.tenantId} |
| | | and bu.tenant_id = #{user.tenantId} |
| | | </if> |
| | | <if test="user.account!=null and user.account != ''"> |
| | | and account = #{user.account} |
| | | and bu.account = #{user.account} |
| | | </if> |
| | | <if test="user.realName!=null and user.realName != ''"> |
| | | and real_name like concat(concat('%',#{user.realName}),'%') |
| | | and bu.real_name like concat(concat('%',#{user.realName}),'%') |
| | | </if> |
| | | <if test="user.userType!=null and user.userType != ''"> |
| | | and user_type = #{user.userType} |
| | | and bu.user_type = #{user.userType} |
| | | </if> |
| | | <if test="user.roleId!=null and user.roleId != ''"> |
| | | and role_id like concat('%',#{user.roleId},'%') |
| | | and bu.role_id like concat('%',#{user.roleId},'%') |
| | | </if> |
| | | <if test="deptIdList!=null and deptIdList.size>0"> |
| | | <if test="deptIdList!=null and deptIdList.size()>0"> |
| | | and id in ( |
| | | SELECT |
| | | user_id |
| | |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | ORDER BY id |
| | | ORDER BY bu.id |
| | | </select> |
| | | |
| | | <select id="getUser" resultMap="userResultMap"> |
| | |
| | | * @param tenantId |
| | | * @return |
| | | */ |
| | | IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId); |
| | | IPage<UserVO> selectUserPage(IPage<UserVO> page, UserVO user, Long deptId, String tenantId); |
| | | |
| | | /** |
| | | * 自定义分页 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId) { |
| | | public IPage<UserVO> selectUserPage(IPage<UserVO> page, UserVO user, Long deptId, String tenantId) { |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | return page.setRecords(baseMapper.selectUserPage(page, user, deptIdList, tenantId)); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package cn.gistack.system.user.wrapper; |
| | | |
| | | import cn.gistack.system.cache.DictCache; |
| | | import cn.gistack.system.cache.SysCache; |
| | | import cn.gistack.system.entity.Tenant; |
| | | import cn.gistack.system.enums.DictEnum; |
| | | import cn.gistack.system.user.vo.UserVO; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public class UserVOWrapper extends BaseEntityWrapper<UserVO, UserVO> { |
| | | |
| | | public static UserVOWrapper build() { |
| | | return new UserVOWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public UserVO entityVO(UserVO user) { |
| | | UserVO userVO = Objects.requireNonNull(BeanUtil.copy(user, UserVO.class)); |
| | | Tenant tenant = SysCache.getTenant(user.getTenantId()); |
| | | List<String> roleName = SysCache.getRoleNames(user.getRoleId()); |
| | | List<String> deptName = SysCache.getDeptNames(user.getDeptId()); |
| | | List<String> postName = SysCache.getPostNames(user.getPostId()); |
| | | userVO.setTenantName(tenant.getTenantName()); |
| | | userVO.setRoleName(Func.join(roleName)); |
| | | userVO.setDeptName(Func.join(deptName)); |
| | | userVO.setPostName(Func.join(postName)); |
| | | userVO.setSexName(DictCache.getValue(DictEnum.SEX, user.getSex())); |
| | | userVO.setUserTypeName(DictCache.getValue(DictEnum.USER_TYPE, user.getUserType())); |
| | | return userVO; |
| | | } |
| | | |
| | | } |