Browse Source

内容管理代码生成

master
Jackwang 4 years ago
parent
commit
94a4d38aae
  1. 94
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/ModuleTypeController.java
  2. 94
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/RoleModuleController.java
  3. 33
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/ModuleTypeDao.java
  4. 33
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/RoleModuleDao.java
  5. 68
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/ModuleTypeEntity.java
  6. 24
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/NoticeEntity.java
  7. 48
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/RoleModuleEntity.java
  8. 74
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/excel/ModuleTypeExcel.java
  9. 62
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/excel/RoleModuleExcel.java
  10. 47
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/redis/ModuleTypeRedis.java
  11. 47
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/redis/RoleModuleRedis.java
  12. 95
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/ModuleTypeService.java
  13. 95
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/RoleModuleService.java
  14. 104
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/ModuleTypeServiceImpl.java
  15. 104
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/RoleModuleServiceImpl.java
  16. 23
      epdc-cloud-news/src/main/resources/mapper/ModuleTypeDao.xml
  17. 19
      epdc-cloud-news/src/main/resources/mapper/RoleModuleDao.xml

94
epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/ModuleTypeController.java

@ -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.ModuleTypeDTO;
import com.elink.esua.epdc.excel.ModuleTypeExcel;
import com.elink.esua.epdc.service.ModuleTypeService;
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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@RestController
@RequestMapping("moduletype")
public class ModuleTypeController {
@Autowired
private ModuleTypeService moduleTypeService;
@GetMapping("page")
public Result<PageData<ModuleTypeDTO>> page(@RequestParam Map<String, Object> params){
PageData<ModuleTypeDTO> page = moduleTypeService.page(params);
return new Result<PageData<ModuleTypeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ModuleTypeDTO> get(@PathVariable("id") String id){
ModuleTypeDTO data = moduleTypeService.get(id);
return new Result<ModuleTypeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ModuleTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
moduleTypeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ModuleTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
moduleTypeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
moduleTypeService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ModuleTypeDTO> list = moduleTypeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ModuleTypeExcel.class);
}
}

94
epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/RoleModuleController.java

@ -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.RoleModuleDTO;
import com.elink.esua.epdc.excel.RoleModuleExcel;
import com.elink.esua.epdc.service.RoleModuleService;
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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@RestController
@RequestMapping("rolemodule")
public class RoleModuleController {
@Autowired
private RoleModuleService roleModuleService;
@GetMapping("page")
public Result<PageData<RoleModuleDTO>> page(@RequestParam Map<String, Object> params){
PageData<RoleModuleDTO> page = roleModuleService.page(params);
return new Result<PageData<RoleModuleDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<RoleModuleDTO> get(@PathVariable("id") String id){
RoleModuleDTO data = roleModuleService.get(id);
return new Result<RoleModuleDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody RoleModuleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
roleModuleService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody RoleModuleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
roleModuleService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
roleModuleService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<RoleModuleDTO> list = roleModuleService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, RoleModuleExcel.class);
}
}

33
epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/ModuleTypeDao.java

@ -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.ModuleTypeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 模块类别管理
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Mapper
public interface ModuleTypeDao extends BaseDao<ModuleTypeEntity> {
}

33
epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/RoleModuleDao.java

@ -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.RoleModuleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 角色栏目关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Mapper
public interface RoleModuleDao extends BaseDao<RoleModuleEntity> {
}

68
epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/ModuleTypeEntity.java

@ -0,0 +1,68 @@
/**
* 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.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 模块类别管理
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_module_type")
public class ModuleTypeEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 上级ID
*/
private String pid;
/**
* 所有上级ID 逗号分隔
*/
private String pids;
/**
* 类别名称
*/
private String typeName;
/**
* 类别编码
*/
private String typeCode;
/**
* 排序
*/
private Integer sort;
/**
* 启用标识 0-1-
*/
private String bannerFlag;
}

24
epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/NoticeEntity.java

@ -17,16 +17,12 @@
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.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
@ -102,4 +98,24 @@ public class NoticeEntity extends BaseEpdcEntity {
*/
private String allDeptNames;
/**
* 通知扩展标记 0普通通知 1模块规则
*/
private String extendFlag;
/**
* 类别编码
*/
private String typeCode;
/**
* 置顶标识 0-1-
*/
private String topFlag;
/**
* 上下架状态 0-下架1-上架
*/
private String noticeUpDownState;
}

48
epdc-cloud-news/src/main/java/com/elink/esua/epdc/entity/RoleModuleEntity.java

@ -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.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 角色栏目关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_role_module")
public class RoleModuleEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private String roleId;
/**
* 栏目ID
*/
private String moduleId;
}

74
epdc-cloud-news/src/main/java/com/elink/esua/epdc/excel/ModuleTypeExcel.java

@ -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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Data
public class ModuleTypeExcel {
@Excel(name = "标识号")
private String id;
@Excel(name = "上级ID")
private String pid;
@Excel(name = "所有上级ID 逗号分隔")
private String pids;
@Excel(name = "类别名称")
private String typeName;
@Excel(name = "类别编码")
private String typeCode;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "启用标识 0-否,1-是")
private String bannerFlag;
@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;
}

62
epdc-cloud-news/src/main/java/com/elink/esua/epdc/excel/RoleModuleExcel.java

@ -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.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 2021-08-09
*/
@Data
public class RoleModuleExcel {
@Excel(name = "标识号")
private String id;
@Excel(name = "角色ID")
private String roleId;
@Excel(name = "栏目ID")
private String moduleId;
@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;
}

47
epdc-cloud-news/src/main/java/com/elink/esua/epdc/redis/ModuleTypeRedis.java

@ -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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Component
public class ModuleTypeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epdc-cloud-news/src/main/java/com/elink/esua/epdc/redis/RoleModuleRedis.java

@ -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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Component
public class RoleModuleRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/ModuleTypeService.java

@ -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.ModuleTypeDTO;
import com.elink.esua.epdc.entity.ModuleTypeEntity;
import java.util.List;
import java.util.Map;
/**
* 模块类别管理
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
public interface ModuleTypeService extends BaseService<ModuleTypeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ModuleTypeDTO>
* @author generator
* @date 2021-08-09
*/
PageData<ModuleTypeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ModuleTypeDTO>
* @author generator
* @date 2021-08-09
*/
List<ModuleTypeDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ModuleTypeDTO
* @author generator
* @date 2021-08-09
*/
ModuleTypeDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-08-09
*/
void save(ModuleTypeDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-08-09
*/
void update(ModuleTypeDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-08-09
*/
void delete(String[] ids);
}

95
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/RoleModuleService.java

@ -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.RoleModuleDTO;
import com.elink.esua.epdc.entity.RoleModuleEntity;
import java.util.List;
import java.util.Map;
/**
* 角色栏目关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
public interface RoleModuleService extends BaseService<RoleModuleEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<RoleModuleDTO>
* @author generator
* @date 2021-08-09
*/
PageData<RoleModuleDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<RoleModuleDTO>
* @author generator
* @date 2021-08-09
*/
List<RoleModuleDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return RoleModuleDTO
* @author generator
* @date 2021-08-09
*/
RoleModuleDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-08-09
*/
void save(RoleModuleDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-08-09
*/
void update(RoleModuleDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-08-09
*/
void delete(String[] ids);
}

104
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/ModuleTypeServiceImpl.java

@ -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.ModuleTypeDao;
import com.elink.esua.epdc.dto.ModuleTypeDTO;
import com.elink.esua.epdc.entity.ModuleTypeEntity;
import com.elink.esua.epdc.redis.ModuleTypeRedis;
import com.elink.esua.epdc.service.ModuleTypeService;
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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Service
public class ModuleTypeServiceImpl extends BaseServiceImpl<ModuleTypeDao, ModuleTypeEntity> implements ModuleTypeService {
@Autowired
private ModuleTypeRedis moduleTypeRedis;
@Override
public PageData<ModuleTypeDTO> page(Map<String, Object> params) {
IPage<ModuleTypeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ModuleTypeDTO.class);
}
@Override
public List<ModuleTypeDTO> list(Map<String, Object> params) {
List<ModuleTypeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ModuleTypeDTO.class);
}
private QueryWrapper<ModuleTypeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ModuleTypeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ModuleTypeDTO get(String id) {
ModuleTypeEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ModuleTypeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ModuleTypeDTO dto) {
ModuleTypeEntity entity = ConvertUtils.sourceToTarget(dto, ModuleTypeEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ModuleTypeDTO dto) {
ModuleTypeEntity entity = ConvertUtils.sourceToTarget(dto, ModuleTypeEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

104
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/RoleModuleServiceImpl.java

@ -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.RoleModuleDao;
import com.elink.esua.epdc.dto.RoleModuleDTO;
import com.elink.esua.epdc.entity.RoleModuleEntity;
import com.elink.esua.epdc.redis.RoleModuleRedis;
import com.elink.esua.epdc.service.RoleModuleService;
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 qu qu@elink-cn.com
* @since v1.0.0 2021-08-09
*/
@Service
public class RoleModuleServiceImpl extends BaseServiceImpl<RoleModuleDao, RoleModuleEntity> implements RoleModuleService {
@Autowired
private RoleModuleRedis roleModuleRedis;
@Override
public PageData<RoleModuleDTO> page(Map<String, Object> params) {
IPage<RoleModuleEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, RoleModuleDTO.class);
}
@Override
public List<RoleModuleDTO> list(Map<String, Object> params) {
List<RoleModuleEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, RoleModuleDTO.class);
}
private QueryWrapper<RoleModuleEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<RoleModuleEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public RoleModuleDTO get(String id) {
RoleModuleEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, RoleModuleDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(RoleModuleDTO dto) {
RoleModuleEntity entity = ConvertUtils.sourceToTarget(dto, RoleModuleEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(RoleModuleDTO dto) {
RoleModuleEntity entity = ConvertUtils.sourceToTarget(dto, RoleModuleEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

23
epdc-cloud-news/src/main/resources/mapper/ModuleTypeDao.xml

@ -0,0 +1,23 @@
<?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.ModuleTypeDao">
<resultMap type="com.elink.esua.epdc.entity.ModuleTypeEntity" id="moduleTypeMap">
<result property="id" column="ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="typeName" column="TYPE_NAME"/>
<result property="typeCode" column="TYPE_CODE"/>
<result property="sort" column="SORT"/>
<result property="bannerFlag" column="BANNER_FLAG"/>
<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>
</mapper>

19
epdc-cloud-news/src/main/resources/mapper/RoleModuleDao.xml

@ -0,0 +1,19 @@
<?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.RoleModuleDao">
<resultMap type="com.elink.esua.epdc.entity.RoleModuleEntity" id="roleModuleMap">
<result property="id" column="ID"/>
<result property="roleId" column="ROLE_ID"/>
<result property="moduleId" column="MODULE_ID"/>
<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>
</mapper>
Loading…
Cancel
Save