开始重构 system 模块的代码,先修改认证逻辑
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.mall.system.application;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.system"})
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
public class SystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SystemApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.system.application.config;
|
||||
|
||||
import com.qiniu.util.Auth;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class QiniuConfiguration {
|
||||
|
||||
@Value("${qiniu.access-key}")
|
||||
private String accessKey;
|
||||
@Value("${qiniu.secret-key}")
|
||||
private String secretKey;
|
||||
|
||||
@Bean
|
||||
public Auth auth() {
|
||||
return Auth.create(accessKey, secretKey);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.constant.MallConstants;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.AdminService;
|
||||
import cn.iocoder.mall.system.api.DeptmentService;
|
||||
import cn.iocoder.mall.system.api.ResourceService;
|
||||
import cn.iocoder.mall.system.api.RoleService;
|
||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import cn.iocoder.mall.system.api.bo.role.RoleBO;
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import cn.iocoder.mall.system.api.constant.ResourceConstants;
|
||||
import cn.iocoder.mall.system.api.dto.admin.*;
|
||||
import cn.iocoder.mall.system.application.convert.AdminConvert;
|
||||
import cn.iocoder.mall.system.application.convert.ResourceConvert;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminMenuTreeNodeVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminRoleVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminVO;
|
||||
import cn.iocoder.mall.system.sdk.annotation.RequiresPermissions;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(MallConstants.ROOT_PATH_ADMIN + "/admin")
|
||||
@Api("管理员模块")
|
||||
public class AdminController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||
private ResourceService resourceService;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.AdminService.version}")
|
||||
private AdminService adminService;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private DeptmentService deptmentService;
|
||||
|
||||
// =========== 当前管理员相关的资源 API ===========
|
||||
|
||||
// TODO 功能:当前管理员
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@GetMapping("/menu_resource_tree")
|
||||
@ApiOperation(value = "获得当前登陆的管理员拥有的菜单权限", notes = "以树结构返回")
|
||||
public CommonResult<List<AdminMenuTreeNodeVO>> menuResourceTree() {
|
||||
List<ResourceBO> resources = resourceService.getResourcesByTypeAndRoleIds(ResourceConstants.TYPE_MENU,
|
||||
AdminSecurityContextHolder.getContext().getRoleIds());
|
||||
// 创建 AdminMenuTreeNodeVO Map
|
||||
Map<Integer, AdminMenuTreeNodeVO> treeNodeMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
|
||||
resources.stream().sorted(Comparator.comparing(ResourceBO::getSort)).forEach(resourceBO -> treeNodeMap.put(resourceBO.getId(), ResourceConvert.INSTANCE.convert(resourceBO)));
|
||||
// 处理父子关系
|
||||
treeNodeMap.values().stream()
|
||||
.filter(node -> !node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.forEach((childNode) -> {
|
||||
// 获得父节点
|
||||
AdminMenuTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid());
|
||||
if (parentNode.getChildren() == null) { // 初始化 children 数组
|
||||
parentNode.setChildren(new ArrayList<>());
|
||||
}
|
||||
// 将自己添加到父节点中
|
||||
parentNode.getChildren().add(childNode);
|
||||
});
|
||||
// 获得到所有的根节点
|
||||
List<AdminMenuTreeNodeVO> rootNodes = treeNodeMap.values().stream()
|
||||
.filter(node -> node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
// .sorted(Comparator.comparing(AdminMenuTreeNodeVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
return success(rootNodes);
|
||||
}
|
||||
|
||||
@GetMapping("/url_resource_list")
|
||||
@ApiOperation(value = "获得当前登陆的管理员拥有的 URL 权限列表")
|
||||
public CommonResult<Set<String>> urlResourceList() {
|
||||
List<ResourceBO> resources = resourceService.getResourcesByTypeAndRoleIds(ResourceConstants.TYPE_BUTTON, AdminSecurityContextHolder.getContext().getRoleIds());
|
||||
return success(resources.stream().map(ResourceBO::getHandler).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
// =========== 管理员管理 API ===========
|
||||
//TODO 目前需要增加搜索所有子部门的用户
|
||||
@GetMapping("/page")
|
||||
@RequiresPermissions("system.admin.page")
|
||||
@ApiOperation(value = "管理员分页")
|
||||
public CommonResult<PageResult<AdminVO>> page(AdminPageDTO adminPageDTO) {
|
||||
PageResult<AdminBO> page = adminService.getAdminPage(adminPageDTO);
|
||||
PageResult<AdminVO> resultPage = AdminConvert.INSTANCE.convertAdminVOPage(page);
|
||||
// 拼接结果
|
||||
if (!resultPage.getList().isEmpty()) {
|
||||
// 查询角色数组
|
||||
Map<Integer, Collection<RoleBO>> roleMap = adminService.getAdminRolesMap(CollectionUtil.convertList(resultPage.getList(), AdminBO::getId));
|
||||
resultPage.getList().forEach(admin -> admin.setRoles(AdminConvert.INSTANCE.convertAdminVORoleList(roleMap.get(admin.getId()))));
|
||||
|
||||
// 查询对应部门
|
||||
List<DeptmentBO> deptmentBOS = deptmentService.getAllDeptments();
|
||||
Map<Integer, String> deptNameMap = deptmentBOS.stream().collect(Collectors.toMap(d->d.getId(), d->d.getName()));
|
||||
//管理员所在部门被删后,变成未分配状态
|
||||
deptNameMap.put(0, "未分配");
|
||||
resultPage.getList().forEach(admin->{
|
||||
admin.setDeptment(new AdminVO.Deptment(admin.getDeptmentId(), deptNameMap.get(admin.getDeptmentId())));
|
||||
});
|
||||
}
|
||||
|
||||
return success(resultPage);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "创建管理员")
|
||||
public CommonResult<AdminBO> add(AdminAddDTO adminAddDTO) {
|
||||
return success(adminService.addAdmin(AdminSecurityContextHolder.getContext().getAdminId(), adminAddDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新管理员")
|
||||
public CommonResult<Boolean> update(AdminUpdateDTO adminUpdateDTO) {
|
||||
return success(adminService.updateAdmin(AdminSecurityContextHolder.getContext().getAdminId(), adminUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update_status")
|
||||
@ApiOperation(value = "更新管理员状态")
|
||||
public CommonResult<Boolean> updateStatus(AdminUpdateStatusDTO adminUpdateStatusDTO) {
|
||||
return success(adminService.updateAdminStatus(AdminSecurityContextHolder.getContext().getAdminId(), adminUpdateStatusDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除管理员")
|
||||
@ApiImplicitParam(name = "id", value = "管理员编号", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(adminService.deleteAdmin(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
@GetMapping("/role_list")
|
||||
@ApiOperation(value = "指定管理员拥有的角色列表")
|
||||
@ApiImplicitParam(name = "id", value = "管理员编号", required = true, example = "1")
|
||||
public CommonResult<List<AdminRoleVO>> roleList(@RequestParam("id") Integer id) {
|
||||
// 获得所有角色列表
|
||||
List<RoleBO> allRoleList = roleService.getRoleList();
|
||||
// 获得管理员的角色数组
|
||||
Set<Integer> adminRoleIdSet = CollectionUtil.convertSet(adminService.getRoleList(id), RoleBO::getId);
|
||||
// 转换出返回结果
|
||||
List<AdminRoleVO> result = AdminConvert.INSTANCE.convert(allRoleList);
|
||||
// 设置每个角色是否赋予给改管理员
|
||||
result.forEach(adminRoleVO -> adminRoleVO.setAssigned(adminRoleIdSet.contains(adminRoleVO.getId())));
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@PostMapping("/assign_role")
|
||||
@ApiOperation(value = "分配给管理员角色")
|
||||
public CommonResult<Boolean> assignRole(AdminAssignRoleDTO adminAssignRoleDTO) {
|
||||
return success(adminService.assignAdminRole(AdminSecurityContextHolder.getContext().getAdminId(), adminAssignRoleDTO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.DataDictService;
|
||||
import cn.iocoder.mall.system.api.bo.datadict.DataDictBO;
|
||||
import cn.iocoder.mall.system.api.dto.datadict.DataDictAddDTO;
|
||||
import cn.iocoder.mall.system.api.dto.datadict.DataDictUpdateDTO;
|
||||
import cn.iocoder.mall.system.application.convert.DataDictConvert;
|
||||
import cn.iocoder.mall.system.application.vo.datadict.DataDictEnumVO;
|
||||
import cn.iocoder.mall.system.sdk.annotation.RequiresPermissions;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import com.google.common.collect.ImmutableListMultimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/data_dict")
|
||||
@Api("数据字典模块")
|
||||
public class DataDictController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.DataDictService.version}")
|
||||
private DataDictService dataDictService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "数据字典全列表")
|
||||
@RequiresPermissions("system.dataDict.list")
|
||||
public CommonResult<List<DataDictBO>> list() {
|
||||
return success( dataDictService.selectDataDictList());
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@RequiresPermissions({}) // 因为是通用的接口,所以无需权限标识
|
||||
@ApiOperation(value = "数据字典树结构", notes = "该接口返回的信息更为精简。一般用于前端缓存数据字典到本地。")
|
||||
public CommonResult<List<DataDictEnumVO>> tree() {
|
||||
// 查询数据字典全列表
|
||||
List<DataDictBO> dataDicts = dataDictService.selectDataDictList();
|
||||
// 构建基于 enumValue 聚合的 Multimap
|
||||
ImmutableListMultimap<String, DataDictBO> dataDictMap = Multimaps.index(dataDicts, DataDictBO::getEnumValue); // KEY 是 enumValue ,VALUE 是 DataDictBO 数组
|
||||
// 构建返回结果
|
||||
List<DataDictEnumVO> dataDictEnumVOs = new ArrayList<>(dataDictMap.size());
|
||||
dataDictMap.keys().forEach(enumValue -> {
|
||||
DataDictEnumVO dataDictEnumVO = new DataDictEnumVO().setEnumValue(enumValue)
|
||||
.setValues(DataDictConvert.INSTANCE.convert2(dataDictMap.get(enumValue)));
|
||||
dataDictEnumVOs.add(dataDictEnumVO);
|
||||
});
|
||||
return success(dataDictEnumVOs);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@RequiresPermissions("system.dataDict.add")
|
||||
@ApiOperation(value = "创建数据字典")
|
||||
public CommonResult<DataDictBO> add(DataDictAddDTO dataDictAddDTO) {
|
||||
return success(dataDictService.addDataDict(AdminSecurityContextHolder.getContext().getAdminId(), dataDictAddDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("system.dataDict.update")
|
||||
@ApiOperation(value = "更新数据字典")
|
||||
public CommonResult<Boolean> update(DataDictUpdateDTO dataDictUpdateDTO) {
|
||||
return success(dataDictService.updateDataDict(AdminSecurityContextHolder.getContext().getAdminId(), dataDictUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@RequiresPermissions("system.dataDict.delete")
|
||||
@ApiOperation(value = "删除数据字典")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "100")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(dataDictService.deleteDataDict(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.DeptmentService;
|
||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
||||
import cn.iocoder.mall.system.api.constant.ResourceConstants;
|
||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentAddDTO;
|
||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentPageDTO;
|
||||
import cn.iocoder.mall.system.api.dto.depetment.DeptmentUpdateDTO;
|
||||
import cn.iocoder.mall.system.application.convert.DeptmentConvert;
|
||||
import cn.iocoder.mall.system.application.vo.deptment.DeptmentVO;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @author: zhenxianyimeng
|
||||
* @date: 2019-06-14
|
||||
* @time: 19:07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admins/dept")
|
||||
@Api("部门模块")
|
||||
public class DeptmentController {
|
||||
|
||||
@Autowired
|
||||
private DeptmentService deptmentService;
|
||||
|
||||
@GetMapping("tree/all")
|
||||
@ApiOperation(value = "根部门的部门树")
|
||||
public CommonResult<List<DeptmentVO>> treeAll(){
|
||||
List<DeptmentBO> list = deptmentService.getAllDeptments();
|
||||
List<DeptmentVO> voList = DeptmentConvert.INSTANCE.convert(list);
|
||||
Map<Integer, DeptmentVO> nodeMap = calcNodeMap(voList);
|
||||
// 获得到所有的根节点
|
||||
List<DeptmentVO> rootNodes = nodeMap.values().stream()
|
||||
.filter(node -> node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.collect(Collectors.toList());
|
||||
return success(rootNodes);
|
||||
}
|
||||
|
||||
@GetMapping("tree/page")
|
||||
@ApiOperation(value = "根部门分页的部门树")
|
||||
public CommonResult<PageResult<DeptmentVO>> treePage(@Validated DeptmentPageDTO deptmentPageDTO){
|
||||
PageResult<DeptmentBO> pageResult = deptmentService.getPageRootDeptment(deptmentPageDTO);
|
||||
PageResult<DeptmentVO> voPageResult = DeptmentConvert.INSTANCE.convert(pageResult);
|
||||
List<DeptmentBO> list = deptmentService.getAllDeptments();
|
||||
List<DeptmentVO> voList = DeptmentConvert.INSTANCE.convert(list);
|
||||
Map<Integer, DeptmentVO> nodeMap = calcNodeMap(voList);
|
||||
voPageResult.getList().forEach(d->{
|
||||
d.setChildren(nodeMap.get(d.getId()).getChildren());
|
||||
});
|
||||
return success(voPageResult);
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation(value = "新增部门", notes = "选择部门名称,父级部门")
|
||||
public CommonResult<DeptmentBO> add(@RequestBody DeptmentAddDTO deptmentAddDTO){
|
||||
return success(deptmentService.addDeptment(
|
||||
AdminSecurityContextHolder.getContext().getAdminId(), deptmentAddDTO));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("delete")
|
||||
@ApiOperation(value = "删除部门")
|
||||
@ApiImplicitParam(name = "id", value = "部门id", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id){
|
||||
|
||||
return success(deptmentService.deleteDeptment(
|
||||
AdminSecurityContextHolder.getContext().getAdminId(), id
|
||||
));
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
@ApiOperation(value = "更新部门")
|
||||
public CommonResult<Boolean> update(@RequestBody DeptmentUpdateDTO deptmentUpdateDTO){
|
||||
return success(deptmentService.updateDeptment(
|
||||
AdminSecurityContextHolder.getContext().getAdminId(), deptmentUpdateDTO
|
||||
));
|
||||
}
|
||||
|
||||
private Map<Integer, DeptmentVO> calcNodeMap(List<DeptmentVO> voList){
|
||||
Map<Integer, DeptmentVO> nodeMap = voList.stream().collect(Collectors.toMap(e->e.getId(), e->e));
|
||||
|
||||
nodeMap.values().stream()
|
||||
.filter(node -> !node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.forEach((childNode) -> {
|
||||
// 获得父节点
|
||||
DeptmentVO parentNode = nodeMap.get(childNode.getPid());
|
||||
if (parentNode.getChildren() == null) { // 初始化 children 数组
|
||||
parentNode.setChildren(new ArrayList<>());
|
||||
}
|
||||
// 将自己添加到父节点中
|
||||
parentNode.getChildren().add(childNode);
|
||||
});
|
||||
return nodeMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import com.qiniu.util.Auth;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/file")
|
||||
@Api("文件模块")
|
||||
public class FileController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private Auth auth;
|
||||
@Value("${qiniu.bucket}")
|
||||
private String bucket;
|
||||
|
||||
@GetMapping("/get_qiniu_token")
|
||||
public CommonResult<String> getQiniuToken() {
|
||||
String token = auth.uploadToken(bucket);
|
||||
logger.info("[qiniu_token][token({}) get]", token);
|
||||
return CommonResult.success(token);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.AdminService;
|
||||
import cn.iocoder.mall.system.api.OAuth2Service;
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminAuthenticationBO;
|
||||
import cn.iocoder.mall.system.api.dto.admin.AdminAuthenticationDTO;
|
||||
import io.micrometer.core.instrument.Counter;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/passport")
|
||||
@Api("Admin Passport 模块")
|
||||
@Deprecated
|
||||
public class PassportController {
|
||||
|
||||
/**
|
||||
* 登陆总数 Metrics
|
||||
*/
|
||||
private static final Counter METRICS_LOGIN_TOTAL = Metrics.counter("mall.admin.passport.login.total");
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.OAuth2Service.version}")
|
||||
private OAuth2Service oauth2Service;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.AdminService.version}")
|
||||
private AdminService adminService;
|
||||
|
||||
@PostMapping("/login")
|
||||
@ApiOperation(value = "手机号 + 密码登陆")
|
||||
public CommonResult<AdminAuthenticationBO> login(AdminAuthenticationDTO adminAuthenticationDTO) {
|
||||
// 增加计数
|
||||
METRICS_LOGIN_TOTAL.increment();
|
||||
// 执行登陆
|
||||
return success(adminService.authentication(adminAuthenticationDTO));
|
||||
}
|
||||
|
||||
// TODO 功能 logout
|
||||
|
||||
// TODO 功能 refresh_token
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.ResourceService;
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import cn.iocoder.mall.system.api.constant.ResourceConstants;
|
||||
import cn.iocoder.mall.system.api.dto.resource.ResourceAddDTO;
|
||||
import cn.iocoder.mall.system.api.dto.resource.ResourceUpdateDTO;
|
||||
import cn.iocoder.mall.system.application.convert.ResourceConvert;
|
||||
import cn.iocoder.mall.system.application.vo.resource.ResourceTreeNodeVO;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/resource")
|
||||
@Api("资源模块")
|
||||
public class ResourceController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||
private ResourceService resourceService;
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation(value = "获得所有资源,按照树形结构返回")
|
||||
public CommonResult<List<ResourceTreeNodeVO>> tree() {
|
||||
List<ResourceBO> resources = resourceService.getResourcesByType(null);
|
||||
// 创建 AdminMenuTreeNodeVO Map
|
||||
Map<Integer, ResourceTreeNodeVO> treeNodeMap = resources.stream().collect(Collectors.toMap(ResourceBO::getId, ResourceConvert.INSTANCE::convert2));
|
||||
// 处理父子关系
|
||||
treeNodeMap.values().stream()
|
||||
.filter(node -> !node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.forEach((childNode) -> {
|
||||
// 获得父节点
|
||||
ResourceTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid());
|
||||
if (parentNode.getChildren() == null) { // 初始化 children 数组
|
||||
parentNode.setChildren(new ArrayList<>());
|
||||
}
|
||||
// 将自己添加到父节点中
|
||||
parentNode.getChildren().add(childNode);
|
||||
});
|
||||
// 获得到所有的根节点
|
||||
List<ResourceTreeNodeVO> rootNodes = treeNodeMap.values().stream()
|
||||
.filter(node -> node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.sorted(Comparator.comparing(ResourceTreeNodeVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
return success(rootNodes);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "创建资源", notes = "例如说,菜单资源,Url 资源")
|
||||
public CommonResult<ResourceBO> add(ResourceAddDTO resourceAddDTO) {
|
||||
return success(resourceService.addResource(AdminSecurityContextHolder.getContext().getAdminId(), resourceAddDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新资源")
|
||||
public CommonResult<Boolean> update(ResourceUpdateDTO resourceUpdateDTO) {
|
||||
return success(resourceService.updateResource(AdminSecurityContextHolder.getContext().getAdminId(), resourceUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除资源")
|
||||
@ApiImplicitParam(name = "id", value = "资源编号", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(resourceService.deleteResource(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.ResourceService;
|
||||
import cn.iocoder.mall.system.api.RoleService;
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import cn.iocoder.mall.system.api.bo.role.RoleBO;
|
||||
import cn.iocoder.mall.system.api.constant.ResourceConstants;
|
||||
import cn.iocoder.mall.system.api.dto.role.RoleAddDTO;
|
||||
import cn.iocoder.mall.system.api.dto.role.RoleAssignResourceDTO;
|
||||
import cn.iocoder.mall.system.api.dto.role.RolePageDTO;
|
||||
import cn.iocoder.mall.system.api.dto.role.RoleUpdateDTO;
|
||||
import cn.iocoder.mall.system.application.convert.ResourceConvert;
|
||||
import cn.iocoder.mall.system.application.vo.role.RoleResourceTreeNodeVO;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/role")
|
||||
@Api("角色模块")
|
||||
public class RoleController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||
private RoleService roleService;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||
private ResourceService resourceService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "角色分页")
|
||||
public CommonResult<PageResult<RoleBO>> page(RolePageDTO rolePageDTO) {
|
||||
return success(roleService.getRolePage(rolePageDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "创建角色")
|
||||
public CommonResult<RoleBO> add(RoleAddDTO roleAddDTO) {
|
||||
return success(roleService.addRole(AdminSecurityContextHolder.getContext().getAdminId(), roleAddDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新角色")
|
||||
public CommonResult<Boolean> update(RoleUpdateDTO roleUpdateDTO) {
|
||||
return success(roleService.updateRole(AdminSecurityContextHolder.getContext().getAdminId(), roleUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除角色")
|
||||
@ApiImplicitParam(name = "id", value = "角色编号", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(roleService.deleteRole(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@GetMapping("/resource_tree")
|
||||
@ApiOperation(value = "获得角色拥有的菜单权限", notes = "以树结构返回")
|
||||
@ApiImplicitParam(name = "id", value = "角色编号", required = true, example = "1")
|
||||
public CommonResult<List<RoleResourceTreeNodeVO>> resourceTree(@RequestParam("id") Integer id) {
|
||||
// 芋艿:此处,严格来说可以在校验下角色是否存在。不过呢,校验了也没啥意义,因为一般不存在这个情况,且不会有业务上的影响。并且,反倒多了一次 rpc 调用。
|
||||
// 第一步,获得角色拥有的资源数组
|
||||
Set<Integer> roleResources = resourceService.getResourcesByTypeAndRoleIds(null, CollectionUtil.asSet(id))
|
||||
.stream().map(ResourceBO::getId).collect(Collectors.toSet());
|
||||
// 第二步,获得资源树
|
||||
List<ResourceBO> allResources = resourceService.getResourcesByType(null);
|
||||
// 创建 AdminMenuTreeNodeVO Map
|
||||
Map<Integer, RoleResourceTreeNodeVO> treeNodeMap = allResources.stream().collect(Collectors.toMap(ResourceBO::getId, ResourceConvert.INSTANCE::convert4));
|
||||
// 处理父子关系
|
||||
treeNodeMap.values().stream()
|
||||
.filter(node -> !node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.forEach((childNode) -> {
|
||||
// 获得父节点
|
||||
RoleResourceTreeNodeVO parentNode = treeNodeMap.get(childNode.getPid());
|
||||
if (parentNode.getChildren() == null) { // 初始化 children 数组
|
||||
parentNode.setChildren(new ArrayList<>());
|
||||
}
|
||||
// 将自己添加到父节点中
|
||||
parentNode.getChildren().add(childNode);
|
||||
});
|
||||
// 获得到所有的根节点
|
||||
List<RoleResourceTreeNodeVO> rootNodes = treeNodeMap.values().stream()
|
||||
.filter(node -> node.getPid().equals(ResourceConstants.PID_ROOT))
|
||||
.sorted(Comparator.comparing(RoleResourceTreeNodeVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
// 第三步,设置角色是否有该角色
|
||||
treeNodeMap.values().forEach(nodeVO -> nodeVO.setAssigned(roleResources.contains(nodeVO.getId())));
|
||||
// 返回结果
|
||||
return success(rootNodes);
|
||||
}
|
||||
|
||||
@PostMapping("/assign_resource")
|
||||
@ApiOperation(value = "分配角色资源")
|
||||
public CommonResult<Boolean> assignResource(RoleAssignResourceDTO roleAssignResourceDTO) {
|
||||
return success(roleService.assignRoleResource(AdminSecurityContextHolder.getContext().getAdminId(), roleAssignResourceDTO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.SmsService;
|
||||
import cn.iocoder.mall.system.api.bo.sms.PageSmsSignBO;
|
||||
import cn.iocoder.mall.system.api.dto.sms.PageQuerySmsSignDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 短信服务
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:26 PM
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admins/sms/sign")
|
||||
@Api("短信服务(签名)")
|
||||
public class SmsSignController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("签名-page")
|
||||
public CommonResult<PageSmsSignBO> pageSign(@Validated PageQuerySmsSignDTO querySmsSignDTO) {
|
||||
return CommonResult.success(smsService.pageSmsSign(querySmsSignDTO));
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("签名-添加")
|
||||
public CommonResult addSign(@RequestParam("sign") String sign,
|
||||
@RequestParam("platform") Integer platform) {
|
||||
smsService.addSign(sign, platform);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@ApiOperation("签名-更新")
|
||||
public CommonResult updateSign(@RequestParam("id") Integer id,
|
||||
@RequestParam("sign") String sign,
|
||||
@RequestParam("platform") Integer platform) {
|
||||
smsService.updateSign(id, sign, platform);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleted")
|
||||
@ApiOperation("签名-删除")
|
||||
public CommonResult deletedSign(@RequestParam("id") Integer id) {
|
||||
smsService.deleteSign(id);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.SmsService;
|
||||
import cn.iocoder.mall.system.api.bo.sms.PageSmsTemplateBO;
|
||||
import cn.iocoder.mall.system.api.dto.sms.PageQuerySmsTemplateDTO;
|
||||
import cn.iocoder.mall.system.application.po.sms.SmsTemplateAddPO;
|
||||
import cn.iocoder.mall.system.application.po.sms.SmsTemplateUpdatePO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 短信服务
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:26 PM
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admins/sms/template")
|
||||
@Api("短信服务(短信模板)")
|
||||
public class SmsTemplateController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("短信模板-page")
|
||||
public CommonResult<PageSmsTemplateBO> pageSign(PageQuerySmsTemplateDTO pageQuerySmsTemplateDTO) {
|
||||
return CommonResult.success(smsService.pageSmsTemplate(pageQuerySmsTemplateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("短信模板-添加")
|
||||
public CommonResult addSign(SmsTemplateAddPO smsTemplateAddPO) {
|
||||
smsService.addTemplate(
|
||||
smsTemplateAddPO.getSmsSignId(),
|
||||
smsTemplateAddPO.getTemplateCode(),
|
||||
smsTemplateAddPO.getTemplate(),
|
||||
smsTemplateAddPO.getPlatform(),
|
||||
smsTemplateAddPO.getSmsType());
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@ApiOperation("短信模板-更新")
|
||||
public CommonResult updateSign(SmsTemplateUpdatePO smsTemplateUpdatePO) {
|
||||
smsService.updateTemplate(
|
||||
smsTemplateUpdatePO.getId(),
|
||||
smsTemplateUpdatePO.getSmsSignId(),
|
||||
smsTemplateUpdatePO.getTemplateCode(),
|
||||
smsTemplateUpdatePO.getTemplate(),
|
||||
smsTemplateUpdatePO.getPlatform(),
|
||||
smsTemplateUpdatePO.getSmsType());
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@DeleteMapping("deleted")
|
||||
@ApiOperation("短信模板-删除")
|
||||
public CommonResult deletedSign(@RequestParam("id") Integer id) {
|
||||
smsService.deleteTemplate(id);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.mall.system.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.SystemLogService;
|
||||
import cn.iocoder.mall.system.api.bo.systemlog.AccessLogPageBO;
|
||||
import cn.iocoder.mall.system.api.dto.systemlog.AccessLogPageDTO;
|
||||
import cn.iocoder.mall.system.application.convert.AccessLogConvert;
|
||||
import cn.iocoder.mall.system.application.vo.log.AccessLogPageVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @author:ycjx
|
||||
* @descriptio
|
||||
* @create:2019-06-23 16:42
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admins/system/logs")
|
||||
@Api("系统日志")
|
||||
public class SystemLogController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.AdminAccessLogService.version}")
|
||||
private SystemLogService systemLogService;
|
||||
|
||||
@GetMapping("access/page")
|
||||
@ApiOperation(value = "访问日志分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", example = "1"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AccessLogPageVo> page(@RequestParam(value = "userId", required = false) Integer userId,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
|
||||
AccessLogPageDTO accessLogPageDTO = new AccessLogPageDTO().setUserId(userId)
|
||||
.setPageNo(pageNo).setPageSize(pageSize);
|
||||
// 查询分页
|
||||
AccessLogPageBO result = systemLogService.getAccessLogPage(accessLogPageDTO);
|
||||
// 转换结果
|
||||
return success(AccessLogConvert.INSTANCE.convert(result));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.systemlog.AccessLogBO;
|
||||
import cn.iocoder.mall.system.api.bo.systemlog.AccessLogPageBO;
|
||||
import cn.iocoder.mall.system.application.vo.log.AccessLogPageVo;
|
||||
import cn.iocoder.mall.system.application.vo.log.AccessLogVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author:ycjx
|
||||
* @descriptio
|
||||
* @create:2019-06-23 17:36
|
||||
*/
|
||||
@Mapper
|
||||
public interface AccessLogConvert {
|
||||
|
||||
|
||||
AccessLogConvert INSTANCE = Mappers.getMapper(AccessLogConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AccessLogPageVo convert(AccessLogPageBO result);
|
||||
|
||||
@Mappings({})
|
||||
AccessLogVo convert(AccessLogBO result);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.bo.role.RoleBO;
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminInfoVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminRoleVO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminVO;
|
||||
import cn.iocoder.mall.system.sdk.context.AdminSecurityContext;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AdminConvert {
|
||||
|
||||
AdminConvert INSTANCE = Mappers.getMapper(AdminConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminInfoVO convert(AdminSecurityContext adminSecurityContext);
|
||||
|
||||
@Mappings({})
|
||||
AdminVO convert(AdminBO adminBO);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<AdminVO> convert2(CommonResult<AdminBO> result);
|
||||
|
||||
@Mappings({})
|
||||
List<AdminRoleVO> convert(List<RoleBO> roleList);
|
||||
|
||||
@Mappings({})
|
||||
PageResult<AdminVO> convertAdminVOPage(PageResult<AdminBO> page);
|
||||
|
||||
List<AdminVO.Role> convertAdminVORoleList(Collection<RoleBO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.datadict.DataDictBO;
|
||||
import cn.iocoder.mall.system.application.vo.datadict.DataDictEnumVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DataDictConvert {
|
||||
|
||||
DataDictConvert INSTANCE = Mappers.getMapper(DataDictConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
List<DataDictEnumVO.Value> convert2(List<DataDictBO> dataDictBOs);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
||||
import cn.iocoder.mall.system.application.vo.deptment.DeptmentVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @author: zhenxianyimeng
|
||||
* @date: 2019-06-22
|
||||
* @time: 00:23
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeptmentConvert {
|
||||
|
||||
DeptmentConvert INSTANCE = Mappers.getMapper(DeptmentConvert.class);
|
||||
|
||||
@Mappings({@Mapping(source = "list", target = "list")})
|
||||
PageResult<DeptmentVO> convert(PageResult<DeptmentBO> pageResult);
|
||||
|
||||
@Mappings({})
|
||||
List<DeptmentVO> convert(List<DeptmentBO> list);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.bo.oauth2.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.system.application.vo.PassportLoginVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface PassportConvert {
|
||||
|
||||
PassportConvert INSTANCE = Mappers.getMapper(PassportConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
PassportLoginVO convert(OAuth2AccessTokenBO oauth2AccessTokenBO);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<PassportLoginVO> convert(CommonResult<OAuth2AccessTokenBO> oauth2AccessTokenBO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import cn.iocoder.mall.system.application.vo.admin.AdminMenuTreeNodeVO;
|
||||
import cn.iocoder.mall.system.application.vo.resource.ResourceTreeNodeVO;
|
||||
import cn.iocoder.mall.system.application.vo.resource.ResourceVO;
|
||||
import cn.iocoder.mall.system.application.vo.role.RoleResourceTreeNodeVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ResourceConvert {
|
||||
|
||||
ResourceConvert INSTANCE = Mappers.getMapper(ResourceConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminMenuTreeNodeVO convert(ResourceBO resourceBO);
|
||||
|
||||
@Mappings({})
|
||||
ResourceTreeNodeVO convert2(ResourceBO resourceBO);
|
||||
|
||||
@Mappings({})
|
||||
RoleResourceTreeNodeVO convert4(ResourceBO resourceBO);
|
||||
|
||||
@Mappings({})
|
||||
ResourceVO convert3(ResourceBO resourceBO);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<ResourceVO> convert3(CommonResult<ResourceBO> resourceBO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.iocoder.mall.system.application.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface RoleConvert {
|
||||
|
||||
RoleConvert INSTANCE = Mappers.getMapper(RoleConvert.class);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:36 PM
|
||||
*/
|
||||
package cn.iocoder.mall.system.application.po;
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.mall.system.application.po.sms;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.system.api.constant.SmsPlatformEnum;
|
||||
import cn.iocoder.mall.system.api.constant.SmsTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板 add
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:37 PM
|
||||
*/
|
||||
@ApiModel("短信模板-添加")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsTemplateAddPO implements Serializable {
|
||||
|
||||
@ApiModelProperty("短信签名id")
|
||||
@NotNull(message = "短信短信签名id不能为空!")
|
||||
private Integer smsSignId;
|
||||
|
||||
@ApiModelProperty("短信模板code")
|
||||
@NotNull
|
||||
@Size(min = 3, max = 50, message = "短信code在 3-50 之间")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty("短信模板")
|
||||
@NotNull
|
||||
@Size(min = 3, max = 255, message = "短信在 3-255 之间")
|
||||
private String template;
|
||||
|
||||
@ApiModelProperty("短信模板-平台")
|
||||
@NotNull
|
||||
@InEnum(value = SmsPlatformEnum.class)
|
||||
private Integer platform;
|
||||
|
||||
@ApiModelProperty("短信模板-平台")
|
||||
@NotNull
|
||||
@InEnum(value = SmsTypeEnum.class)
|
||||
private Integer smsType;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.mall.system.application.po.sms;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.system.api.constant.SmsPlatformEnum;
|
||||
import cn.iocoder.mall.system.api.constant.SmsTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信模板 add
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019/5/26 12:37 PM
|
||||
*/
|
||||
@ApiModel("短信模板-添加")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SmsTemplateUpdatePO implements Serializable {
|
||||
|
||||
@ApiModelProperty("短信模板id")
|
||||
@NotNull(message = "短信模板不能为空!")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("短信签名id")
|
||||
@NotNull(message = "短信短信签名id不能为空!")
|
||||
private Integer smsSignId;
|
||||
|
||||
@ApiModelProperty("短信模板code")
|
||||
@NotNull
|
||||
@Size(min = 3, max = 50, message = "短信code在 3-50 之间")
|
||||
private String templateCode;
|
||||
|
||||
@ApiModelProperty("短信模板")
|
||||
@NotNull
|
||||
@Size(min = 3, max = 255, message = "短信在 3-255 之间")
|
||||
private String template;
|
||||
|
||||
@ApiModelProperty("短信模板-平台")
|
||||
@NotNull
|
||||
@InEnum(value = SmsPlatformEnum.class)
|
||||
private Integer platform;
|
||||
|
||||
@ApiModelProperty("短信模板-平台")
|
||||
@NotNull
|
||||
@InEnum(value = SmsTypeEnum.class)
|
||||
private Integer smsType;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.system.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("登陆结果 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PassportLoginVO {
|
||||
|
||||
@ApiModelProperty(value = "访问令牌", required = true, example = "2e3d7635c15e47e997611707a237859f")
|
||||
private String accessToken;
|
||||
@ApiModelProperty(value = "刷新令牌", required = true, example = "d091e7c35bbb4313b0f557a6ef23d033")
|
||||
private String refreshToken;
|
||||
@ApiModelProperty(value = "过期时间,单位:秒", required = true, example = "2879")
|
||||
private Integer expiresIn;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("管理员信息 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminInfoVO {
|
||||
|
||||
@ApiModelProperty(value = "管理员编号", required = true, example = "1")
|
||||
private Integer adminId;
|
||||
@ApiModelProperty(value = "角色编号的数组", required = true, example = "[1, 2]")
|
||||
private Set<Integer> roleIds;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理员拥有的菜单 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminMenuTreeNodeVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
// @ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
// private String name;
|
||||
@ApiModelProperty(value = "菜单操作", required = true, example = "/order/list")
|
||||
private String handler;
|
||||
@ApiModelProperty(value = "父菜单编号", required = true, example = "1", notes = "如果无父菜单,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
|
||||
private String displayName;
|
||||
@ApiModelProperty(value = "子节点数组")
|
||||
private List<AdminMenuTreeNodeVO> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("管理员拥有的角色 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminRoleVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "角色名字", required = true, example = "系统管理员")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "是否授权", required = true, example = "true")
|
||||
private Boolean assigned;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.mall.system.application.vo.admin;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.admin.AdminBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("管理员 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminVO extends AdminBO {
|
||||
|
||||
private List<Role> roles;
|
||||
|
||||
private Deptment deptment;
|
||||
|
||||
@ApiModel("管理员 VO - 角色")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Role {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "角色名", required = true, example = "码神")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@ApiModel("管理员 VO - 部门")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
public static class Deptment {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "研发部")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.system.application.vo.datadict;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("数据字典枚举 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DataDictEnumVO {
|
||||
|
||||
@ApiModelProperty(value = "大类枚举值", required = true, example = "gender")
|
||||
private String enumValue;
|
||||
|
||||
@ApiModelProperty(value = "小类数值数组", required = true)
|
||||
private List<Value> values;
|
||||
|
||||
@ApiModel("数据字典枚举值 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class Value {
|
||||
|
||||
@ApiModelProperty(value = "小类数值", required = true, example = "1")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "展示名", required = true, example = "男")
|
||||
private String displayName;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.system.application.vo.deptment;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.deptment.DeptmentBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
*
|
||||
* @author: zhenxianyimeng
|
||||
* @date: 2019-06-15
|
||||
* @time: 16:57
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("部门VO")
|
||||
public class DeptmentVO extends DeptmentBO {
|
||||
@ApiModelProperty("子部门数组")
|
||||
private List<DeptmentVO> children;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.mall.system.application.vo.log;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:ycjx
|
||||
* @descriptio
|
||||
* @create:2019-06-23 17:03
|
||||
*/
|
||||
@ApiModel("访问日志分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AccessLogPageVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "访问数据")
|
||||
private List<AccessLogVo> list;
|
||||
@ApiModelProperty(value = "访问总数")
|
||||
private Integer total;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.mall.system.application.vo.log;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:yuxj
|
||||
* @descriptio
|
||||
* @create:2019-06-23 17:04
|
||||
*/
|
||||
|
||||
@ApiModel("访问日志 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AccessLogVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "1")
|
||||
private String traceId;
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", required = true, example = "1")
|
||||
private Integer userType;
|
||||
|
||||
@ApiModelProperty(value = "应用名", required = true, example = "1")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "访问地址", required = true, example = "1")
|
||||
private String uri;
|
||||
|
||||
@ApiModelProperty(value = "请求参数", required = true, example = "1")
|
||||
private String queryString;
|
||||
|
||||
@ApiModelProperty(value = "http 请求方法", required = true, example = "1")
|
||||
private String method;
|
||||
|
||||
@ApiModelProperty(value = "User-Agent ", required = true, example = "1")
|
||||
private String userAgent;
|
||||
|
||||
@ApiModelProperty(value = "ip", required = true, example = "1")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "请求时间", required = true, example = "1")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "响应时长", required = true, example = "1")
|
||||
private Integer responseTime;
|
||||
|
||||
@ApiModelProperty(value = "错误码", required = true, example = "1")
|
||||
private Integer errorCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.system.application.vo.resource;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.resource.ResourceBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("资源树结构 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ResourceTreeNodeVO extends ResourceBO {
|
||||
|
||||
@ApiModelProperty(value = "子节点数组")
|
||||
private List<ResourceTreeNodeVO> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.mall.system.application.vo.resource;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("资源 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ResourceVO {
|
||||
|
||||
@ApiModelProperty(value = "资源编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "资源名字(标识)", required = true, example = "商品管理")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "资源类型", required = true, example = "1")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
|
||||
private String displayName;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "父级资源编号", required = true, example = "1", notes = "如果无父资源,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "操作", required = true, example = "/order/list")
|
||||
private String handler;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.system.application.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("角色拥有的资源 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RoleResourceTreeNodeVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
// @ApiModelProperty(value = "菜单名", required = true, example = "商品管理")
|
||||
// private String name;
|
||||
@ApiModelProperty(value = "菜单操作", required = true, example = "/order/list")
|
||||
private String handler;
|
||||
@ApiModelProperty(value = "父菜单编号", required = true, example = "1", notes = "如果无父菜单,则值为 0")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "1")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "菜单展示名", required = true, example = "商品管理")
|
||||
private String displayName;
|
||||
@ApiModelProperty(value = "子节点数组")
|
||||
private List<RoleResourceTreeNodeVO> children;
|
||||
|
||||
@ApiModelProperty(value = "是否授权", required = true, example = "true")
|
||||
private Boolean assigned;
|
||||
|
||||
}
|
||||
34
system/system-start/src/main/resources/application.yaml
Normal file
34
system/system-start/src/main/resources/application.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
spring:
|
||||
application:
|
||||
name: admin-application
|
||||
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
# Spring Cloud Sentinel 配置项
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
|
||||
eager: true # 项目启动时,直接连接到 Sentinel
|
||||
|
||||
# server
|
||||
server:
|
||||
port: 18083
|
||||
servlet:
|
||||
context-path: /admin-api/
|
||||
|
||||
admins:
|
||||
security:
|
||||
ignore_urls: /admin-api/admins/passport/login, /admin-api/admins/file/get_qiniu_token
|
||||
|
||||
# qiniu
|
||||
qiniu:
|
||||
access-key: YldfyUC7OewoWM63TPYTairqnq8GMJvNek9EGoID
|
||||
secret-key: zZ7Q8wwZRyaklVvkyLmVydA4WygOBqtc_gTYzalS
|
||||
bucket: onemall
|
||||
|
||||
swagger:
|
||||
enable: true # 暂时不去掉
|
||||
title: 管理员子系统
|
||||
description: 管理员子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.admin.application.controller
|
||||
Reference in New Issue
Block a user