puzhibing
2026-02-28 4c7ad6737219ca29f0532ed2de03d6cba7dc8682
修改bug
2个文件已修改
75 ■■■■■ 已修改文件
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-account-boot/src/main/resources/mapper/account/XpOperationsUserMapper.xml 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java
@@ -331,36 +331,6 @@
    @Override
    public void exportOperationsUser(XpOperationsUserQuery query, HttpServletResponse response) {
        List<ExportOperationsUserVo> list = this.baseMapper.exportOperationsUser(query);
        // 查询角色名称
        List<Long> operationsUserIds = list.stream().map(ExportOperationsUserVo::getId).collect(Collectors.toList());
        // 查询用户信息
        List<XpOperationsRole> xpOperationsRoles = xpOperationsRoleMapper.selectList(Wrappers.lambdaQuery(XpOperationsRole.class)
                .in(XpOperationsRole::getOperationsUserId, operationsUserIds));
        if(!CollectionUtils.isEmpty(xpOperationsRoles)){
            List<Long> roleIds = xpOperationsRoles.stream().map(XpOperationsRole::getRoleId).collect(Collectors.toList());
            // 查询列表关联的所有角色
            List<SysRole> sysRoles = sysRoleMapper.selectList(Wrappers.lambdaQuery(SysRole.class)
                    .in(SysRole::getId, roleIds));
            if(!CollectionUtils.isEmpty(sysRoles)){
                // 角色匹配账号id
                Map<Long, List<SysRole>> map = new HashMap<>();
                for (XpOperationsRole xpOperationsRole : xpOperationsRoles) {
                    List<SysRole> sysRoleList = sysRoles.stream().filter(sysRole -> sysRole.getId().equals(xpOperationsRole.getRoleId())).collect(Collectors.toList());
                    map.put(xpOperationsRole.getOperationsUserId(), sysRoleList);
                }
                // 角色名称匹配
                for (ExportOperationsUserVo xpOperationsUserVO : list) {
                    List<SysRole> sysRoles1 = map.get(xpOperationsUserVO.getId());
                    if(null != sysRoles1){
                        xpOperationsUserVO.setRoleName(sysRoles1.stream().map(SysRole::getRoleName).collect(Collectors.joining(";")));
                    }
                }
            }
        }
        ExcelUtil<ExportOperationsUserVo> util = new ExcelUtil<ExportOperationsUserVo>(ExportOperationsUserVo.class);
        util.exportExcel(response, list, "运维人员管理列表");
    }
@@ -406,6 +376,6 @@
    @Override
    public void exportTemplate(HttpServletResponse response) {
        ExcelUtil<ExportOperationsUserVo> util = new ExcelUtil<ExportOperationsUserVo>(ExportOperationsUserVo.class);
        util.exportExcel(response);
        util.importTemplateExcel(response, "运维人员管理列表");
    }
}
xp-robotaxi-account-boot/src/main/resources/mapper/account/XpOperationsUserMapper.xml
@@ -57,10 +57,10 @@
        xou.nick_name,
        xou.unique_number,
        xou.avatar,
        xou.`password`,
        xou.PASSWORD,
        xou.phone_number,
        xou.remarks,
        xou.`status`,
        xou.STATUS,
        xou.id_card_front,
        xou.id_card_back,
        xou.driver_license,
@@ -69,25 +69,30 @@
        xou.is_deleted,
        xou.create_time,
        xou.update_time,
        xou.create_by
        xou.create_by,
        bb.roleName
        FROM
        xp_operations_user xou
        LEFT JOIN xp_operations_role a ON xou.id = a.operations_user_id
        <where>
            <if test="query.nickName != null and query.nickName != ''">
                and xou.nick_name like concat('%',#{query.nickName},'%')
            </if>
            <if test="query.phoneNumber != null and query.phoneNumber != ''">
                and xou.phone_number like concat('%',#{query.phoneNumber},'%')
            </if>
            <if test="query.roleId != null">
                and xor.role_id = #{query.roleId}
            </if>
            <if test="query.status != null">
                and xou.status = #{query.status}
            </if>
            AND xou.is_deleted = 0
        </where>
        left join (
        select a.operations_user_id, GROUP_CONCAT(b.role_name SEPARATOR ';') as roleName from xp_operations_role a
        left join sys_role b on (a.role_id = b.id)
        group by a.operations_user_id
        ) bb on (xou.id = bb.operations_user_id)
        WHERE xou.is_deleted = 0
        <if test="query.nickName != null and query.nickName != ''">
            and xou.nick_name like concat('%',#{query.nickName},'%')
        </if>
        <if test="query.phoneNumber != null and query.phoneNumber != ''">
            and xou.phone_number like concat('%',#{query.phoneNumber},'%')
        </if>
        <if test="query.roleId != null">
            AND EXISTS (SELECT 1 FROM xp_operations_role xore
            WHERE xore.operations_user_id = xou.id
            AND xore.role_id = #{query.roleId})
        </if>
        <if test="query.status != null">
            and xou.status = #{query.status}
        </if>
        order by xou.create_time desc
    </select>
</mapper>