自动化立体仓库 - WCS系统
*
lsh
2025-04-18 25e6a77fdca15feccadb9d4ccf5baf83e1bfd62a
*
7个文件已修改
84 ■■■■ 已修改文件
src/main/java/com/zy/system/controller/RoleController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/controller/UserController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/mapper/UserMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/service/UserService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/service/impl/UserServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/RoleMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/controller/RoleController.java
@@ -135,12 +135,13 @@
        EntityWrapper<Role> wrapper = new EntityWrapper<>();
        wrapper.like("name", condition);
        // 上下级管理
        List<Long> leaderIds = new ArrayList<>();
        if (9527 != getUserId()) {
            Long roleId = getUser().getRoleId();
            Role role = roleService.selectById(roleId);
            Long leaderId = role.getLeader();
            if (null != leaderId) {
                List<Long> leaderIds = new ArrayList<>();
                while (leaderId != null) {
                    Role leader = roleService.selectById(leaderId);
                    leaderIds.add(leader.getId());
@@ -153,7 +154,12 @@
//            }
        }
        Page<Role> page = roleService.selectPage(new Page<>(0, 10), wrapper);
//        Page<Role> page = roleService.selectPage(new Page<>(0, 10), wrapper);
        List<Role> roleList = roleService.selectRoleList((Cools.isEmpty(leaderIds) || leaderIds.isEmpty())? null : leaderIds,0,10);
        Page<Role> page = new Page<Role>(0,10).setRecords(roleList);
        page.setTotal(roleService.selectRoleListTotal((Cools.isEmpty(leaderIds) || leaderIds.isEmpty())? null : leaderIds));
        List<Map<String, Object>> result = new ArrayList<>();
        for (Role role : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
src/main/java/com/zy/system/controller/UserController.java
@@ -43,24 +43,29 @@
        convert(param, wrapper);
        wrapper.orderBy("id", false);
        if (9527 == getUserId()) {
            return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper));
            List<User> userList = userService.selectUserList(null,curr,limit);
            Page<User> page = new Page<User>(curr,limit).setRecords(userList);
            page.setTotal(userService.selectUserListTotal(null));
            return R.ok(page);
        }
        Long roleId = getUser().getRoleId();
        Role role = roleService.selectById(roleId);
        Long leaderId = role.getLeader();
        if (null != leaderId) {
            List<Long> leaderIds = new ArrayList<>();
        if (null != leaderId) {
            leaderIds.add(role.getId());
            while (leaderId != null) {
                Role leader = roleService.selectById(leaderId);
                leaderIds.add(leader.getId());
                leaderId = leader.getLeader();
            }
            wrapper.notIn("role_id", leaderIds);
        }
        return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper));
        List<User> userList = userService.selectUserList(leaderIds,curr,limit);
        Page<User> page = new Page<User>(curr,limit).setRecords(userList);
        page.setTotal(userService.selectUserListTotal(leaderIds));
        return R.ok(page);
    }
    private void convert(Map<String, Object> map, EntityWrapper wrapper){
@@ -92,6 +97,7 @@
    @RequestMapping(value = "/user/add/auth")
    @ManagerAuth(memo = "系统用户添加")
    public R add(User user) {
        user.setStatus(1);
        userService.insert(user);
        return R.ok();
    }
src/main/java/com/zy/system/mapper/UserMapper.java
@@ -3,10 +3,19 @@
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.system.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {
    List<User> selectUserList(@Param("leaderIdList") List<Long> leaderIdList,
                              @Param("pageNumber") Integer curr,
                              @Param("pageSize") Integer limit);
    Long selectUserListTotal(@Param("leaderIdList") List<Long> leaderIdList);
}
src/main/java/com/zy/system/service/UserService.java
@@ -3,6 +3,11 @@
import com.baomidou.mybatisplus.service.IService;
import com.zy.system.entity.User;
import java.util.List;
public interface UserService extends IService<User> {
    List<User> selectUserList(List<Long> leaderIdList, Integer curr, Integer limit);
    Long selectUserListTotal(List<Long> leaderIdList);
}
src/main/java/com/zy/system/service/impl/UserServiceImpl.java
@@ -6,7 +6,18 @@
import com.zy.system.service.UserService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public List<User> selectUserList(List<Long> leaderIdList, Integer curr, Integer limit){
        return this.baseMapper.selectUserList(leaderIdList,curr,limit);
    };
    @Override
    public Long selectUserListTotal(List<Long> leaderIdList){
        return this.baseMapper.selectUserListTotal(leaderIdList);
    };
}
src/main/resources/mapper/RoleMapper.xml
@@ -12,15 +12,6 @@
    </resultMap>
    <sql id="batchSeq">
        <if test="id != null and id != 0">
            and a.ID = #{id}
        </if>
        <if test="name != null and name != ''">
            and a.NAME = #{name}
        </if>
    </sql>
    <select id="selectRoleList" resultMap="BaseResultMap">
        SELECT * FROM "SOURCE"."sys_role"
        WHERE 1=1
@@ -35,7 +26,7 @@
    </select>
    <select id="selectRoleListTotal" resultType="Long">
        SELECT count(1) FROM "SOURCE"."wcs_api_config"
        SELECT count(1) FROM "SOURCE"."sys_role"
        WHERE 1=1
        <if test="leaderIdList != null and leaderIdList != ''">
            and ID not in
src/main/resources/mapper/UserMapper.xml
@@ -15,4 +15,28 @@
    </resultMap>
    <select id="selectUserList" resultMap="BaseResultMap">
        SELECT * FROM "SOURCE"."sys_user"
        WHERE 1=1
        <if test="leaderIdList != null and leaderIdList != ''">
            and ID not in
            <foreach collection="leaderIdList" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        ORDER BY ID DESC
        LIMIT #{pageSize} OFFSET ((#{pageNumber} - 1) * #{pageSize});
    </select>
    <select id="selectUserListTotal" resultType="Long">
        SELECT count(1) FROM "SOURCE"."sys_user"
        WHERE 1=1
        <if test="leaderIdList != null and leaderIdList != ''">
            and ID not in
            <foreach collection="leaderIdList" item="item" index="index" separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
    </select>
</mapper>