buhuazhen
3 天以前 0332be6e1b896a1ce0d544c298567ccefea52dea
feat(role): 添加简易角色列表接口及相关实现

- 在RolesController中增加/listSimpleRole接口,返回简化角色信息列表
- 在RolesService接口中新增listSimpleRole方法定义
- 在RolesServiceImpl实现listSimpleRole方法,查询状态为启用的角色并转换为SimpleRoleVo列表
- 新增SimpleRoleVo类,包含id、no、name三个字段,作为简易角色视图对象
- 修正InfoStage实体及Mapper中实际负责人字段名,由actually改为actual,保持一致性
已添加1个文件
已修改5个文件
58 ■■■■ 文件已修改
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/pojo/InfoStage.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/service/RolesService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/vo/SimpleRoleVo.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/projectManagement/InfoStageMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
@@ -52,4 +52,9 @@
        if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return AjaxResult.success(rolesservice.removeBatchByIds(ids));
    }
    @PostMapping("/listSimpleRole")
    public AjaxResult listSimpleRole() {
        return AjaxResult.success(rolesservice.listSimpleRole());
    }
}
src/main/java/com/ruoyi/projectManagement/pojo/InfoStage.java
@@ -43,13 +43,13 @@
    /**
     * å®žé™…负责人id
     */
    @TableField(value = "actually_leader_id")
    @TableField(value = "actual_leader_id")
    private Long actualLeaderId;
    /**
     * å®žé™…负责人名称
     */
    @TableField(value = "actually_leader_name")
    @TableField(value = "actual_leader_name")
    private String actualLeaderName;
    /**
src/main/java/com/ruoyi/projectManagement/service/RolesService.java
@@ -4,7 +4,12 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.projectManagement.pojo.Roles;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.projectManagement.vo.SimpleRoleVo;
import java.util.List;
public interface RolesService extends IService<Roles> {
    IPage<Roles> listPage(Page<Roles> page, Roles roles);
    List<SimpleRoleVo> listSimpleRole();
}
src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java
@@ -1,16 +1,21 @@
package com.ruoyi.projectManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.enums.IsDeleteEnum;
import com.ruoyi.projectManagement.mapper.RolesMapper;
import com.ruoyi.projectManagement.pojo.Roles;
import com.ruoyi.projectManagement.service.RolesService;
import com.ruoyi.projectManagement.vo.SimpleRoleVo;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@AllArgsConstructor
@Service
@@ -29,4 +34,11 @@
        }
        return rolesmapper.selectPage(page, queryWrapper);
    }
    @Override
    public List<SimpleRoleVo> listSimpleRole() {
        LambdaQueryWrapper<Roles> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Roles::getStatus, 1);
        return BeanUtil.copyToList(rolesmapper.selectList(queryWrapper), SimpleRoleVo.class);
    }
}
src/main/java/com/ruoyi/projectManagement/vo/SimpleRoleVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.projectManagement.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
 * @author buhuazhen
 * @date 2026/3/11
 * @email 3038525872@qq.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SimpleRoleVo implements java.io.Serializable {
    private Long id;
    private String no;
    private String name;
}
src/main/resources/mapper/projectManagement/InfoStageMapper.xml
@@ -9,16 +9,14 @@
            <result property="projectManagementPlanNodeId" column="project_management_plan_node_id" jdbcType="BIGINT"/>
            <result property="projectManagementInfoId" column="project_management_info_id" jdbcType="BIGINT"/>
            <result property="description" column="description" jdbcType="VARCHAR"/>
            <result property="actuallyLeaderId" column="actually_leader_id" jdbcType="BIGINT"/>
            <result property="actuallyLeaderName" column="actually_leader_name" jdbcType="VARCHAR"/>
            <result property="actualLeaderId" column="actually_leader_id" jdbcType="BIGINT"/>
            <result property="actualLeaderName" column="actually_leader_name" jdbcType="VARCHAR"/>
            <result property="estimatedDuration" column="estimated_duration" jdbcType="INTEGER"/>
            <result property="planStartTime" column="plan_start_time" jdbcType="DATE"/>
            <result property="planEndTime" column="plan_end_time" jdbcType="DATE"/>
            <result property="actualStartTime" column="actual_start_time" jdbcType="DATE"/>
            <result property="actualEndTime" column="actual_end_time" jdbcType="DATE"/>
            <result property="progress" column="progress" jdbcType="INTEGER"/>
            <result property="actuallyStartTime" column="actually_start_time" jdbcType="DATE"/>
            <result property="actuallyEndTime" column="actually_end_time" jdbcType="DATE"/>
            <result property="attachment" column="attachment" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
@@ -31,10 +29,9 @@
    <sql id="Base_Column_List">
        id,project_management_plan_node_id,project_management_info_id,
        description,actually_leader_id,actually_leader_name,
        description,actual_leader_id,actual_leader_name,
        estimated_duration,plan_start_time,plan_end_time,
        actual_start_time,actual_end_time,progress,
        actually_start_time,actually_end_time,attachment,
        actual_start_time,actual_end_time,progress,attachment,
        create_time,update_time,is_delete,
        create_user,update_user,create_user_name,
        update_user_name