28 changed files with 1802 additions and 0 deletions
@ -0,0 +1,85 @@ |
|||
/** |
|||
* 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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
public class DeptInfoDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 部门电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 删除标识 0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
} |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* 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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
public class ModuleDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 模块编码 |
|||
*/ |
|||
private String moduleCode; |
|||
|
|||
/** |
|||
* 模块名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 模块图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 启用标识 0-否,1-是 |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 删除标识 0-否,1-是 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.elink.esua.epdc.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 了解锦水 - 硬核管理口入参DTO |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-20 |
|||
*/ |
|||
@Data |
|||
public class EpdcDeptInfoFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 2379520294973498819L; |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@Min(value = 1, message = "页码必须大于0") |
|||
private Integer pageIndex; |
|||
|
|||
/** |
|||
* 页容量 |
|||
*/ |
|||
@Min(value = 1, message = "页容量必须大于0") |
|||
private Integer pageSize; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.elink.esua.epdc.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 了解锦水-硬核管理 移动端返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-20 |
|||
*/ |
|||
@Data |
|||
public class EpdcDeptInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 部门电话 |
|||
*/ |
|||
private String mobile; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.elink.esua.epdc.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 了解锦水-模块管理 移动端返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-20 |
|||
*/ |
|||
@Data |
|||
public class EpdcModuleResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 模块编码 |
|||
*/ |
|||
private String moduleCode; |
|||
|
|||
/** |
|||
* 模块名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 模块图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
} |
@ -0,0 +1,65 @@ |
|||
package com.elink.esua.epdc.enums; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|||
|
|||
/** |
|||
* 模块分类枚举 |
|||
* |
|||
* @author zhangyong |
|||
* @date 09:46 2020-05-19 |
|||
*/ |
|||
public enum ModuleCategoryEnum { |
|||
/** |
|||
* 0 政策导航 |
|||
*/ |
|||
MODULE_NAVIGATION("module_navigation", NumConstant.ZERO_STR), |
|||
/** |
|||
* 1 印象 |
|||
*/ |
|||
MODULE_IMPRESSION("module_impression", NumConstant.ONE_STR), |
|||
/** |
|||
* 2 味道 |
|||
*/ |
|||
MODULE_TASTE("module_taste", NumConstant.TWO_STR), |
|||
/** |
|||
* 3 硬核 |
|||
*/ |
|||
MODULE_HARDCORE("module_hardcore", NumConstant.THREE_STR), |
|||
/** |
|||
* 4 档案 |
|||
*/ |
|||
MODULE_FILE("module_file", NumConstant.FOUR_STR); |
|||
|
|||
private String name; |
|||
private String index; |
|||
|
|||
ModuleCategoryEnum(String name, String index) { |
|||
this.name = name; |
|||
this.index = index; |
|||
} |
|||
|
|||
public static String getName(String index) { |
|||
for (ModuleCategoryEnum c : ModuleCategoryEnum.values()) { |
|||
if (c.getIndex().equals(index)) { |
|||
return c.name; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String getIndex(String name) { |
|||
for (ModuleCategoryEnum c : ModuleCategoryEnum.values()) { |
|||
if (c.getName().equals(name)) { |
|||
return c.index; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
public String getIndex() { |
|||
return index; |
|||
} |
|||
} |
@ -0,0 +1,93 @@ |
|||
/** |
|||
* 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.modules.dept.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.DeptInfoDTO; |
|||
import com.elink.esua.epdc.modules.dept.excel.DeptInfoExcel; |
|||
import com.elink.esua.epdc.modules.dept.service.DeptInfoService; |
|||
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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("deptinfo") |
|||
public class DeptInfoController { |
|||
|
|||
@Autowired |
|||
private DeptInfoService deptInfoService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<DeptInfoDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<DeptInfoDTO> page = deptInfoService.page(params); |
|||
return new Result<PageData<DeptInfoDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<DeptInfoDTO> get(@PathVariable("id") String id){ |
|||
DeptInfoDTO data = deptInfoService.get(id); |
|||
return new Result<DeptInfoDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody DeptInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
return deptInfoService.save(dto); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody DeptInfoDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
deptInfoService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
deptInfoService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<DeptInfoDTO> list = deptInfoService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, DeptInfoExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.elink.esua.epdc.modules.dept.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.form.EpdcDeptInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; |
|||
import com.elink.esua.epdc.modules.dept.service.DeptInfoService; |
|||
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.List; |
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "deptinfo") |
|||
public class EpdcAppDeptInfoController { |
|||
|
|||
@Autowired |
|||
private DeptInfoService deptInfoService; |
|||
|
|||
/** |
|||
* 移动端获取 了解锦水-硬核管理接口 |
|||
* @param formDTO |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 13:41 2020-05-20 |
|||
**/ |
|||
@GetMapping("list") |
|||
public Result<List<EpdcDeptInfoResultDTO>> listDeptInfo(@RequestBody EpdcDeptInfoFormDTO formDTO) { |
|||
return deptInfoService.listDeptInfo(formDTO); |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* 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.modules.dept.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.DeptInfoDTO; |
|||
import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; |
|||
import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Mapper |
|||
public interface DeptInfoDao extends BaseDao<DeptInfoEntity> { |
|||
|
|||
/** |
|||
* 根据部门id,判断该部门是否已新增过 |
|||
* |
|||
* @param deptId |
|||
* @return int |
|||
* @Author zhangyong |
|||
* @Date 17:20 2020-05-19 |
|||
**/ |
|||
int getDeptIdCount(Long deptId); |
|||
|
|||
/** |
|||
* 移动端获取 了解锦水-硬核管理接口 |
|||
* @param formDTO |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:41 2020-05-20 |
|||
**/ |
|||
List<EpdcDeptInfoResultDTO> selectListDeptInfo(EpdcDeptInfoFormDTO formDTO); |
|||
|
|||
/** |
|||
* 硬核首页查询 - 带权限 |
|||
* @param params |
|||
* @return java.util.List<com.elink.esua.epdc.dto.DeptInfoDTO> |
|||
* @Author zhangyong |
|||
* @Date 15:18 2020-05-20 |
|||
**/ |
|||
List<DeptInfoDTO> selectListDeptInfoPage(Map<String, Object> params); |
|||
} |
@ -0,0 +1,55 @@ |
|||
/** |
|||
* 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.modules.dept.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_dept_info") |
|||
public class DeptInfoEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
*/ |
|||
private String deptName; |
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private Long deptId; |
|||
|
|||
/** |
|||
* 部门电话 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
/** |
|||
* 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.modules.dept.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
public class DeptInfoExcel { |
|||
|
|||
@Excel(name = "ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "部门名称") |
|||
private String deptName; |
|||
|
|||
@Excel(name = "部门ID") |
|||
private Long deptId; |
|||
|
|||
@Excel(name = "部门电话") |
|||
private String mobile; |
|||
|
|||
@Excel(name = "删除标识 0-否,1-是") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.elink.esua.epdc.modules.dept.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import com.elink.esua.epdc.modules.dept.feign.fallback.AdminFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhangyong |
|||
* @date 18:40 2020-05-19 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class, url = "http://127.0.0.1:9092") |
|||
public interface AdminFeignClient { |
|||
|
|||
/** |
|||
* 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 |
|||
* |
|||
* @param dictType 数据字典类型 |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<ParentAndAllDeptDTO> |
|||
* @Author zhangyong |
|||
* @Date 18:40 2020-05-19 |
|||
*/ |
|||
@GetMapping("/sys/dict/listSimple/{dictType}") |
|||
public Result<List<SysSimpleDictDTO>> getListSimpleByDictType(@PathVariable("dictType") String dictType); |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.elink.esua.epdc.modules.dept.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import com.elink.esua.epdc.modules.dept.feign.AdminFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhangyong |
|||
* @date 18:40 2020-05-19 |
|||
*/ |
|||
@Component |
|||
public class AdminFeignClientFallback implements AdminFeignClient { |
|||
|
|||
@Override |
|||
public Result<List<SysSimpleDictDTO>> getListSimpleByDictType(String dictType) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getListSimpleByDictType", dictType); |
|||
} |
|||
} |
@ -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.modules.dept.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Component |
|||
public class DeptInfoRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,107 @@ |
|||
/** |
|||
* 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.modules.dept.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.utils.Result; |
|||
import com.elink.esua.epdc.dto.DeptInfoDTO; |
|||
import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; |
|||
import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 部门基本信息表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
public interface DeptInfoService extends BaseService<DeptInfoEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<DeptInfoDTO> |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
PageData<DeptInfoDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<DeptInfoDTO> |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
List<DeptInfoDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return DeptInfoDTO |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
DeptInfoDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return Result |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
Result save(DeptInfoDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
void update(DeptInfoDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 移动端获取 了解锦水-硬核管理接口 |
|||
* @param formDTO |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 13:41 2020-05-20 |
|||
**/ |
|||
Result<List<EpdcDeptInfoResultDTO>> listDeptInfo(EpdcDeptInfoFormDTO formDTO); |
|||
} |
@ -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.modules.dept.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.constant.NumConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|||
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.Result; |
|||
import com.elink.esua.epdc.dto.DeptInfoDTO; |
|||
import com.elink.esua.epdc.dto.form.EpdcDeptInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO; |
|||
import com.elink.esua.epdc.modules.dept.dao.DeptInfoDao; |
|||
import com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity; |
|||
import com.elink.esua.epdc.modules.dept.redis.DeptInfoRedis; |
|||
import com.elink.esua.epdc.modules.dept.service.DeptInfoService; |
|||
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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Service |
|||
public class DeptInfoServiceImpl extends BaseServiceImpl<DeptInfoDao, DeptInfoEntity> implements DeptInfoService { |
|||
|
|||
@Autowired |
|||
private DeptInfoRedis deptInfoRedis; |
|||
|
|||
@Override |
|||
public PageData<DeptInfoDTO> page(Map<String, Object> params) { |
|||
params.put("deptIdList", SecurityUser.getUser().getDeptIdList()); |
|||
IPage<DeptInfoDTO> page = getPage(params); |
|||
List<DeptInfoDTO> list = baseDao.selectListDeptInfoPage(params); |
|||
return new PageData<>(list, page.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public List<DeptInfoDTO> list(Map<String, Object> params) { |
|||
List<DeptInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, DeptInfoDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<DeptInfoEntity> getWrapper(Map<String, Object> params){ |
|||
String deptName = (String)params.get("deptName"); |
|||
|
|||
QueryWrapper<DeptInfoEntity> wrapper = new QueryWrapper<>(); |
|||
if (deptName != null) { |
|||
wrapper.like(StringUtils.isNotBlank(deptName), "DEPT_NAME", deptName.trim()); |
|||
} |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public DeptInfoDTO get(String id) { |
|||
DeptInfoEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, DeptInfoDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result save(DeptInfoDTO dto) { |
|||
DeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, DeptInfoEntity.class); |
|||
// 模块不能重复添加
|
|||
int deptIdCount = baseDao.getDeptIdCount(entity.getDeptId()); |
|||
if (deptIdCount > 0) { |
|||
return new Result().error("该部门已存在,不可重复新增"); |
|||
} |
|||
insert(entity); |
|||
return new Result(); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(DeptInfoDTO dto) { |
|||
DeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, DeptInfoEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<EpdcDeptInfoResultDTO>> listDeptInfo(EpdcDeptInfoFormDTO formDTO) { |
|||
int pageIndex = (formDTO.getPageIndex() - NumConstant.ONE) * formDTO.getPageSize(); |
|||
formDTO.setPageIndex(pageIndex); |
|||
|
|||
List<EpdcDeptInfoResultDTO> listDeptInfo = this.baseDao.selectListDeptInfo(formDTO); |
|||
return new Result().ok(listDeptInfo); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.elink.esua.epdc.modules.module.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.result.EpdcModuleResultDTO; |
|||
import com.elink.esua.epdc.modules.module.service.ModuleService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 - 移动端 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "module") |
|||
public class EpdcAppModuleController { |
|||
|
|||
@Autowired |
|||
private ModuleService moduleService; |
|||
|
|||
/* |
|||
* 移动端获取 了解锦水-模块管理接口 |
|||
* |
|||
* @param |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcModuleResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 10:42 2020-05-20 |
|||
**/ |
|||
@GetMapping("list") |
|||
public Result<List<EpdcModuleResultDTO>> listModule() { |
|||
return moduleService.listModule(); |
|||
} |
|||
} |
@ -0,0 +1,105 @@ |
|||
/** |
|||
* 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.modules.module.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.ModuleDTO; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import com.elink.esua.epdc.modules.module.excel.ModuleExcel; |
|||
import com.elink.esua.epdc.modules.module.service.ModuleService; |
|||
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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("module") |
|||
public class ModuleController { |
|||
|
|||
@Autowired |
|||
private ModuleService moduleService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ModuleDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ModuleDTO> page = moduleService.page(params); |
|||
return new Result<PageData<ModuleDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ModuleDTO> get(@PathVariable("id") String id){ |
|||
ModuleDTO data = moduleService.get(id); |
|||
return new Result<ModuleDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ModuleDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
return moduleService.save(dto); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ModuleDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
moduleService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
moduleService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<ModuleDTO> list = moduleService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, ModuleExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 |
|||
* @param dictType |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.SysSimpleDictDTO>> |
|||
* @Author zhangyong |
|||
* @Date 18:40 2020-05-19 |
|||
**/ |
|||
@GetMapping("listSimple/{dictType}") |
|||
public Result<List<SysSimpleDictDTO>> getListSimpleByDictType(@PathVariable("dictType") String dictType) { |
|||
return moduleService.getListSimpleByDictType(dictType); |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* 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.modules.module.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; |
|||
import com.elink.esua.epdc.dto.ModuleDTO; |
|||
import com.elink.esua.epdc.modules.module.entity.ModuleEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Mapper |
|||
public interface ModuleDao extends BaseDao<ModuleEntity> { |
|||
|
|||
/** |
|||
* 模块管理首页查询 |
|||
* @param params |
|||
* @return java.util.List<com.elink.esua.epdc.dto.ModuleDTO> |
|||
* @Author zhangyong |
|||
* @Date 15:17 2020-05-20 |
|||
**/ |
|||
List<ModuleDTO> selectListModulePage(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 根据模块编码,判断该模块是否已新增过 |
|||
* |
|||
* @param moduleCode |
|||
* @return int |
|||
* @Author zhangyong |
|||
* @Date 17:20 2020-05-19 |
|||
**/ |
|||
int getModuleCodeCount(String moduleCode); |
|||
|
|||
/* |
|||
* 移动端获取 了解锦水-模块管理接口 |
|||
* |
|||
* @param |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.EpdcModuleResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 10:42 2020-05-20 |
|||
**/ |
|||
List<EpdcModuleResultDTO> selectListModule(); |
|||
} |
@ -0,0 +1,71 @@ |
|||
/** |
|||
* 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.modules.module.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_module") |
|||
public class ModuleEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 模块编码 |
|||
*/ |
|||
private String moduleCode; |
|||
|
|||
/** |
|||
* 模块名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 模块图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 启用标识 0-否,1-是 |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -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.modules.module.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Data |
|||
public class ModuleExcel { |
|||
|
|||
@Excel(name = "ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "模块编码") |
|||
private String moduleCode; |
|||
|
|||
@Excel(name = "模块名称") |
|||
private String name; |
|||
|
|||
@Excel(name = "模块图片") |
|||
private String imgUrl; |
|||
|
|||
@Excel(name = "排序") |
|||
private Integer sort; |
|||
|
|||
@Excel(name = "启用标识 0-否,1-是") |
|||
private String enableFlag; |
|||
|
|||
@Excel(name = "备注") |
|||
private String remark; |
|||
|
|||
@Excel(name = "删除标识 0-否,1-是") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -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.modules.module.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Component |
|||
public class ModuleRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,117 @@ |
|||
/** |
|||
* 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.modules.module.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.utils.Result; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; |
|||
import com.elink.esua.epdc.dto.ModuleDTO; |
|||
import com.elink.esua.epdc.modules.module.entity.ModuleEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 了解锦水模块管理 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
public interface ModuleService extends BaseService<ModuleEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ModuleDTO> |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
PageData<ModuleDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ModuleDTO> |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
List<ModuleDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ModuleDTO |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
ModuleDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return Result |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
Result save(ModuleDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
void update(ModuleDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-05-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 |
|||
* @param dictType |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.SysSimpleDictDTO>> |
|||
* @Author zhangyong |
|||
* @Date 18:40 2020-05-19 |
|||
**/ |
|||
Result<List<SysSimpleDictDTO>> getListSimpleByDictType(String dictType); |
|||
|
|||
/* |
|||
* 移动端获取 了解锦水-模块管理接口 |
|||
* |
|||
* @param |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcModuleResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 10:42 2020-05-20 |
|||
**/ |
|||
Result<List<EpdcModuleResultDTO>> listModule(); |
|||
} |
@ -0,0 +1,142 @@ |
|||
/** |
|||
* 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.modules.module.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.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.result.EpdcModuleResultDTO; |
|||
import com.elink.esua.epdc.dto.ModuleDTO; |
|||
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|||
import com.elink.esua.epdc.enums.ModuleCategoryEnum; |
|||
import com.elink.esua.epdc.modules.dept.feign.AdminFeignClient; |
|||
import com.elink.esua.epdc.modules.module.dao.ModuleDao; |
|||
import com.elink.esua.epdc.modules.module.entity.ModuleEntity; |
|||
import com.elink.esua.epdc.modules.module.redis.ModuleRedis; |
|||
import com.elink.esua.epdc.modules.module.service.ModuleService; |
|||
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 zhangyong |
|||
* @since v1.0.0 2020-05-19 |
|||
*/ |
|||
@Service |
|||
public class ModuleServiceImpl extends BaseServiceImpl<ModuleDao, ModuleEntity> implements ModuleService { |
|||
|
|||
@Autowired |
|||
private ModuleRedis moduleRedis; |
|||
|
|||
@Autowired |
|||
private AdminFeignClient adminFeignClient; |
|||
|
|||
@Override |
|||
public PageData<ModuleDTO> page(Map<String, Object> params) { |
|||
IPage<ModuleDTO> page = getPage(params); |
|||
List<ModuleDTO> list = baseDao.selectListModulePage(params); |
|||
return new PageData<>(list, page.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public List<ModuleDTO> list(Map<String, Object> params) { |
|||
List<ModuleEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ModuleDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ModuleEntity> getWrapper(Map<String, Object> params){ |
|||
String name = (String)params.get(FieldConstant.NAME_HUMP); |
|||
|
|||
QueryWrapper<ModuleEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(name), FieldConstant.NAME, name); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ModuleDTO get(String id) { |
|||
ModuleEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ModuleDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result save(ModuleDTO dto) { |
|||
ModuleEntity entity = ConvertUtils.sourceToTarget(dto, ModuleEntity.class); |
|||
// 模块不能重复添加
|
|||
int moduleCodeCount = baseDao.getModuleCodeCount(entity.getModuleCode()); |
|||
if (moduleCodeCount > 0) { |
|||
return new Result().error("该模块已存在,不可重复新增"); |
|||
} |
|||
insert(entity); |
|||
return new Result(); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ModuleDTO dto) { |
|||
ModuleEntity entity = ConvertUtils.sourceToTarget(dto, ModuleEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<SysSimpleDictDTO>> getListSimpleByDictType(String dictType) { |
|||
return adminFeignClient.getListSimpleByDictType(dictType); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<EpdcModuleResultDTO>> listModule() { |
|||
List<EpdcModuleResultDTO> data = baseDao.selectListModule(); |
|||
data = this.moduleCodeSwitchNumber(data); |
|||
return new Result().ok(data); |
|||
} |
|||
|
|||
/** |
|||
* 模块编码转换成对应枚举的 下标,供前端作为消息通知的查询条件 |
|||
* @param dtos |
|||
* @return java.util.List<com.elink.esua.epdc.dto.result.EpdcModuleResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 10:55 2020-05-20 |
|||
**/ |
|||
private List<EpdcModuleResultDTO> moduleCodeSwitchNumber(List<EpdcModuleResultDTO> dtos) { |
|||
for (EpdcModuleResultDTO dto : dtos) { |
|||
dto.setModuleCode(ModuleCategoryEnum.getIndex(dto.getModuleCode())); |
|||
} |
|||
return dtos; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
<?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.modules.dept.dao.DeptInfoDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.dept.entity.DeptInfoEntity" id="deptInfoMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="deptName" column="DEPT_NAME"/> |
|||
<result property="deptId" column="DEPT_ID"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<select id="getDeptIdCount" resultType="int"> |
|||
SELECT |
|||
COUNT(1) |
|||
FROM epdc_dept_info |
|||
WHERE DEPT_ID = #{deptId} |
|||
AND DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
<select id="selectListDeptInfo" resultType="com.elink.esua.epdc.dto.result.EpdcDeptInfoResultDTO"> |
|||
SELECT |
|||
ID id, |
|||
DEPT_NAME deptName, |
|||
DEPT_ID deptId, |
|||
MOBILE mobile |
|||
FROM |
|||
epdc_dept_info |
|||
WHERE DEL_FLAG = 0 |
|||
ORDER BY CREATED_TIME DESC |
|||
LIMIT #{pageIndex},#{pageSize} |
|||
</select> |
|||
|
|||
<select id="selectListDeptInfoPage" resultType="com.elink.esua.epdc.dto.DeptInfoDTO"> |
|||
SELECT |
|||
ID id, |
|||
DEPT_NAME deptName, |
|||
DEPT_ID deptId, |
|||
MOBILE mobile, |
|||
CREATED_TIME createdTime |
|||
FROM |
|||
epdc_dept_info |
|||
WHERE DEL_FLAG = 0 |
|||
<if test="deptName != null and deptName.trim() != ''"> |
|||
AND instr(DEPT_NAME, trim(#{deptName})) > 0 |
|||
</if> |
|||
<if test="deptIdList!=null and deptIdList.size()>0"> |
|||
and DEPT_ID in |
|||
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")"> |
|||
#{deptId} |
|||
</foreach> |
|||
</if> |
|||
ORDER BY CREATED_TIME DESC |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,63 @@ |
|||
<?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.modules.module.dao.ModuleDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.module.entity.ModuleEntity" id="moduleMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="moduleCode" column="MODULE_CODE"/> |
|||
<result property="name" column="NAME"/> |
|||
<result property="imgUrl" column="IMG_URL"/> |
|||
<result property="sort" column="SORT"/> |
|||
<result property="enableFlag" column="ENABLE_FLAG"/> |
|||
<result property="remark" column="REMARK"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<select id="selectListModulePage" resultType="com.elink.esua.epdc.dto.ModuleDTO"> |
|||
SELECT |
|||
ID id, |
|||
MODULE_CODE moduleCode, |
|||
NAME `name`, |
|||
IMG_URL imgUrl, |
|||
SORT sort, |
|||
ENABLE_FLAG enableFlag, |
|||
REMARK remark |
|||
FROM |
|||
epdc_module |
|||
WHERE DEL_FLAG = 0 |
|||
<if test="moduleCode != null and moduleCode.trim() != ''"> |
|||
AND instr(MODULE_CODE, trim(#{moduleCode})) > 0 |
|||
</if> |
|||
<if test="name != null and name.trim() != ''"> |
|||
AND instr(NAME, trim(#{name})) > 0 |
|||
</if> |
|||
ORDER BY SORT,CREATED_TIME |
|||
</select> |
|||
|
|||
<select id="getModuleCodeCount" resultType="int"> |
|||
SELECT COUNT(1) |
|||
FROM epdc_module |
|||
WHERE MODULE_CODE = #{moduleCode} |
|||
AND DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
<select id="selectListModule" resultType="com.elink.esua.epdc.dto.result.EpdcModuleResultDTO"> |
|||
SELECT |
|||
ID id, |
|||
NAME `name`, |
|||
MODULE_CODE moduleCode, |
|||
IMG_URL imgUrl, |
|||
SORT sort |
|||
FROM |
|||
epdc_module |
|||
WHERE DEL_FLAG = 0 |
|||
AND ENABLE_FLAG = 1 |
|||
ORDER BY SORT,CREATED_TIME |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue