22 changed files with 1696 additions and 5 deletions
@ -0,0 +1,141 @@ |
|||
/** |
|||
* 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.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Range; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class SysAnalysisMenuDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@NotNull(message = "{id.require}", groups = UpdateGroup.class) |
|||
private Long id; |
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
@NotNull(message = "{sysmenu.pid.require}", groups = DefaultGroup.class) |
|||
private Long pid; |
|||
|
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
@Range(min = 0, max = 1, message = "{sysmenu.type.range}", groups = DefaultGroup.class) |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
|
|||
/** |
|||
* 样式名称 |
|||
*/ |
|||
private String className; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class) |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 删除标识 0:未删除 1:删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private Long creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) |
|||
private Date createDate; |
|||
|
|||
/** |
|||
* 更新者 |
|||
*/ |
|||
private Long updater; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 菜单编码 |
|||
*/ |
|||
private String menuCode; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 子模板ID |
|||
*/ |
|||
private String templateId; |
|||
|
|||
@NotBlank(message = "{sysmenu.name.require}", groups = DefaultGroup.class) |
|||
private String name; |
|||
|
|||
/** |
|||
* 是否显示数字 0否 1是 |
|||
*/ |
|||
private String numFlag; |
|||
|
|||
//虚字段
|
|||
|
|||
/** |
|||
* 上级菜单名称 |
|||
*/ |
|||
private String parentName; |
|||
|
|||
/** |
|||
* 模块名称 |
|||
*/ |
|||
private String modelname; |
|||
|
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* 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.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class SysAnalysisRoleMenuDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 菜单ID |
|||
*/ |
|||
private Long menuId; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private Long creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
} |
@ -0,0 +1,132 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.exception.ErrorCode; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
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.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO; |
|||
import com.elink.esua.epdc.excel.*; |
|||
import com.elink.esua.epdc.service.SysAnalysisMenuService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("analysismenu") |
|||
public class SysAnalysisMenuController { |
|||
|
|||
@Autowired |
|||
private SysAnalysisMenuService sysAnalysisMenuService; |
|||
|
|||
/** |
|||
* 获取APP菜单列表 |
|||
* |
|||
* @param type 菜单类型 0:菜单 1:按钮 null:全部 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.AppMenuDTO>> |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 13:26 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<List<AppMenuDTO>> list(Integer type) { |
|||
List<AppMenuDTO> list = sysAnalysisMenuService.getAnalysisMenuList(type); |
|||
return new Result<List<AppMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<SysAnalysisMenuDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<SysAnalysisMenuDTO> page = sysAnalysisMenuService.page(params); |
|||
return new Result<PageData<SysAnalysisMenuDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<SysAnalysisMenuDTO> get(@PathVariable("id") String id){ |
|||
SysAnalysisMenuDTO data = sysAnalysisMenuService.get(id); |
|||
return new Result<SysAnalysisMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody SysAnalysisMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
sysAnalysisMenuService.save(dto); |
|||
return new Result(); |
|||
} |
|||
@GetMapping("select") |
|||
public Result<List<AppMenuDTO>> select(UserDetail userDetail) { |
|||
List<AppMenuDTO> list = sysAnalysisMenuService.getUserMenuList(userDetail, null); |
|||
|
|||
return new Result<List<AppMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody SysAnalysisMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
sysAnalysisMenuService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping("{id}") |
|||
public Result delete(@PathVariable("id") Long id){ |
|||
//效验数据
|
|||
AssertUtils.isNull(id, "id"); |
|||
//判断是否有子菜单或按钮
|
|||
if(sysAnalysisMenuService.hasChileMenu(id)){ |
|||
return new Result().error(ErrorCode.SUB_MENU_EXIST); |
|||
} |
|||
sysAnalysisMenuService.delete(id); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<SysAnalysisMenuDTO> list = sysAnalysisMenuService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, SysAnalysisMenuExcel.class); |
|||
} |
|||
/** |
|||
* @param userId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO>> |
|||
* @Author lpf |
|||
* @Description 首页面板 获取数据端APP菜单 |
|||
* @Date 2020/03/18 10:42 |
|||
**/ |
|||
@GetMapping("/analysisIndexPanel/{userId}") |
|||
public Result<List<EpdcAppChildNavResultDTO>> analysisIndexPanel(@PathVariable("userId") String userId) { |
|||
return sysAnalysisMenuService.getAnalysisIndexPanel(userId); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
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.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import com.elink.esua.epdc.excel.*; |
|||
import com.elink.esua.epdc.service.SysAnalysisRoleMenuService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("analysisrolemenu") |
|||
public class SysAnalysisRoleMenuController { |
|||
|
|||
@Autowired |
|||
private SysAnalysisRoleMenuService sysAnalysisRoleMenuService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<SysAnalysisRoleMenuDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<SysAnalysisRoleMenuDTO> page = sysAnalysisRoleMenuService.page(params); |
|||
return new Result<PageData<SysAnalysisRoleMenuDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<SysAnalysisRoleMenuDTO> get(@PathVariable("id") String id){ |
|||
SysAnalysisRoleMenuDTO data = sysAnalysisRoleMenuService.get(id); |
|||
return new Result<SysAnalysisRoleMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody SysAnalysisRoleMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
sysAnalysisRoleMenuService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody SysAnalysisRoleMenuDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
sysAnalysisRoleMenuService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
sysAnalysisRoleMenuService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<SysAnalysisRoleMenuDTO> list = sysAnalysisRoleMenuService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, SysAnalysisRoleMenuExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* 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.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.AppMenuDTO; |
|||
import com.elink.esua.epdc.dto.SysAnalysisMenuDTO; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO; |
|||
import com.elink.esua.epdc.entity.AppMenuEntity; |
|||
import com.elink.esua.epdc.entity.SysAnalysisMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Mapper |
|||
public interface SysAnalysisMenuDao extends BaseDao<SysAnalysisMenuEntity> { |
|||
|
|||
/** |
|||
* @param userId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO>> |
|||
* @Author lpf |
|||
* @Description 首页面板 获取数据端APP菜单 |
|||
* @Date 2020/03/18 10:42 |
|||
**/ |
|||
List<EpdcAppChildNavResultDTO> getAnalysisIndexPanel(String userId); |
|||
|
|||
/** |
|||
* 获取菜单详细信息 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
SysAnalysisMenuDTO selectByIdDIY(@Param("id") String id, @Param("language") String language); |
|||
|
|||
/** |
|||
* 查询所有菜单列表 |
|||
* |
|||
* @param type 菜单类型 |
|||
* @param language 语言 |
|||
*/ |
|||
List<AppMenuEntity> getMenuList(@Param("type") Integer type, @Param("language") String language); |
|||
|
|||
/** |
|||
* 查询用户菜单列表 |
|||
* |
|||
* @param userId 用户ID |
|||
* @param type 菜单类型 |
|||
* @param language 语言 |
|||
*/ |
|||
List<AppMenuEntity> getUserMenuList(@Param("userId") Long userId, @Param("type") Integer type, @Param("language") String language); |
|||
|
|||
/** |
|||
* 获取app菜单列表 |
|||
* |
|||
* @param type 菜单类型 |
|||
* @param language 语言 |
|||
* @return java.util.List<com.elink.esua.epdc.dto.AppMenuDTO> |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 13:43 |
|||
*/ |
|||
List<AppMenuDTO> selectListAppMenu(@Param("type") Integer type, @Param("language") String language); |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
/** |
|||
* 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.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.SysAnalysisRoleMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Mapper |
|||
public interface SysAnalysisRoleMenuDao extends BaseDao<SysAnalysisRoleMenuEntity> { |
|||
|
|||
/** |
|||
* 根据角色id,删除角色数据权限关系 |
|||
* |
|||
* @param roleId 角色id |
|||
*/ |
|||
void deleteByRoleId(Long roleId); |
|||
|
|||
/** |
|||
* 根据角色ID,获取菜单ID列表 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
List<Long> getAnalysisMenuIdList(Long id); |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
/** |
|||
* 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.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("sys_analysis_menu") |
|||
public class SysAnalysisMenuEntity extends BaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
private Long pid; |
|||
|
|||
/** |
|||
* 菜单名称 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String name; |
|||
|
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
|
|||
/** |
|||
* 样式名称 |
|||
*/ |
|||
private String className; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 删除标识 0:未删除 1:删除 |
|||
*/ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 更新者 |
|||
*/ |
|||
@TableField(fill = FieldFill.INSERT_UPDATE) |
|||
private Long updater; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@TableField(fill = FieldFill.INSERT_UPDATE) |
|||
private Date updateDate; |
|||
|
|||
/** |
|||
* 上级菜单名称 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String parentName; |
|||
|
|||
/** |
|||
* 菜单编码 |
|||
*/ |
|||
private String menuCode; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 子模板ID |
|||
*/ |
|||
private String templateId; |
|||
|
|||
/** |
|||
* 是否显示数字 0否 1是 |
|||
*/ |
|||
private String numFlag; |
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* 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.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("sys_analysis_role_menu") |
|||
public class SysAnalysisRoleMenuEntity extends BaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 菜单ID |
|||
*/ |
|||
private Long menuId; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private Long creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
/** |
|||
* 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.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class SysAnalysisMenuExcel { |
|||
|
|||
@Excel(name = "id") |
|||
private Long id; |
|||
|
|||
@Excel(name = "上级ID,一级菜单为0") |
|||
private Long pid; |
|||
|
|||
@Excel(name = "类型 0:菜单 1:按钮") |
|||
private Integer type; |
|||
|
|||
@Excel(name = "模块名称") |
|||
private String modelname; |
|||
|
|||
@Excel(name = "菜单图标") |
|||
private String icon; |
|||
|
|||
@Excel(name = "样式名称") |
|||
private String className; |
|||
|
|||
@Excel(name = "菜单编码(议题管理-待回应:10001,议题管理-待处理:10002,项目管理-待处理:10003,用户管理-待认证居民:10004,消息:10005)") |
|||
private String menuCode; |
|||
|
|||
@Excel(name = "模板ID") |
|||
private String templateId; |
|||
|
|||
@Excel(name = "是否显示数字 0否 1是") |
|||
private String numFlag; |
|||
|
|||
@Excel(name = "排序") |
|||
private Integer sort; |
|||
|
|||
@Excel(name = "备注") |
|||
private String remark; |
|||
|
|||
@Excel(name = "删除标识 0:未删除 1:删除") |
|||
private Integer delFlag; |
|||
|
|||
@Excel(name = "创建者") |
|||
private Long creator; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createDate; |
|||
|
|||
@Excel(name = "更新者") |
|||
private Long updater; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updateDate; |
|||
|
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
/** |
|||
* 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.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Data |
|||
public class SysAnalysisRoleMenuExcel { |
|||
|
|||
@Excel(name = "id") |
|||
private Long id; |
|||
|
|||
@Excel(name = "角色ID") |
|||
private Long roleId; |
|||
|
|||
@Excel(name = "菜单ID") |
|||
private Long menuId; |
|||
|
|||
@Excel(name = "创建者") |
|||
private Long creator; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createDate; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Component |
|||
public class SysAnalysisMenuRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Component |
|||
public class SysAnalysisRoleMenuRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,125 @@ |
|||
/** |
|||
* 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.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
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.epdc.result.EpdcAppChildNavResultDTO; |
|||
import com.elink.esua.epdc.entity.SysAnalysisMenuEntity; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
public interface SysAnalysisMenuService extends BaseService<SysAnalysisMenuEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<SysAnalysisMenuDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
PageData<SysAnalysisMenuDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<SysAnalysisMenuDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
List<SysAnalysisMenuDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 判断是否有子级菜单 |
|||
* |
|||
* @param id 菜单ID |
|||
* @return boolean |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 14:30 |
|||
*/ |
|||
boolean hasChileMenu(Long id); |
|||
|
|||
List<AppMenuDTO> getAnalysisMenuList(Integer type); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return SysAnalysisMenuDTO |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
SysAnalysisMenuDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void save(SysAnalysisMenuDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void update(SysAnalysisMenuDTO dto); |
|||
|
|||
/** |
|||
* 用户app端菜单列表 |
|||
* |
|||
* @param userDetail 用户信息 |
|||
* @param type 菜单类型 |
|||
*/ |
|||
List<AppMenuDTO> getUserMenuList(UserDetail userDetail, Integer type); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void delete(Long id); |
|||
/** |
|||
* @param userId |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO>> |
|||
* @Author lpf |
|||
* @Description 首页面板 获取数据端APP菜单 |
|||
* @Date 2020/03/18 10:42 |
|||
**/ |
|||
Result<List<EpdcAppChildNavResultDTO>> getAnalysisIndexPanel(String userId); |
|||
} |
@ -0,0 +1,111 @@ |
|||
/** |
|||
* 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.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import com.elink.esua.epdc.entity.SysAnalysisRoleMenuEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
public interface SysAnalysisRoleMenuService extends BaseService<SysAnalysisRoleMenuEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<SysAnalysisRoleMenuDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
PageData<SysAnalysisRoleMenuDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<SysAnalysisRoleMenuDTO> |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
List<SysAnalysisRoleMenuDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 保存或修改 |
|||
* |
|||
* @param roleId 角色ID |
|||
* @param analysisMenuIdList 菜单ID列表 |
|||
*/ |
|||
void saveOrUpdate(Long roleId, List<Long> analysisMenuIdList); |
|||
|
|||
/** |
|||
* 根据角色id,删除角色数据权限关系 |
|||
* |
|||
* @param roleId 角色id |
|||
*/ |
|||
void deleteByRoleId(Long roleId); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return SysAnalysisRoleMenuDTO |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
SysAnalysisRoleMenuDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void save(SysAnalysisRoleMenuDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void update(SysAnalysisRoleMenuDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-25 |
|||
*/ |
|||
void delete(String[] ids); |
|||
List<Long> getAnalysisMenuIdList(Long id); |
|||
} |
@ -0,0 +1,162 @@ |
|||
/** |
|||
* 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.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.enums.DelFlagEnum; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.enums.SuperAdminEnum; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.HttpContextUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.utils.TreeUtils; |
|||
import com.elink.esua.epdc.dao.SysAnalysisMenuDao; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO; |
|||
import com.elink.esua.epdc.entity.AppMenuEntity; |
|||
import com.elink.esua.epdc.entity.SysAnalysisMenuEntity; |
|||
import com.elink.esua.epdc.enums.MenuTableEnum; |
|||
import com.elink.esua.epdc.redis.SysAnalysisMenuRedis; |
|||
import com.elink.esua.epdc.service.SysAnalysisMenuService; |
|||
import com.elink.esua.epdc.service.SysLanguageService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Service |
|||
public class SysAnalysisMenuServiceImpl extends BaseServiceImpl<SysAnalysisMenuDao, SysAnalysisMenuEntity> implements SysAnalysisMenuService { |
|||
|
|||
@Autowired |
|||
private SysAnalysisMenuRedis sysAnalysisMenuRedis; |
|||
@Autowired |
|||
private SysLanguageService sysLanguageService; |
|||
|
|||
@Override |
|||
public PageData<SysAnalysisMenuDTO> page(Map<String, Object> params) { |
|||
IPage<SysAnalysisMenuEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, SysAnalysisMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<SysAnalysisMenuDTO> list(Map<String, Object> params) { |
|||
List<SysAnalysisMenuEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, SysAnalysisMenuDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<SysAnalysisMenuEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<SysAnalysisMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
@Override |
|||
public List<AppMenuDTO> getAnalysisMenuList(Integer type) { |
|||
List<AppMenuDTO> menuList = baseDao.selectListAppMenu(type, HttpContextUtils.getLanguage()); |
|||
return TreeUtils.build(menuList, Constant.MENU_ROOT); |
|||
} |
|||
|
|||
@Override |
|||
public SysAnalysisMenuDTO get(String id) { |
|||
SysAnalysisMenuDTO dto = baseDao.selectByIdDIY(id,HttpContextUtils.getLanguage()); |
|||
return dto; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(SysAnalysisMenuDTO dto) { |
|||
SysAnalysisMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysAnalysisMenuEntity.class); |
|||
insert(entity); |
|||
sysLanguageService.saveOrUpdate(MenuTableEnum.ANALYSIS.value(), entity.getId(), "name", dto.getName(), HttpContextUtils.getLanguage()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SysAnalysisMenuDTO dto) { |
|||
SysAnalysisMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysAnalysisMenuEntity.class); |
|||
updateById(entity); |
|||
sysLanguageService.saveOrUpdate(MenuTableEnum.ANALYSIS.value(), entity.getId(), "name", dto.getName(), HttpContextUtils.getLanguage()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(Long id) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteById(id); |
|||
} |
|||
@Override |
|||
public boolean hasChileMenu(Long id) { |
|||
QueryWrapper<SysAnalysisMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("pid", id) |
|||
.eq(FieldConstant.DEL_FLAG, DelFlagEnum.NORMAL.value()); |
|||
Integer selectCount = baseDao.selectCount(wrapper); |
|||
return selectCount > NumConstant.ZERO; |
|||
} |
|||
/** |
|||
* 用户app端菜单列表 |
|||
* |
|||
* @param userDetail 用户信息 |
|||
* @param type 菜单类型 |
|||
*/ |
|||
@Override |
|||
public List<AppMenuDTO> getUserMenuList(UserDetail userDetail, Integer type) { |
|||
List<AppMenuEntity> menuList; |
|||
|
|||
//系统管理员,拥有最高权限
|
|||
if (userDetail.getSuperAdmin() == SuperAdminEnum.YES.value()) { |
|||
menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage()); |
|||
} else { |
|||
menuList = baseDao.getUserMenuList(userDetail.getId(), type, HttpContextUtils.getLanguage()); |
|||
} |
|||
|
|||
List<AppMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, AppMenuDTO.class); |
|||
|
|||
return TreeUtils.build(dtoList); |
|||
} |
|||
@Override |
|||
public Result<List<EpdcAppChildNavResultDTO>> getAnalysisIndexPanel(String userId) { |
|||
if (StringUtils.isBlank(userId)) { |
|||
return new Result().error("用户Id不能为空"); |
|||
} |
|||
List<EpdcAppChildNavResultDTO> list = this.baseDao.getAnalysisIndexPanel(userId); |
|||
return new Result().ok(list); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,150 @@ |
|||
/** |
|||
* 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.service.impl; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.dao.SysAnalysisRoleMenuDao; |
|||
import com.elink.esua.epdc.dto.*; |
|||
import com.elink.esua.epdc.entity.SysAnalysisRoleMenuEntity; |
|||
import com.elink.esua.epdc.redis.SysAnalysisRoleMenuRedis; |
|||
import com.elink.esua.epdc.service.SysAnalysisRoleMenuService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-25 |
|||
*/ |
|||
@Service |
|||
public class SysAnalysisRoleMenuServiceImpl extends BaseServiceImpl<SysAnalysisRoleMenuDao, SysAnalysisRoleMenuEntity> implements SysAnalysisRoleMenuService { |
|||
|
|||
@Autowired |
|||
private SysAnalysisRoleMenuRedis sysAnalysisRoleMenuRedis; |
|||
|
|||
@Override |
|||
public PageData<SysAnalysisRoleMenuDTO> page(Map<String, Object> params) { |
|||
IPage<SysAnalysisRoleMenuEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, SysAnalysisRoleMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<SysAnalysisRoleMenuDTO> list(Map<String, Object> params) { |
|||
List<SysAnalysisRoleMenuEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, SysAnalysisRoleMenuDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<SysAnalysisRoleMenuEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<SysAnalysisRoleMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
/** |
|||
* 保存或修改 |
|||
* |
|||
* @param roleId 角色ID |
|||
* @param appMenuIdList 菜单ID列表 |
|||
*/ |
|||
@Override |
|||
public void saveOrUpdate(Long roleId, List<Long> analysisMenuIdList) { |
|||
//先删除角色菜单权限关系
|
|||
deleteByRoleId(roleId); |
|||
|
|||
//角色没有一个菜单权限的情况
|
|||
if (CollUtil.isEmpty(analysisMenuIdList)) { |
|||
return; |
|||
} |
|||
|
|||
//保存角色菜单权限关系
|
|||
for (Long menuId : analysisMenuIdList) { |
|||
SysAnalysisRoleMenuEntity appRoleMenuEntity = new SysAnalysisRoleMenuEntity(); |
|||
appRoleMenuEntity.setMenuId(menuId); |
|||
appRoleMenuEntity.setRoleId(roleId); |
|||
|
|||
//保存
|
|||
insert(appRoleMenuEntity); |
|||
} |
|||
} |
|||
/** |
|||
* 根据角色id,删除角色数据权限关系 |
|||
* |
|||
* @param roleId 角色id |
|||
*/ |
|||
@Override |
|||
public void deleteByRoleId(Long roleId) { |
|||
baseDao.deleteByRoleId(roleId); |
|||
} |
|||
|
|||
@Override |
|||
public SysAnalysisRoleMenuDTO get(String id) { |
|||
SysAnalysisRoleMenuEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, SysAnalysisRoleMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(SysAnalysisRoleMenuDTO dto) { |
|||
SysAnalysisRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysAnalysisRoleMenuEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(SysAnalysisRoleMenuDTO dto) { |
|||
SysAnalysisRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, SysAnalysisRoleMenuEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
/** |
|||
* 根据角色ID,获取菜单ID列表 |
|||
* |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<Long> getAnalysisMenuIdList(Long id) { |
|||
return baseDao.getAnalysisMenuIdList(id); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,132 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.SysAnalysisMenuDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.SysAnalysisMenuEntity" id="sysAnalysisMenuMap"> |
|||
<result property="id" column="id"/> |
|||
<result property="pid" column="pid"/> |
|||
<result property="type" column="type"/> |
|||
<result property="modelname" column="modelName"/> |
|||
<result property="icon" column="icon"/> |
|||
<result property="className" column="class_name"/> |
|||
<result property="menuCode" column="menu_code"/> |
|||
<result property="templateId" column="template_id"/> |
|||
<result property="numFlag" column="num_flag"/> |
|||
<result property="sort" column="sort"/> |
|||
<result property="remark" column="remark"/> |
|||
<result property="delFlag" column="del_flag"/> |
|||
<result property="creator" column="creator"/> |
|||
<result property="createDate" column="create_date"/> |
|||
<result property="updater" column="updater"/> |
|||
<result property="updateDate" column="update_date"/> |
|||
</resultMap> |
|||
|
|||
<select id="selectListAppMenu" resultType="com.elink.esua.epdc.dto.AppMenuDTO"> |
|||
SELECT |
|||
m.*, |
|||
l.field_value AS `NAME` |
|||
FROM |
|||
sys_analysis_menu m |
|||
LEFT JOIN sys_language l ON m.id = l.table_id AND l.table_name = 'sys_analysis_menu' AND l.field_name = 'name' AND l.LANGUAGE = #{language} |
|||
WHERE m.del_flag = 0 |
|||
<if test="type != null">AND m.type = #{type}</if> |
|||
ORDER BY m.sort ASC |
|||
</select> |
|||
<select id="selectByIdDIY" resultType="com.elink.esua.epdc.dto.SysAnalysisMenuDTO"> |
|||
SELECT |
|||
m.*, |
|||
l.field_value AS `NAME`, |
|||
ll.field_value as parentName |
|||
FROM |
|||
sys_analysis_menu m |
|||
LEFT JOIN sys_language ll ON m.pid = ll.table_id |
|||
LEFT JOIN sys_language l ON m.id = l.table_id AND l.table_name = 'sys_analysis_menu' AND l.field_name = 'name' AND l.LANGUAGE = #{language} |
|||
WHERE m.del_flag = 0 |
|||
AND m.id = #{id} |
|||
</select> |
|||
<select id="getMenuList" resultType="com.elink.esua.epdc.entity.AppMenuEntity"> |
|||
select t1.*, ( |
|||
SELECT |
|||
lang.field_value |
|||
FROM |
|||
sys_language lang |
|||
WHERE |
|||
lang.table_name = 'sys_analysis_menu' |
|||
AND lang.field_name = 'name' |
|||
AND lang.table_id = t1.id |
|||
AND lang.LANGUAGE = #{language} |
|||
) as name |
|||
from sys_analysis_menu t1 |
|||
where t1.del_flag = 0 |
|||
<if test="type != null"> |
|||
and t1.type = #{type} |
|||
</if> |
|||
order by t1.sort asc |
|||
</select> |
|||
|
|||
<select id="getUserMenuList" resultType="com.elink.esua.epdc.entity.AppMenuEntity"> |
|||
select t3.*,( |
|||
SELECT |
|||
lang.field_value |
|||
FROM |
|||
sys_language lang |
|||
WHERE |
|||
lang.table_name = 'sys_analysis_menu' |
|||
AND lang.field_name = 'name' |
|||
AND lang.table_id = t3.id |
|||
AND lang.LANGUAGE = #{language} |
|||
) as name |
|||
from sys_role_user t1 |
|||
left join sys_analysis_role_menu t2 on t1.role_id = t2.role_id |
|||
left join sys_analysis_menu t3 on t2.menu_id = t3.id |
|||
where t1.user_id = #{userId} and t3.del_flag = 0 |
|||
<if test="type != null"> |
|||
and t3.type = #{type} |
|||
</if> |
|||
order by t3.sort asc |
|||
</select> |
|||
|
|||
<resultMap id="AnalysisIndexPanelResultDTOMap" type="com.elink.esua.epdc.dto.epdc.result.EpdcAppChildNavResultDTO"> |
|||
<id column="label" property="label"/> |
|||
<result column="navCode" property="navCode"/> |
|||
<result column="remark" property="remark"/> |
|||
<result column="icon" property="icon"/> |
|||
<result column="className" property="className"/> |
|||
<result column="numFlag" property="numFlag"/> |
|||
</resultMap> |
|||
|
|||
<select id="getAnalysisIndexPanel" resultMap="AnalysisIndexPanelResultDTOMap"> |
|||
SELECT |
|||
lc.field_value AS label, |
|||
mc.menu_code AS navCode, |
|||
mc.remark, |
|||
mc.class_name AS className, |
|||
mc.icon, |
|||
mc.num_flag as numFlag |
|||
FROM |
|||
sys_analysis_menu mp |
|||
LEFT JOIN sys_language lp ON lp.table_id = mp.id |
|||
LEFT JOIN sys_analysis_menu mc ON mp.id = mc.pid |
|||
LEFT JOIN sys_language lc ON lc.table_id = mc.id |
|||
WHERE |
|||
mc.id IN ( |
|||
SELECT |
|||
m.id meauId |
|||
FROM |
|||
sys_user u |
|||
LEFT JOIN sys_role_user ru ON ru.user_id = u.id |
|||
LEFT JOIN sys_analysis_role_menu am ON am.role_id = ru.role_id |
|||
LEFT JOIN sys_analysis_menu m ON am.menu_id = m.id and m.del_flag = 0 |
|||
LEFT JOIN sys_analysis_menu m1 ON m1.id = m.pid and m1.del_flag = 0 |
|||
WHERE |
|||
u.id =#{userId} |
|||
and u.del_flag = 0 |
|||
and am.menu_id IS NOT NULL |
|||
AND m.pid != 0 |
|||
and m1.menu_code = 10010 |
|||
)order by mp.sort asc,mc.sort asc |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.SysAnalysisRoleMenuDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.SysAnalysisRoleMenuEntity" id="sysAnalysisRoleMenuMap"> |
|||
<result property="id" column="id"/> |
|||
<result property="roleId" column="role_id"/> |
|||
<result property="menuId" column="menu_id"/> |
|||
<result property="creator" column="creator"/> |
|||
<result property="createDate" column="create_date"/> |
|||
</resultMap> |
|||
<delete id="deleteByRoleId"> |
|||
delete from sys_analysis_role_menu where role_id = #{value} |
|||
</delete> |
|||
|
|||
<select id="getAnalysisMenuIdList" resultType="long"> |
|||
select menu_id from sys_analysis_role_menu where role_id = #{value} |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue