22 changed files with 534 additions and 5 deletions
@ -0,0 +1,29 @@ |
|||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 移动端菜单分组 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/9/1 10:52 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AppMenuGroupDTO implements Serializable { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = 8979318364775500637L; |
||||
|
|
||||
|
/** |
||||
|
* 工作端菜单 |
||||
|
*/ |
||||
|
private List<AppMenuDTO> workMenu; |
||||
|
|
||||
|
/** |
||||
|
* 数据端菜单 |
||||
|
*/ |
||||
|
private List<AppMenuDTO> analysisMenu; |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.elink.esua.epdc.enums; |
||||
|
|
||||
|
/** |
||||
|
* 移动端菜单类别枚举 |
||||
|
* ALTER TABLE sys_app_menu ADD COLUMN `category` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单所属类别work(工作端);analysis(数据端)'; |
||||
|
* ALTER TABLE sys_app_menu_template ADD COLUMN `category` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单所属类别work(工作端);analysis(数据端)'; |
||||
|
* UPDATE sys_app_menu SET category = 'work'; |
||||
|
* UPDATE sys_app_menu_template SET category = 'work'; |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/9/1 13:34 |
||||
|
*/ |
||||
|
public enum AppMenuCategoryEnum { |
||||
|
/** |
||||
|
* 工作端/领导端 |
||||
|
*/ |
||||
|
WORK("work"), |
||||
|
|
||||
|
/** |
||||
|
* 数据端 |
||||
|
*/ |
||||
|
ANALYSIS("analysis"); |
||||
|
|
||||
|
private String value; |
||||
|
|
||||
|
AppMenuCategoryEnum(String value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
} |
@ -0,0 +1,77 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.controller.v2; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.api.version.ApiVersion; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.AppMenuGroupDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; |
||||
|
import com.elink.esua.epdc.service.AppMenuService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* APP菜单管理 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @since v1.0.0 2019-11-19 |
||||
|
*/ |
||||
|
@ApiVersion(2) |
||||
|
@RestController |
||||
|
@RequestMapping("appmenu" + Constant.VERSION_CONTROL) |
||||
|
public class AppMenuV2Controller { |
||||
|
|
||||
|
@Autowired |
||||
|
private AppMenuService appMenuService; |
||||
|
|
||||
|
/** |
||||
|
* 管理端角色修改页面,获取全部菜单 |
||||
|
* |
||||
|
* @param userDetail |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.AppMenuGroupDTO> |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/9/1 17:31 |
||||
|
*/ |
||||
|
@GetMapping("select") |
||||
|
public Result<AppMenuGroupDTO> select(UserDetail userDetail) { |
||||
|
AppMenuGroupDTO result = appMenuService.getUserMenuListV2(userDetail); |
||||
|
return new Result().ok(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 首页面板 获取工作端、数据端首页菜单 |
||||
|
* |
||||
|
* @param category {@link com.elink.esua.epdc.enums.AppMenuCategoryEnum} |
||||
|
* @param mobile 管理员手机号 |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO>> |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2020/9/1 17:30 |
||||
|
*/ |
||||
|
@GetMapping("/indexPanel/{category}/{mobile}") |
||||
|
public Result<List<EpdcAppIndexPanelResultDTO>> indexPanel(@PathVariable("category") String category, @PathVariable("mobile") String mobile) { |
||||
|
return new Result().ok(appMenuService.indexPanel(category, mobile)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,83 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.controller.v2; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.api.version.ApiVersion; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.SysRoleDTO; |
||||
|
import com.elink.esua.epdc.enums.AppMenuCategoryEnum; |
||||
|
import com.elink.esua.epdc.service.AppRoleMenuService; |
||||
|
import com.elink.esua.epdc.service.SysRoleDataScopeService; |
||||
|
import com.elink.esua.epdc.service.SysRoleMenuService; |
||||
|
import com.elink.esua.epdc.service.SysRoleService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 角色管理 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@ApiVersion(2) |
||||
|
@RestController |
||||
|
@RequestMapping("role" + Constant.VERSION_CONTROL) |
||||
|
public class SysRoleV2Controller { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysRoleService sysRoleService; |
||||
|
@Autowired |
||||
|
private SysRoleMenuService sysRoleMenuService; |
||||
|
@Autowired |
||||
|
private SysRoleDataScopeService sysRoleDataScopeService; |
||||
|
@Autowired |
||||
|
private AppRoleMenuService appRoleMenuService; |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<SysRoleDTO> get(@PathVariable("id") Long id) { |
||||
|
SysRoleDTO data = sysRoleService.get(id); |
||||
|
|
||||
|
//查询角色对应的菜单
|
||||
|
data.setMenuIdList(sysRoleMenuService.getMenuIdList(id)); |
||||
|
//查询角色对应的数据权限
|
||||
|
data.setDeptIdList(sysRoleDataScopeService.getDeptIdList(id)); |
||||
|
//查询角色对应app菜单权限
|
||||
|
data.setAppMenuIdList(appRoleMenuService.getAppMenuIdListV2(id, AppMenuCategoryEnum.WORK.getValue())); |
||||
|
//查询角色对应数据端菜单权限
|
||||
|
data.setAnalysisMenuIdList(appRoleMenuService.getAppMenuIdListV2(id, AppMenuCategoryEnum.ANALYSIS.getValue())); |
||||
|
//查询角色对应的项目处理类型权限
|
||||
|
data.setCategoryIdList(sysRoleService.getCategoryIdList(id)); |
||||
|
//查询角色对应的吹哨部门
|
||||
|
data.setWhistleDeptIdList(sysRoleService.getWhistleDeptIdList(id)); |
||||
|
|
||||
|
return new Result<SysRoleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody SysRoleDTO dto) { |
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
sysRoleService.saveV2(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody SysRoleDTO dto) { |
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
sysRoleService.updateV2(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.elink.esua.epdc.controller.v2; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.api.version.ApiVersion; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.Constant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; |
||||
|
import com.elink.esua.epdc.service.WorkUserService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 工作端,用户登录,用户管理相关接口 |
||||
|
* |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2019/11/18 10:45 |
||||
|
*/ |
||||
|
@ApiVersion(2) |
||||
|
@RestController |
||||
|
@RequestMapping("work/user" + Constant.VERSION_CONTROL) |
||||
|
public class ApiWorkUserV2Controller { |
||||
|
|
||||
|
@Autowired |
||||
|
private WorkUserService workUserService; |
||||
|
|
||||
|
/** |
||||
|
* 首页面板 获取工作端APP菜单 |
||||
|
* |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcIndexPanelResultDTO>> |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2019/11/20 10:42 |
||||
|
**/ |
||||
|
@GetMapping("indexPanel") |
||||
|
public Result<List<EpdcAppIndexPanelResultDTO>> indexPanel() { |
||||
|
return workUserService.indexPanelV2(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue