增加获取所有角色列表接口
This commit is contained in:
parent
e0937b5d2f
commit
71c78f2837
|
|
@ -12,6 +12,8 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统角色管理
|
* 系统角色管理
|
||||||
|
|
@ -23,6 +25,18 @@ public class AuthRoleController {
|
||||||
@Resource
|
@Resource
|
||||||
ISystemAuthRoleService iSystemAuthRoleService;
|
ISystemAuthRoleService iSystemAuthRoleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色所有
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
@GetMapping("/all")
|
||||||
|
public Object all() {
|
||||||
|
List<Map<String, Object>> list = iSystemAuthRoleService.all();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色列表
|
* 角色列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,22 @@ import com.hxkj.admin.vo.system.SystemAuthRoleVo;
|
||||||
import com.hxkj.common.core.PageResult;
|
import com.hxkj.common.core.PageResult;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统角色服务接口类
|
* 系统角色服务接口类
|
||||||
*/
|
*/
|
||||||
public interface ISystemAuthRoleService {
|
public interface ISystemAuthRoleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色所有
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return List<SystemAuthRoleVo>
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> all();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色列表
|
* 角色列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统角色服务实现类
|
* 系统角色服务实现类
|
||||||
|
|
@ -42,6 +40,32 @@ public class SystemAuthRoleServiceImpl implements ISystemAuthRoleService {
|
||||||
@Resource
|
@Resource
|
||||||
ISystemAuthPermService iSystemAuthPermService;
|
ISystemAuthPermService iSystemAuthPermService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色所有
|
||||||
|
*
|
||||||
|
* @author fzr
|
||||||
|
* @return List<SystemAuthRoleVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> all() {
|
||||||
|
QueryWrapper<SystemAuthRole> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.select("id,name,create_time,update_time");
|
||||||
|
queryWrapper.orderByDesc(Arrays.asList("sort", "id"));
|
||||||
|
List<SystemAuthRole> systemAuthRoles = systemAuthRoleMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (SystemAuthRole systemAuthRole : systemAuthRoles) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("id", systemAuthRole.getId());
|
||||||
|
map.put("name", systemAuthRole.getName());
|
||||||
|
map.put("createTime", TimeUtil.timestampToDate(systemAuthRole.getCreateTime()));
|
||||||
|
map.put("updateTime", TimeUtil.timestampToDate(systemAuthRole.getUpdateTime()));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色列表
|
* 角色列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue