Browse Source
# Conflicts: # esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserDao.xmldev
61 changed files with 1985 additions and 302 deletions
@ -0,0 +1,118 @@ |
|||
/** |
|||
* 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.utils.TreeNode; |
|||
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; |
|||
|
|||
|
|||
/** |
|||
* APP菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
public class AppMenuDTO extends TreeNode<SysMenuDTO> implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -319379699436244053L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@NotNull(message = "{id.require}", groups = UpdateGroup.class) |
|||
private Long id; |
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
@NotNull(message = "{sysmenu.pid.require}", groups = DefaultGroup.class) |
|||
private Long pid; |
|||
|
|||
/** |
|||
* 菜单URL |
|||
*/ |
|||
private String url; |
|||
|
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
@Range(min = 0, max = 1, message = "{sysmenu.type.range}", groups = DefaultGroup.class) |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
|
|||
/** |
|||
* 权限标识,如:sys:menu:save |
|||
*/ |
|||
private String permissions; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@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; |
|||
|
|||
@NotBlank(message = "{sysmenu.name.require}", groups = DefaultGroup.class) |
|||
private String name; |
|||
} |
@ -0,0 +1,62 @@ |
|||
/** |
|||
* 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; |
|||
|
|||
|
|||
/** |
|||
* APP角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
public class AppRoleMenuDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 9222960342198691097L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private Long id; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 菜单ID |
|||
*/ |
|||
private Long menuId; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private Long creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createDate; |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.enums; |
|||
|
|||
/** |
|||
* 菜单表枚举 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 13:56 |
|||
*/ |
|||
public enum MenuTableEnum { |
|||
/** |
|||
* 菜单资源 |
|||
*/ |
|||
SYS("sys_menu"), |
|||
/** |
|||
* 非菜单资源 |
|||
*/ |
|||
APP("sys_app_menu"); |
|||
|
|||
private String value; |
|||
|
|||
MenuTableEnum(String value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public String value() { |
|||
return value; |
|||
} |
|||
} |
@ -0,0 +1,109 @@ |
|||
/** |
|||
* 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.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.AppMenuDTO; |
|||
import com.elink.esua.epdc.excel.AppMenuExcel; |
|||
import com.elink.esua.epdc.service.AppMenuService; |
|||
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; |
|||
|
|||
|
|||
/** |
|||
* APP菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("appmenu") |
|||
public class AppMenuController { |
|||
|
|||
@Autowired |
|||
private AppMenuService appMenuService; |
|||
|
|||
/** |
|||
* 获取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 = appMenuService.getAppMenuList(type); |
|||
return new Result<List<AppMenuDTO>>().ok(list); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<AppMenuDTO> get(@PathVariable("id") String id) { |
|||
AppMenuDTO data = appMenuService.get(id); |
|||
return new Result<AppMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody AppMenuDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
appMenuService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody AppMenuDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
appMenuService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping("{id}") |
|||
public Result delete(@PathVariable("id") Long id){ |
|||
//效验数据
|
|||
AssertUtils.isNull(id, "id"); |
|||
|
|||
//判断是否有子菜单或按钮
|
|||
if(appMenuService.hasChileMenu(id)){ |
|||
return new Result().error(ErrorCode.SUB_MENU_EXIST); |
|||
} |
|||
|
|||
appMenuService.delete(id); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<AppMenuDTO> list = appMenuService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, AppMenuExcel.class); |
|||
} |
|||
|
|||
} |
@ -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.AppRoleMenuDTO; |
|||
import com.elink.esua.epdc.excel.AppRoleMenuExcel; |
|||
import com.elink.esua.epdc.service.AppRoleMenuService; |
|||
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; |
|||
|
|||
|
|||
/** |
|||
* APP角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("approlemenu") |
|||
public class AppRoleMenuController { |
|||
|
|||
@Autowired |
|||
private AppRoleMenuService appRoleMenuService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<AppRoleMenuDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<AppRoleMenuDTO> page = appRoleMenuService.page(params); |
|||
return new Result<PageData<AppRoleMenuDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<AppRoleMenuDTO> get(@PathVariable("id") String id) { |
|||
AppRoleMenuDTO data = appRoleMenuService.get(id); |
|||
return new Result<AppRoleMenuDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody AppRoleMenuDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
appRoleMenuService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody AppRoleMenuDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
appRoleMenuService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
appRoleMenuService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<AppRoleMenuDTO> list = appRoleMenuService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, AppRoleMenuExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
/** |
|||
* 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.entity.AppMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Mapper |
|||
public interface AppMenuDao extends BaseDao<AppMenuEntity> { |
|||
|
|||
|
|||
/** |
|||
* 获取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,33 @@ |
|||
/** |
|||
* 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.AppRoleMenuEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Mapper |
|||
public interface AppRoleMenuDao extends BaseDao<AppRoleMenuEntity> { |
|||
|
|||
} |
@ -0,0 +1,97 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* APP菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("sys_app_menu") |
|||
public class AppMenuEntity extends BaseEntity { |
|||
|
|||
private static final long serialVersionUID = 8343477172739451636L; |
|||
|
|||
|
|||
/** |
|||
* 上级ID,一级菜单为0 |
|||
*/ |
|||
private Long pid; |
|||
|
|||
/** |
|||
* 菜单URL |
|||
*/ |
|||
private String url; |
|||
|
|||
/** |
|||
* 类型 0:菜单 1:按钮 |
|||
*/ |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 菜单图标 |
|||
*/ |
|||
private String icon; |
|||
|
|||
/** |
|||
* 权限标识,如:sys:menu:save |
|||
*/ |
|||
private String permissions; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
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; |
|||
|
|||
/** |
|||
* 菜单编码 |
|||
*/ |
|||
private String menuCode; |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* APP角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("sys_app_role_menu") |
|||
public class AppRoleMenuEntity extends BaseEntity { |
|||
|
|||
private static final long serialVersionUID = 5439181968297858519L; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 菜单ID |
|||
*/ |
|||
private Long menuId; |
|||
|
|||
} |
@ -0,0 +1,74 @@ |
|||
/** |
|||
* 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 work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
public class AppMenuExcel { |
|||
|
|||
@Excel(name = "id") |
|||
private Long id; |
|||
|
|||
@Excel(name = "上级ID,一级菜单为0") |
|||
private Long pid; |
|||
|
|||
@Excel(name = "菜单URL") |
|||
private String url; |
|||
|
|||
@Excel(name = "类型 0:菜单 1:按钮") |
|||
private Integer type; |
|||
|
|||
@Excel(name = "菜单图标") |
|||
private String icon; |
|||
|
|||
@Excel(name = "权限标识,如:sys:menu:save") |
|||
private String permissions; |
|||
|
|||
@Excel(name = "排序") |
|||
private Integer sort; |
|||
|
|||
@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; |
|||
|
|||
@Excel(name = "菜单编码") |
|||
private String menuCode; |
|||
|
|||
|
|||
} |
@ -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 work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Data |
|||
public class AppRoleMenuExcel { |
|||
|
|||
@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 work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Component |
|||
public class AppMenuRedis { |
|||
@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 work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Component |
|||
public class AppRoleMenuRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,126 @@ |
|||
/** |
|||
* 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.AppMenuDTO; |
|||
import com.elink.esua.epdc.entity.AppMenuEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* APP菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
public interface AppMenuService extends BaseService<AppMenuEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<AppMenuDTO> |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
PageData<AppMenuDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<AppMenuDTO> |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
List<AppMenuDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return AppMenuDTO |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
AppMenuDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void save(AppMenuDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void update(AppMenuDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
|
|||
/** |
|||
* 获取APP菜单列表 |
|||
* |
|||
* @param type 菜单类型 0:菜单 1:按钮 null:全部 |
|||
* @return java.util.List<com.elink.esua.epdc.dto.AppMenuDTO> |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 13:27 |
|||
*/ |
|||
List<AppMenuDTO> getAppMenuList(Integer type); |
|||
|
|||
/** |
|||
* 根据ID删除 |
|||
* |
|||
* @param id 菜单ID |
|||
* @return void |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 14:31 |
|||
*/ |
|||
void delete(Long id); |
|||
|
|||
/** |
|||
* 判断是否有子级菜单 |
|||
* |
|||
* @param id 菜单ID |
|||
* @return boolean |
|||
* @author work@yujt.net.cn |
|||
* @date 2019/11/19 14:30 |
|||
*/ |
|||
boolean hasChileMenu(Long id); |
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* 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.AppRoleMenuDTO; |
|||
import com.elink.esua.epdc.entity.AppRoleMenuEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* APP角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
public interface AppRoleMenuService extends BaseService<AppRoleMenuEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<AppRoleMenuDTO> |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
PageData<AppRoleMenuDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<AppRoleMenuDTO> |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
List<AppRoleMenuDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return AppRoleMenuDTO |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
AppRoleMenuDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void save(AppRoleMenuDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void update(AppRoleMenuDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-11-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -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.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.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.commons.tools.utils.HttpContextUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.TreeUtils; |
|||
import com.elink.esua.epdc.dao.AppMenuDao; |
|||
import com.elink.esua.epdc.dto.AppMenuDTO; |
|||
import com.elink.esua.epdc.entity.AppMenuEntity; |
|||
import com.elink.esua.epdc.enums.MenuTableEnum; |
|||
import com.elink.esua.epdc.service.AppMenuService; |
|||
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; |
|||
|
|||
/** |
|||
* APP菜单管理 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Service |
|||
public class AppMenuServiceImpl extends BaseServiceImpl<AppMenuDao, AppMenuEntity> implements AppMenuService { |
|||
|
|||
@Autowired |
|||
private SysLanguageService sysLanguageService; |
|||
|
|||
@Override |
|||
public PageData<AppMenuDTO> page(Map<String, Object> params) { |
|||
IPage<AppMenuEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, AppMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<AppMenuDTO> list(Map<String, Object> params) { |
|||
List<AppMenuEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
return ConvertUtils.sourceToTarget(entityList, AppMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<AppMenuDTO> getAppMenuList(Integer type) { |
|||
List<AppMenuDTO> menuList = baseDao.selectListAppMenu(type, HttpContextUtils.getLanguage()); |
|||
return TreeUtils.build(menuList, Constant.MENU_ROOT); |
|||
} |
|||
|
|||
private QueryWrapper<AppMenuEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<AppMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public AppMenuDTO get(String id) { |
|||
AppMenuEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, AppMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(AppMenuDTO dto) { |
|||
AppMenuEntity entity = ConvertUtils.sourceToTarget(dto, AppMenuEntity.class); |
|||
insert(entity); |
|||
|
|||
sysLanguageService.saveOrUpdate(MenuTableEnum.APP.value(), entity.getId(), "name", dto.getName(), HttpContextUtils.getLanguage()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(AppMenuDTO dto) { |
|||
AppMenuEntity entity = ConvertUtils.sourceToTarget(dto, AppMenuEntity.class); |
|||
updateById(entity); |
|||
|
|||
sysLanguageService.saveOrUpdate(MenuTableEnum.APP.value(), entity.getId(), "name", dto.getName(), HttpContextUtils.getLanguage()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 物理删除(没有使用@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public void delete(Long id) { |
|||
baseDao.deleteById(id); |
|||
} |
|||
|
|||
@Override |
|||
public boolean hasChileMenu(Long id) { |
|||
QueryWrapper<AppMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("pid", id) |
|||
.eq(FieldConstant.DEL_FLAG, DelFlagEnum.NORMAL.value()); |
|||
Integer selectCount = baseDao.selectCount(wrapper); |
|||
return selectCount > NumConstant.ZERO; |
|||
} |
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* 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.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.AppRoleMenuDao; |
|||
import com.elink.esua.epdc.dto.AppRoleMenuDTO; |
|||
import com.elink.esua.epdc.entity.AppRoleMenuEntity; |
|||
import com.elink.esua.epdc.redis.AppRoleMenuRedis; |
|||
import com.elink.esua.epdc.service.AppRoleMenuService; |
|||
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; |
|||
|
|||
/** |
|||
* APP角色菜单关系 |
|||
* |
|||
* @author work@yujt.net.cn |
|||
* @since v1.0.0 2019-11-19 |
|||
*/ |
|||
@Service |
|||
public class AppRoleMenuServiceImpl extends BaseServiceImpl<AppRoleMenuDao, AppRoleMenuEntity> implements AppRoleMenuService { |
|||
|
|||
@Autowired |
|||
private AppRoleMenuRedis appRoleMenuRedis; |
|||
|
|||
@Override |
|||
public PageData<AppRoleMenuDTO> page(Map<String, Object> params) { |
|||
IPage<AppRoleMenuEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, AppRoleMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<AppRoleMenuDTO> list(Map<String, Object> params) { |
|||
List<AppRoleMenuEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, AppRoleMenuDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<AppRoleMenuEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<AppRoleMenuEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public AppRoleMenuDTO get(String id) { |
|||
AppRoleMenuEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, AppRoleMenuDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(AppRoleMenuDTO dto) { |
|||
AppRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, AppRoleMenuEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(AppRoleMenuDTO dto) { |
|||
AppRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, AppRoleMenuEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
<?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.AppMenuDao"> |
|||
|
|||
<select id="selectListAppMenu" resultType="com.elink.esua.epdc.dto.AppMenuDTO"> |
|||
SELECT |
|||
m.*, |
|||
l.field_value AS `NAME` |
|||
FROM |
|||
sys_app_menu m |
|||
LEFT JOIN sys_language l ON m.id = l.table_id AND l.table_name = 'sys_app_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> |
|||
|
|||
</mapper> |
@ -0,0 +1,15 @@ |
|||
<?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.AppRoleMenuDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.AppRoleMenuEntity" id="appRoleMenuMap"> |
|||
<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> |
|||
|
|||
|
|||
</mapper> |
@ -1,100 +0,0 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
|||
import cn.afterturn.easypoi.excel.entity.ImportParams; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.codec.CharEncoding; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.HttpStatus; |
|||
import org.apache.http.ParseException; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.*; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author work@yujt.net.cn |
|||
* @date 1 1 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@RequestMapping("inshibei") |
|||
public class ImportInShiBeiController { |
|||
|
|||
|
|||
@GetMapping("coterie/batchSave") |
|||
public Result importExcel(MultipartFile file, String userId, String token) { |
|||
ImportParams importParams = new ImportParams(); |
|||
importParams.setHeadRows(1); |
|||
try { |
|||
List<Map<String, String>> articleList = ExcelImportUtil.importExcel(file.getInputStream(), Map.class, importParams); |
|||
|
|||
for (Map<String, String> objectMap : articleList) { |
|||
postWithParam(userId, token, objectMap.get("content"), objectMap.get("type")); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
private void postWithParam(String userId, String token, String detail, String type) throws Exception { |
|||
CloseableHttpClient httpClient = HttpClients.createDefault(); |
|||
|
|||
JSONObject json = new JSONObject(); |
|||
json.put("userId", userId); |
|||
json.put("token", token); |
|||
json.put("detail", detail); |
|||
json.put("coterieType", type); |
|||
|
|||
HttpPost httpPost = new HttpPost("http://hxb.elinkit.com.cn/InShiBei/rest/coterie/save"); |
|||
StringEntity stringEntity = new StringEntity(json.toJSONString(), CharEncoding.UTF_8); |
|||
stringEntity.setContentEncoding(CharEncoding.UTF_8); |
|||
// 发送json数据需要设置contentType
|
|||
stringEntity.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); |
|||
httpPost.setEntity(stringEntity); |
|||
|
|||
getStringResult(httpClient.execute(httpPost)); |
|||
} |
|||
|
|||
|
|||
private static String getStringResult(CloseableHttpResponse response) { |
|||
String result = null; |
|||
try { |
|||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { |
|||
HttpEntity httpEntity = response.getEntity(); |
|||
result = EntityUtils.toString(httpEntity, CharEncoding.UTF_8); |
|||
} else { |
|||
log.error("拉取失败,错误编码为:" + response.getStatusLine().getStatusCode()); |
|||
} |
|||
} catch (ParseException e) { |
|||
log.error("getResult方法格式转换异常ParseException"); |
|||
e.printStackTrace(); |
|||
} catch (IOException e) { |
|||
log.error("getResult方法IO异常IOException"); |
|||
e.printStackTrace(); |
|||
} finally { |
|||
try { |
|||
if (null != response) { |
|||
response.close(); |
|||
} |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.elink.esua.epdc.modules.events.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.dto.events.EpdcEventsDetailDTO; |
|||
import com.elink.esua.epdc.dto.events.form.EpdcEventsReviewFormDTO; |
|||
import com.elink.esua.epdc.modules.events.service.EpdcEventsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "work/event") |
|||
public class EpdcAppWorkEventsController { |
|||
|
|||
@Autowired |
|||
private EpdcEventsService epdcEventsService; |
|||
|
|||
/** |
|||
* 事件详情 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("{id}") |
|||
public Result<EpdcEventsDetailDTO> detail(@PathVariable("id") String id){ |
|||
EpdcEventsDetailDTO data = epdcEventsService.getEvent(id); |
|||
return new Result<EpdcEventsDetailDTO>().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 事件审核 |
|||
* @Params: [dto] |
|||
* @Return: com.elink.esua.epdc.commons.tools.utils.Result |
|||
* @Author: liuchuang |
|||
* @Date: 2019/9/5 9:02 |
|||
*/ |
|||
@PostMapping("review") |
|||
public Result eventReview(@RequestBody EpdcEventsReviewFormDTO dto) { |
|||
ValidatorUtils.validateEntity(dto); |
|||
return epdcEventsService.eventReview(dto); |
|||
} |
|||
} |
@ -0,0 +1,65 @@ |
|||
package com.elink.esua.epdc.modules.issue.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.category.EventCategoryDTO; |
|||
import com.elink.esua.epdc.dto.issue.form.IssuePendingResponseFormDTO; |
|||
import com.elink.esua.epdc.dto.issue.form.IssueStateStatisticsFormDTO; |
|||
import com.elink.esua.epdc.dto.issue.result.IssuePendingResponseResultDTO; |
|||
import com.elink.esua.epdc.dto.issue.result.IssueStateStatisticsResultDTO; |
|||
import com.elink.esua.epdc.modules.category.service.EventCategoryService; |
|||
import com.elink.esua.epdc.modules.issue.service.IssueService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "work/issue") |
|||
public class EpdcAppWorkIssueController { |
|||
|
|||
|
|||
@Autowired |
|||
private IssueService issueService; |
|||
|
|||
@Autowired |
|||
private EventCategoryService eventCategoryService; |
|||
|
|||
/** |
|||
* 议题状态统计 |
|||
* @param formDto |
|||
* @return |
|||
*/ |
|||
@GetMapping("stateStatistics") |
|||
public Result<IssueStateStatisticsResultDTO> stateStatistics(@RequestBody IssueStateStatisticsFormDTO formDto) { |
|||
return issueService.stateStatistics(formDto); |
|||
} |
|||
|
|||
/** |
|||
*待回应列表 |
|||
* @param formDto |
|||
* @return |
|||
*/ |
|||
@GetMapping("listIssuePendingResponse") |
|||
public Result<List<IssuePendingResponseResultDTO>> listIssuePendingResponse(@RequestBody IssuePendingResponseFormDTO formDto) { |
|||
return issueService.listIssuePendingResponse(formDto); |
|||
|
|||
} |
|||
|
|||
/** |
|||
*事件分类 |
|||
* @return |
|||
*/ |
|||
@GetMapping("categoryList") |
|||
public Result<List<EventCategoryDTO>> categoryList() { |
|||
Map params = new HashMap<>(); |
|||
List<EventCategoryDTO> list = eventCategoryService.list(params); |
|||
return new Result<List<EventCategoryDTO>>().ok(list); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue