es日志打印去除,确认收货后加入去除重复日志筛选
This commit is contained in:
parent
ca48e78dd1
commit
48da403179
@ -1,13 +1,19 @@
|
||||
package com.suisung.mall.admin.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.admin.service.AdminBaseMenuService;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseMenu;
|
||||
import com.suisung.mall.common.modules.admin.Router;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -38,6 +44,18 @@ public class AdminBaseMenuController {
|
||||
return CommonResult.success(routers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户权限目录信息
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/treePage", method = RequestMethod.GET)
|
||||
public IPage<AdminBaseMenu> getRouterList(AdminBaseMenu adminBaseMenu, @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return adminBaseMenuService.treePage(adminBaseMenu,pageNum,pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有菜单配置
|
||||
*
|
||||
@ -83,6 +101,22 @@ public class AdminBaseMenuController {
|
||||
return adminBaseMenuService.updateAdminBaseMenu(adminBaseMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param menu_ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public CommonResult deleteBatch(String menu_ids) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseMenuService.remove(Arrays.asList(menu_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
package com.suisung.mall.admin.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import com.suisung.mall.admin.service.AdminBaseProtocolService;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -43,15 +42,11 @@ public class AdminBaseProtocolController {
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-分页列表查询", notes = "基础通信协议表-分页列表查询")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult list(@RequestParam(name = "queryWrapper", required = false) AdminBaseProtocol adminBaseProtocol,
|
||||
public CommonResult list(AdminBaseProtocol adminBaseProtocol,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("cmd_id");
|
||||
|
||||
IPage<AdminBaseProtocol> pageList = adminBaseProtocolService.lists(queryWrapper, pageNum, pageSize);
|
||||
return CommonResult.success(pageList);
|
||||
return CommonResult.success(adminBaseProtocolService.getPageAdminBaseProtocol(adminBaseProtocol, pageNum, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,9 +56,13 @@ public class AdminBaseProtocolController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-编辑", notes = "基础通信协议表-编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = adminBaseProtocolService.edit(adminBaseProtocol);
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public CommonResult edit(@RequestBody AdminBaseProtocol adminBaseProtocol) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.editAdminBaseProtocol(adminBaseProtocol);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -87,9 +86,13 @@ public class AdminBaseProtocolController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-批量删除", notes = "基础通信协议表-批量删除")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public CommonResult deleteBatch(@RequestParam(name = "cmd_ids") String cmd_ids) {
|
||||
boolean flag = adminBaseProtocolService.removeByIds(Arrays.asList(cmd_ids.split(",")));
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.deleteBatchByIds(Arrays.asList(cmd_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -111,10 +114,25 @@ public class AdminBaseProtocolController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-新增", notes = "基础通信协议表-新增")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.PUT)
|
||||
public CommonResult add(AdminBaseProtocol adminBaseProtocol) {
|
||||
boolean flag = adminBaseProtocolService.save(adminBaseProtocol);
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody AdminBaseProtocol adminBaseProtocol) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminBaseProtocolService.addAdminBaseProtocol(adminBaseProtocol);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查出路由,主要是显示平台权限名称和店铺权限名称
|
||||
* @param cmd_id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "基础通信协议表-查找单个协议", notes = "基础通信协议表-查找单个协议")
|
||||
@RequestMapping(value = "/getOneById", method = RequestMethod.GET)
|
||||
public CommonResult getOneById(@RequestParam(name = "cmd_id") Integer cmd_id) {
|
||||
return CommonResult.success(adminBaseProtocolService.getOneByCmId(cmd_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
package com.suisung.mall.admin.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.admin.service.AdminRightsBaseService;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.admin.AdminRightsBase;
|
||||
import com.suisung.mall.common.modules.admin.ElTree;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -40,7 +44,7 @@ public class AdminRightsBaseController {
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -分页列表查询", notes = "权限表 -分页列表查询")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult list(@RequestParam(name = "queryWrapper", required = false) AdminRightsBase adminRightsBase,
|
||||
public CommonResult list(AdminRightsBase adminRightsBase,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
@ -51,6 +55,21 @@ public class AdminRightsBaseController {
|
||||
return CommonResult.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 树形分页列表查询
|
||||
* @param adminRightsBase
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -树形分页列表查询", notes = "权限表 -树形分页列表查询")
|
||||
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
|
||||
public IPage<AdminRightsBase> treeList(AdminRightsBase adminRightsBase,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return adminRightsBaseService.treePage(adminRightsBase, pageNum, pageSize);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取tree数据
|
||||
@ -78,8 +97,12 @@ public class AdminRightsBaseController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -编辑", notes = "权限表 -编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(AdminRightsBase adminRightsBase) {
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public CommonResult edit(@RequestBody AdminRightsBase adminRightsBase) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminRightsBaseService.edit(adminRightsBase);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -94,6 +117,10 @@ public class AdminRightsBaseController {
|
||||
@ApiOperation(value = "权限表 -通过rights_id删除", notes = "权限表 -通过rights_id删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult delete(@RequestParam(name = "rights_id") String rights_id) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = adminRightsBaseService.remove(rights_id);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -105,8 +132,12 @@ public class AdminRightsBaseController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.POST)
|
||||
public CommonResult deleteBatch(@RequestParam(name = "rights_ids") String rights_ids) {
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public CommonResult deleteBatch(String rights_ids) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = this.adminRightsBaseService.remove(Arrays.asList(rights_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
@ -120,6 +151,13 @@ public class AdminRightsBaseController {
|
||||
@ApiOperation(value = "权限表 -新增", notes = "权限表 -编辑")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody AdminRightsBase adminRightsBase) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(adminRightsBase.getRights_parent_id())){
|
||||
adminRightsBase.setRights_parent_id(0);
|
||||
}
|
||||
boolean flag = adminRightsBaseService.save(adminRightsBase);
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.admin.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseMenu;
|
||||
import com.suisung.mall.common.modules.admin.Router;
|
||||
@ -32,4 +33,6 @@ public interface AdminBaseMenuService extends IBaseService<AdminBaseMenu> {
|
||||
CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu);
|
||||
|
||||
CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu);
|
||||
|
||||
IPage<AdminBaseMenu> treePage(AdminBaseMenu adminBaseMenu, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.admin.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
@ -21,4 +22,17 @@ public interface AdminBaseProtocolService extends IBaseService<AdminBaseProtocol
|
||||
* 初始化资源角色规则
|
||||
*/
|
||||
Map<String, List<String>> initResourceRolesMap();
|
||||
|
||||
/**
|
||||
* 分页查询路由
|
||||
*/
|
||||
IPage<AdminBaseProtocol> getPageAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol,Integer pageNum,Integer pageSize);
|
||||
|
||||
boolean addAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol);
|
||||
|
||||
boolean editAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol);
|
||||
|
||||
boolean deleteBatchByIds(List<String> adminBaseProtocolIds);
|
||||
|
||||
AdminBaseProtocol getOneByCmId(Integer cmId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.admin.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.modules.admin.AdminRightsBase;
|
||||
import com.suisung.mall.common.modules.admin.ElTree;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
@ -21,4 +22,9 @@ public interface AdminRightsBaseService extends IBaseService<AdminRightsBase> {
|
||||
* 获取tree数据
|
||||
*/
|
||||
List<ElTree> tree();
|
||||
|
||||
/**
|
||||
* 获取tree数据
|
||||
*/
|
||||
IPage<AdminRightsBase> treePage(AdminRightsBase adminRightsBase, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.suisung.mall.admin.mapper.AdminBaseMenuMapper;
|
||||
import com.suisung.mall.admin.service.AccountBaseConfigService;
|
||||
@ -870,6 +871,16 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
|
||||
|
||||
@Override
|
||||
public CommonResult saveAdminBaseMenu(AdminBaseMenu adminBaseMenu) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("没有权限");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_parent_id())){
|
||||
adminBaseMenu.setMenu_parent_id(0);
|
||||
}
|
||||
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_time())){
|
||||
adminBaseMenu.setMenu_time(new Date());
|
||||
}
|
||||
if (!save(adminBaseMenu)) {
|
||||
return CommonResult.failed("新增失败");
|
||||
}
|
||||
@ -878,12 +889,61 @@ public class AdminBaseMenuServiceImpl extends BaseServiceImpl<AdminBaseMenuMappe
|
||||
|
||||
@Override
|
||||
public CommonResult updateAdminBaseMenu(AdminBaseMenu adminBaseMenu) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("没有权限");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(adminBaseMenu.getMenu_time())){
|
||||
adminBaseMenu.setMenu_time(new Date());
|
||||
}
|
||||
if (!edit(adminBaseMenu)) {
|
||||
return CommonResult.failed("更新失败");
|
||||
}
|
||||
return CommonResult.success("更新成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AdminBaseMenu> treePage(AdminBaseMenu adminBaseMenu, Integer pageNum, Integer pageSize) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("没有权限");
|
||||
}
|
||||
QueryWrapper<AdminBaseMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByDesc("menu_id");
|
||||
if(adminBaseMenu!=null){
|
||||
if(StringUtils.isNotEmpty(adminBaseMenu.getMenu_name())){
|
||||
queryWrapper.like("menu_name", adminBaseMenu.getMenu_name());
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("menu_parent_id",0);
|
||||
IPage<AdminBaseMenu> pageList = this.lists(queryWrapper, pageNum, pageSize);
|
||||
List<AdminBaseMenu> adminBaseMenus= pageList.getRecords();
|
||||
adminBaseMenus=buildAdminBaseMenuTree(adminBaseMenus,0);
|
||||
pageList.setRecords(adminBaseMenus);
|
||||
return pageList;
|
||||
}
|
||||
/**
|
||||
* 递归构建tree
|
||||
*
|
||||
* @param bases
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
public List<AdminBaseMenu> buildAdminBaseMenuTree(List<AdminBaseMenu> bases, Integer pid) {
|
||||
List<AdminBaseMenu> tree = new ArrayList<>();
|
||||
bases.forEach(s -> {
|
||||
if (s.getMenu_parent_id().intValue() == pid.intValue()) {
|
||||
QueryWrapper<AdminBaseMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("menu_parent_id", s.getMenu_id());
|
||||
long countAdminRightsBase=this.count(queryWrapper);
|
||||
if(countAdminRightsBase>0){
|
||||
s.setChildren(buildAdminBaseMenuTree(this.list(queryWrapper), s.getMenu_id()));
|
||||
}
|
||||
tree.add(s);
|
||||
}
|
||||
});
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否为平台
|
||||
|
||||
@ -3,18 +3,30 @@ package com.suisung.mall.admin.service.impl;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.admin.mapper.AdminBaseProtocolMapper;
|
||||
import com.suisung.mall.admin.service.AdminBaseMenuService;
|
||||
import com.suisung.mall.admin.service.AdminBaseProtocolService;
|
||||
import com.suisung.mall.admin.service.AdminRightsBaseService;
|
||||
import com.suisung.mall.admin.service.AdminRightsGroupService;
|
||||
import com.suisung.mall.common.constant.AuthConstant;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.feignService.ShopService;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseMenu;
|
||||
import com.suisung.mall.common.modules.admin.AdminBaseProtocol;
|
||||
import com.suisung.mall.common.modules.admin.AdminRightsBase;
|
||||
import com.suisung.mall.common.modules.admin.AdminRightsGroup;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsBase;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import com.suisung.mall.core.web.service.RedisService;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.validator.internal.util.stereotypes.Lazy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
@ -38,6 +50,17 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AdminRightsBaseService adminRightsBaseService;
|
||||
|
||||
@Autowired
|
||||
private ShopService shopService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AdminBaseMenuService adminBaseMenuService;
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
@ -45,7 +68,15 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean add(AdminBaseProtocol adminBaseProtocol) {
|
||||
public boolean addAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol) {
|
||||
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("ctl",adminBaseProtocol.getCtl());
|
||||
queryWrapper.eq("met",adminBaseProtocol.getMet());
|
||||
queryWrapper.eq("mdu",adminBaseProtocol.getMdu());
|
||||
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
|
||||
if(!adminBaseProtocolList.isEmpty()){
|
||||
throw new ApiException("已存在相同的路由");
|
||||
}
|
||||
boolean flag = save(adminBaseProtocol);
|
||||
initResourceRolesMap();
|
||||
return flag;
|
||||
@ -58,25 +89,83 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean edit(AdminBaseProtocol adminBaseProtocol) {
|
||||
public boolean editAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol) {
|
||||
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("ctl",adminBaseProtocol.getCtl());
|
||||
queryWrapper.eq("met",adminBaseProtocol.getMet());
|
||||
queryWrapper.eq("mdu",adminBaseProtocol.getMdu());
|
||||
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
|
||||
if(!adminBaseProtocolList.isEmpty()){
|
||||
throw new ApiException("已存在相同的路由");
|
||||
}
|
||||
boolean flag = updateById(adminBaseProtocol);
|
||||
initResourceRolesMap();
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据cmd_id删除
|
||||
*
|
||||
* @param cmd_id
|
||||
* 根据cmd_id批量删除
|
||||
* @param adminBaseProtocolIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean remove(Serializable cmd_id) {
|
||||
boolean flag = super.remove(cmd_id);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteBatchByIds(List<String> adminBaseProtocolIds) {
|
||||
boolean flag = removeBatchByIds(adminBaseProtocolIds);
|
||||
initResourceRolesMap();
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminBaseProtocol getOneByCmId(Integer cmId) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("cmd_id",cmId);
|
||||
List<AdminBaseProtocol> adminBaseProtocolList=this.list(queryWrapper);
|
||||
if(adminBaseProtocolList.isEmpty()){
|
||||
throw new ApiException("不存在通信协议");
|
||||
}
|
||||
AdminBaseProtocol adminBaseProtocol=adminBaseProtocolList.get(0);
|
||||
String rigthsIds= adminBaseProtocol.getRights_id();
|
||||
if(StringUtils.isNotBlank(rigthsIds)){
|
||||
QueryWrapper<AdminBaseMenu> adminBaseMenuQuery = new QueryWrapper<>();
|
||||
adminBaseMenuQuery.eq("menu_url_path",adminBaseProtocol.getPath());
|
||||
List<AdminBaseMenu> adminBaseMenuList= adminBaseMenuService.list(adminBaseMenuQuery);
|
||||
if(adminBaseMenuList.isEmpty()){
|
||||
throw new ApiException("需要配置菜单");
|
||||
}
|
||||
List<String> rightsIdList= Arrays.asList(rigthsIds.split(","));
|
||||
List<Integer> rightsIdsIntList=new ArrayList<>();
|
||||
rightsIdList.forEach(s->rightsIdsIntList.add(Integer.parseInt(s)));
|
||||
QueryWrapper<AdminRightsBase> adminRightsBaseQuery = new QueryWrapper<>();
|
||||
adminRightsBaseQuery.in("rights_id",rightsIdsIntList);
|
||||
List<AdminRightsBase> adminRightsBaseList= adminRightsBaseService.list(adminRightsBaseQuery);
|
||||
AdminBaseMenu adminBaseMenu=adminBaseMenuList.get(0);
|
||||
if(!adminRightsBaseList.isEmpty()){
|
||||
adminRightsBaseList= adminRightsBaseList.stream().filter(s->s.getRights_name().equals(adminBaseMenu.getMenu_name())).collect(Collectors.toList());
|
||||
Map<Integer,String> adminRightBaseMap=adminRightsBaseList.stream().collect(
|
||||
Collectors.toMap(AdminRightsBase::getRights_id,
|
||||
AdminRightsBase::getRights_name));
|
||||
adminBaseProtocol.setAdminRightBaseMap(adminRightBaseMap);
|
||||
}
|
||||
QueryWrapper<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBasesQuery = new QueryWrapper<>();
|
||||
shopStoreEmployeeRightsBasesQuery.in("rights_id",rightsIdsIntList);
|
||||
List<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBases= shopService.queryByRightsIds(rigthsIds);
|
||||
if(!shopStoreEmployeeRightsBases.isEmpty()){
|
||||
shopStoreEmployeeRightsBases= shopStoreEmployeeRightsBases.stream().filter(s->s.getRights_name().equals(adminBaseMenu.getMenu_name())).collect(Collectors.toList());
|
||||
Map<Integer,String> shopStoreEmployeeRightsBaseMap=shopStoreEmployeeRightsBases.stream().collect(
|
||||
Collectors.toMap(ShopStoreEmployeeRightsBase::getRights_id,
|
||||
ShopStoreEmployeeRightsBase::getRights_name));
|
||||
adminBaseProtocol.setShopStoreEmployeeRightsBaseMap(shopStoreEmployeeRightsBaseMap);
|
||||
}
|
||||
|
||||
}
|
||||
return adminBaseProtocol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> initResourceRolesMap() {
|
||||
// 资源-分组信息
|
||||
@ -108,6 +197,28 @@ public class AdminBaseProtocolServiceImpl extends BaseServiceImpl<AdminBaseProto
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AdminBaseProtocol> getPageAdminBaseProtocol(AdminBaseProtocol adminBaseProtocol, Integer pageNum, Integer pageSize) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
QueryWrapper<AdminBaseProtocol> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("cmd_id");
|
||||
if(adminBaseProtocol!=null){
|
||||
if(StringUtils.isNotBlank(adminBaseProtocol.getComment())){
|
||||
queryWrapper.like("comment", adminBaseProtocol.getComment());
|
||||
}
|
||||
if(StringUtils.isNotBlank(adminBaseProtocol.getCtl())){
|
||||
queryWrapper.like("ctl", adminBaseProtocol.getCtl());
|
||||
}
|
||||
}
|
||||
return this.lists(queryWrapper, pageNum, pageSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 对比两个数组是否有相同元素
|
||||
*
|
||||
|
||||
@ -2,11 +2,16 @@ package com.suisung.mall.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.admin.mapper.AdminRightsBaseMapper;
|
||||
import com.suisung.mall.admin.service.AccountBaseConfigService;
|
||||
import com.suisung.mall.admin.service.AdminRightsBaseService;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.admin.AdminRightsBase;
|
||||
import com.suisung.mall.common.modules.admin.ElTree;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -48,6 +53,59 @@ public class AdminRightsBaseServiceImpl extends BaseServiceImpl<AdminRightsBaseM
|
||||
return BuildTree(list, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AdminRightsBase> treePage(AdminRightsBase adminRightsBase, Integer pageNum, Integer pageSize) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("没有权限");
|
||||
}
|
||||
QueryWrapper<AdminRightsBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("rights_id");
|
||||
if(adminRightsBase!=null){
|
||||
if(StringUtils.isNotEmpty(adminRightsBase.getRights_name())){
|
||||
queryWrapper.like("rights_name", adminRightsBase.getRights_name());
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("rights_parent_id",0);
|
||||
IPage<AdminRightsBase> pageList = this.lists(queryWrapper, pageNum, pageSize);
|
||||
List<AdminRightsBase> adminRightsBases= pageList.getRecords();
|
||||
adminRightsBases=buildAdminRightBaseTree(adminRightsBases,0);
|
||||
pageList.setRecords(adminRightsBases);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归构建tree
|
||||
*
|
||||
* @param bases
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
public List<AdminRightsBase> buildAdminRightBaseTree(List<AdminRightsBase> bases, Integer pid) {
|
||||
List<AdminRightsBase> tree = new ArrayList<>();
|
||||
bases.forEach(s -> {
|
||||
if (s.getRights_parent_id().intValue() == pid.intValue()) {
|
||||
AdminRightsBase adminRightsBase=new AdminRightsBase();
|
||||
adminRightsBase.setRights_id(s.getRights_id());
|
||||
adminRightsBase.setRights_name(s.getRights_name());
|
||||
adminRightsBase.setRights_parent_id(s.getRights_parent_id());
|
||||
adminRightsBase.setRights_order(s.getRights_order());
|
||||
adminRightsBase.setRights_remark(s.getRights_remark());
|
||||
adminRightsBase.setMenu_func(s.getMenu_func());
|
||||
// adminRightsBase.setChildren(buildAdminRightBaseTree(bases, s.getRights_id()));
|
||||
QueryWrapper<AdminRightsBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("rights_parent_id", s.getRights_id());
|
||||
long countAdminRightsBase=this.count(queryWrapper);
|
||||
if(countAdminRightsBase>0){
|
||||
adminRightsBase.setChildren(buildAdminRightBaseTree(this.list(queryWrapper), s.getRights_id()));
|
||||
}
|
||||
tree.add(adminRightsBase);
|
||||
}
|
||||
});
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归构建tree
|
||||
*
|
||||
|
||||
@ -18,10 +18,7 @@ import com.suisung.mall.common.modules.pay.dto.ItemActivityInfoDTO;
|
||||
import com.suisung.mall.common.modules.plantform.ShopPlantformSubsiteUser;
|
||||
import com.suisung.mall.common.modules.product.ShopProductBase;
|
||||
import com.suisung.mall.common.modules.product.ShopProductIndex;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployee;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeKefu;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsGroup;
|
||||
import com.suisung.mall.common.modules.store.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
@ -337,5 +334,7 @@ public interface ShopService {
|
||||
Integer storeShoppingFeeInner(@RequestParam(name = "store_id") Integer store_id);
|
||||
|
||||
|
||||
@GetMapping(value = "/admin/shop/shop-store-employee-rights-base/queryByRightsIds")
|
||||
List<ShopStoreEmployeeRightsBase> queryByRightsIds(@RequestParam(name = "rights_ids") String rights_ids);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -11,6 +12,7 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -105,5 +107,7 @@ public class AdminBaseMenu implements Serializable {
|
||||
@ApiModelProperty(value = "允许关闭(BOOL):0-禁止;1-允许")
|
||||
private Integer menu_close;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
private List<AdminBaseMenu> children;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -61,5 +63,11 @@ public class AdminBaseProtocol implements Serializable {
|
||||
@ApiModelProperty(value = "请求地址")
|
||||
private String path;
|
||||
|
||||
//平台权限id和名称
|
||||
@TableField(exist = false)
|
||||
private Map<Integer,String> adminRightBaseMap;
|
||||
|
||||
//店铺权限id和名称
|
||||
@TableField(exist = false)
|
||||
private Map<Integer,String> shopStoreEmployeeRightsBaseMap;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.common.modules.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -47,5 +49,7 @@ public class AdminRightsBase implements Serializable {
|
||||
@ApiModelProperty(value = "功能开启:跟设置config_key")
|
||||
private String menu_func;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
@TableField(exist = false)
|
||||
private List<AdminRightsBase> children;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.suisung.mall.common.modules.store;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -47,5 +49,7 @@ public class ShopStoreEmployeeRightsBase implements Serializable {
|
||||
@ApiModelProperty(value = "功能开启:跟设置config_key")
|
||||
private String menu_func;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "节点子集")
|
||||
@TableField(exist = false)
|
||||
private List<ShopStoreEmployeeRightsBase> children;
|
||||
}
|
||||
|
||||
@ -1,16 +1,21 @@
|
||||
package com.suisung.mall.shop.store.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsBase;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreEmployeeRightsBaseService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -52,29 +57,94 @@ public class ShopStoreEmployeeRightsBaseController {
|
||||
return CommonResult.success(shopStoreEmployeeRightsBaseService.getRightsBaseTree());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param shopStoreEmployeeRightsBase
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -分页列表查询", notes = "权限表 -分页列表查询")
|
||||
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
|
||||
public IPage<ShopStoreEmployeeRightsBase> treeList(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return shopStoreEmployeeRightsBaseService.treePage(shopStoreEmployeeRightsBase, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑新增
|
||||
* @param shopStoreEmployeeRightsBase
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -新增", notes = "权限表 -新增")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult add(@RequestBody ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase) {
|
||||
return shopStoreEmployeeRightsBaseService.addShopStoreEmployeeRightsBase(shopStoreEmployeeRightsBase);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑更新
|
||||
*
|
||||
* @param shopStoreEmployeeRightsBase
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -编辑", notes = "权限表 -编辑")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult edit(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase) {
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public CommonResult edit(@RequestBody ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
return CommonResult.success(shopStoreEmployeeRightsBaseService.edit(shopStoreEmployeeRightsBase));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过rights_id删除
|
||||
*
|
||||
* @param rights_id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -通过rights_id删除", notes = "权限表 -通过rights_id删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult delete(@RequestParam(name = "rights_id") String rights_id) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
return CommonResult.success(shopStoreEmployeeRightsBaseService.remove(rights_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param rights_ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -批量删除", notes = "权限表 -批量删除")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public CommonResult deleteBatch(String rights_ids) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
boolean flag = shopStoreEmployeeRightsBaseService.remove(Arrays.asList(rights_ids.split(",")));
|
||||
return CommonResult.success(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询列表
|
||||
* @param rights_ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "权限表 -根据id查询列表", notes = "权限表 -根据id查询列表")
|
||||
@RequestMapping(value = "/queryByRightsIds", method = RequestMethod.GET)
|
||||
public List<ShopStoreEmployeeRightsBase> queryByRightsIds(String rights_ids) {
|
||||
QueryWrapper<ShopStoreEmployeeRightsBase> queryWrapper = new QueryWrapper<>();
|
||||
List<String> rights_idListStr = Arrays.asList(rights_ids.split(","));
|
||||
List<Integer> rights_idList=new ArrayList<>();
|
||||
rights_idListStr.forEach(r->rights_idList.add(Integer.parseInt(r)));
|
||||
queryWrapper.in("rights_id",rights_idList);
|
||||
return shopStoreEmployeeRightsBaseService.list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.suisung.mall.shop.store.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsBase;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
@ -19,4 +21,11 @@ public interface ShopStoreEmployeeRightsBaseService extends IBaseService<ShopSto
|
||||
|
||||
List<Map> getRightsBaseTree();
|
||||
|
||||
/**
|
||||
* 获取tree数据
|
||||
*/
|
||||
IPage<ShopStoreEmployeeRightsBase> treePage(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase, Integer pageNum, Integer pageSize);
|
||||
|
||||
CommonResult addShopStoreEmployeeRightsBase(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase);
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,12 @@ package com.suisung.mall.shop.store.service.impl;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsBase;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||
import com.suisung.mall.shop.store.mapper.ShopStoreEmployeeRightsBaseMapper;
|
||||
@ -47,6 +52,67 @@ public class ShopStoreEmployeeRightsBaseServiceImpl extends BaseServiceImpl<Shop
|
||||
return buildTree(list, 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ShopStoreEmployeeRightsBase> treePage(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase, Integer pageNum, Integer pageSize) {
|
||||
QueryWrapper<ShopStoreEmployeeRightsBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("rights_id");
|
||||
|
||||
if(shopStoreEmployeeRightsBase!=null){
|
||||
if(com.suisung.mall.common.utils.StringUtils.isNotEmpty(shopStoreEmployeeRightsBase.getRights_name())){
|
||||
queryWrapper.like("rights_name", shopStoreEmployeeRightsBase.getRights_name());
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("rights_parent_id",8);
|
||||
IPage<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBaseIPage= this.lists(queryWrapper, pageNum, pageSize);
|
||||
List<ShopStoreEmployeeRightsBase> shopStoreEmployeeRightsBases= shopStoreEmployeeRightsBaseIPage.getRecords();
|
||||
shopStoreEmployeeRightsBases=buildShopStoreEmployeeRightsBaseTree(shopStoreEmployeeRightsBases,8);
|
||||
shopStoreEmployeeRightsBaseIPage.setRecords(shopStoreEmployeeRightsBases);
|
||||
return shopStoreEmployeeRightsBaseIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult addShopStoreEmployeeRightsBase(ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase) {
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
if(userDto.getRole_id()!=9){
|
||||
throw new ApiException("权限不足");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(shopStoreEmployeeRightsBase.getRights_parent_id())){
|
||||
shopStoreEmployeeRightsBase.setRights_parent_id(8);
|
||||
}
|
||||
this.save(shopStoreEmployeeRightsBase);
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归构建tree
|
||||
*
|
||||
* @param bases
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
public List<ShopStoreEmployeeRightsBase> buildShopStoreEmployeeRightsBaseTree(List<ShopStoreEmployeeRightsBase> bases, Integer pid) {
|
||||
List<ShopStoreEmployeeRightsBase> tree = new ArrayList<>();
|
||||
bases.forEach(s -> {
|
||||
if (ObjectUtil.equal(s.getRights_parent_id(),pid)) {
|
||||
ShopStoreEmployeeRightsBase shopStoreEmployeeRightsBase=new ShopStoreEmployeeRightsBase();
|
||||
shopStoreEmployeeRightsBase.setRights_id(s.getRights_id());
|
||||
shopStoreEmployeeRightsBase.setRights_name(s.getRights_name());
|
||||
shopStoreEmployeeRightsBase.setRights_parent_id(s.getRights_parent_id());
|
||||
shopStoreEmployeeRightsBase.setRights_order(s.getRights_order());
|
||||
shopStoreEmployeeRightsBase.setRights_remark(s.getRights_remark());
|
||||
shopStoreEmployeeRightsBase.setMenu_func(s.getMenu_func());
|
||||
QueryWrapper<ShopStoreEmployeeRightsBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("rights_parent_id", s.getRights_id());
|
||||
long countAdminRightsBase=this.count(queryWrapper);
|
||||
if(countAdminRightsBase>0){
|
||||
shopStoreEmployeeRightsBase.setChildren(buildShopStoreEmployeeRightsBaseTree(this.list(queryWrapper), s.getRights_id()));
|
||||
}
|
||||
tree.add(shopStoreEmployeeRightsBase);
|
||||
}
|
||||
});
|
||||
return tree;
|
||||
}
|
||||
|
||||
private List<Map> buildTree(List<Map> employeeRightsBaseList, Integer pid) {
|
||||
List<Map> tree = new ArrayList<>();
|
||||
|
||||
@ -61,4 +127,6 @@ public class ShopStoreEmployeeRightsBaseServiceImpl extends BaseServiceImpl<Shop
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
5
sql/shop/dev/20251201_ddl.sql
Normal file
5
sql/shop/dev/20251201_ddl.sql
Normal file
@ -0,0 +1,5 @@
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/admin/admin-base-protocol/list', 'index', 'master', '', '0', '/admin/admin/admin-base-protocol/list','基础通信协议');
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/admin/admin-base-protocol/add', 'index', 'master', '', '0', '/admin/admin/admin-base-protocol/add','基础通信协议新增');
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/admin/admin-base-protocol/edit', 'index', 'master', '', '0', '/admin/admin/admin-base-protocol/edit','基础通信协议修改');
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/admin/admin-base-protocol/deleteBatch', 'index', 'master', '', '0', '/admin/admin/admin-base-protocol/deleteBatch','基础通信协议删除');
|
||||
INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`,`comment`) VALUES ('/admin/admin/admin-base-protocol/getOneById', 'index', 'master', '', '0', '/admin/admin/admin-base-protocol/getOneById','基础通信协议单个查询');
|
||||
Loading…
Reference in New Issue
Block a user