Commit f94df309 authored by huyuchen's avatar huyuchen

提供角色类表接口

parent 8138bbb3
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class HcmRoleInfoVo implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "角色编号")
private Long role_id;
@Schema(description = "角色名称")
private String role_name;
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService;
......@@ -31,9 +32,9 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.integration.IntegrationProperties;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
......@@ -125,6 +126,18 @@ public class RoleController {
.eq(SysRole::getDelFlag, CommonConstants.ZERO_STRING)));
}
/**
* 获取角色列表
* @return 角色列表
*/
@Operation(description = "HCM获取角色列表")
@SysLog("HCM获取角色列表--HCM调用接口")
@GetMapping("/getRoleList")
public R<List<HcmRoleInfoVo>> getRoleList() {
return R.ok(sysRoleService.getRoleList());
}
/**
* 分页查询角色信息
* @param page 分页对象
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.BusinessRoleMenuVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -46,4 +47,10 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
List<BusinessRoleMenuVo> getRoleAndMenu(@Param("type")String type);
Set<String> getRoleByUserIdAndClient(@Param("userId")String userId, @Param("clientId") String clientId);
/**
* hcm查询角色信息
* @return
*/
List<HcmRoleInfoVo> getRoleList();
}
......@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.BusinessRoleMenuVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -58,6 +59,12 @@ public interface SysRoleService extends IService<SysRole> {
*/
List<RoleExcelVO> listRole();
/**
* hcm查询全部的角色列表
* @return list
*/
List<HcmRoleInfoVo> getRoleList();
Page<SysRole> getSysRoleByPage(Page page, SysRole sysRole);
/**
* 更新角色信息
......
......@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUserRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.BusinessRoleMenuVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMapper;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMenuMapper;
......@@ -153,6 +154,15 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
}).collect(Collectors.toList());
}
/**
* hcm查询全部的角色
* @return list
*/
@Override
public List<HcmRoleInfoVo> getRoleList() {
return baseMapper.getRoleList();
}
@Override
public Page<SysRole> getSysRoleByPage(Page page, SysRole sysRole) {
return baseMapper.selectPage(page, buildQueryWrapper(sysRole));
......
......@@ -31,6 +31,11 @@
<result column="update_by" property="updateBy"/>
</resultMap>
<resultMap id="HcmRoleMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo">
<result column="role_id" property="role_id"/>
<result column="role_name" property="role_name"/>
</resultMap>
<!-- 通过用户ID,查询角色信息-->
<select id="listRolesByUserId" resultMap="BaseResultMap">
SELECT r.role_id,
......@@ -74,4 +79,13 @@
left join sys_role b on a.role_id = b.role_id
where a.user_id = #{userId} and b.client_id = #{clientId} and b.del_flag = '0'
</select>
<select id="getRoleList" resultMap="HcmRoleMap">
SELECT
a.role_id,
a.role_name
FROM
sys_role a
where a.client_id = 'yifu-mvp' and a.del_flag = '0'
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment