From 24f60b3c19b4d83cae4296ba9d91ec661a1532be Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Wed, 27 May 2020 16:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=85=8D=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/elink/esua/epdc/dto/ImgConfigDTO.java | 86 +++++++++++++ .../epdc/controller/ImgConfigController.java | 107 +++++++++++++++++ .../com/elink/esua/epdc/dao/ImgConfigDao.java | 39 ++++++ .../esua/epdc/entity/ImgConfigEntity.java | 56 +++++++++ .../elink/esua/epdc/excel/ImgConfigExcel.java | 65 ++++++++++ .../esua/epdc/feign/AdminFeignClient.java | 16 ++- .../fallback/AdminFeignClientFallback.java | 10 +- .../elink/esua/epdc/redis/ImgConfigRedis.java | 47 ++++++++ .../esua/epdc/service/ImgConfigService.java | 107 +++++++++++++++++ .../service/impl/ImgConfigServiceImpl.java | 113 ++++++++++++++++++ .../main/resources/mapper/ImgConfigDao.xml | 34 ++++++ 11 files changed, 672 insertions(+), 8 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/ImgConfigDTO.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/resources/mapper/ImgConfigDao.xml diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/ImgConfigDTO.java b/esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/ImgConfigDTO.java new file mode 100644 index 00000000..9f41c5a7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-client/src/main/java/com/elink/esua/epdc/dto/ImgConfigDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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-27 + */ +@Data +public class ImgConfigDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 类型(0-志愿者咨询热线) + */ + private String imgType; + + /** + * 图片地址 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 删除标识 0:未删除 1:删除 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java new file mode 100644 index 00000000..b9ff6f45 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.excel.ImgConfigExcel; +import com.elink.esua.epdc.service.ImgConfigService; +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-27 + */ +@RestController +@RequestMapping("imgconfig") +public class ImgConfigController { + + @Autowired + private ImgConfigService imgConfigService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = imgConfigService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ImgConfigDTO data = imgConfigService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ImgConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + imgConfigService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ImgConfigDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + imgConfigService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + imgConfigService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = imgConfigService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ImgConfigExcel.class); + } + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + @GetMapping("heartImgType/{dictType}") + public Result> listSimpleDictInfo(@PathVariable("dictType") String dictType){ + return imgConfigService.getListSimpleDictInfo(dictType); + } +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java new file mode 100644 index 00000000..05595161 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.ImgConfigDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +@Mapper +public interface ImgConfigDao extends BaseDao { + + List selectListImgConfig(Map params); +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java new file mode 100644 index 00000000..17012679 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +import java.util.Date; + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_img_config") +public class ImgConfigEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 类型(0-志愿者咨询热线) + */ + private String imgType; + + /** + * 图片地址 + */ + private String imgUrl; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java new file mode 100644 index 00000000..d797c58f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +@Data +public class ImgConfigExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "类型(0-志愿者咨询热线)") + private String imgType; + + @Excel(name = "图片地址") + private String imgUrl; + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private String delFlag; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java index 9b41b246..93a7813b 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java @@ -2,10 +2,7 @@ package com.elink.esua.epdc.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.CompleteDeptDTO; -import com.elink.esua.epdc.dto.DeptOption; -import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; -import com.elink.esua.epdc.dto.SysUserDTO; +import com.elink.esua.epdc.dto.*; import com.elink.esua.epdc.dto.epdc.GridLeaderRegisterDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; import com.elink.esua.epdc.feign.fallback.AdminFeignClientFallback; @@ -90,4 +87,15 @@ public interface AdminFeignClient { **/ @GetMapping("sys/dept/party/getDeptTreeForEpiDemic") Result getDeptTreeForEpiDemic(); + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + @GetMapping("sys/dict/listSimple/{dictType}") + Result> getListSimpleDictInfo(@PathVariable("dictType") String dictType); } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java index e7f13a42..d3f757a0 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java @@ -3,10 +3,7 @@ package com.elink.esua.epdc.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.CompleteDeptDTO; -import com.elink.esua.epdc.dto.DeptOption; -import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; -import com.elink.esua.epdc.dto.SysUserDTO; +import com.elink.esua.epdc.dto.*; import com.elink.esua.epdc.dto.epdc.GridLeaderRegisterDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcAppIndexPanelResultDTO; import com.elink.esua.epdc.feign.AdminFeignClient; @@ -51,4 +48,9 @@ public class AdminFeignClientFallback implements AdminFeignClient { public Result getDeptTreeForEpiDemic() { return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getDeptTreeForEpiDemic"); } + + @Override + public Result> getListSimpleDictInfo(String dictType) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getListSimpleDictInfo", dictType); + } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java new file mode 100644 index 00000000..edd6478c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 zhangyong + * @since v1.0.0 2020-05-27 + */ +@Component +public class ImgConfigRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java new file mode 100644 index 00000000..d0b4de43 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; + +import java.util.List; +import java.util.Map; + +/** + * 图片配置表 + * + * @author zhangyong + * @since v1.0.0 2020-05-27 + */ +public interface ImgConfigService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ImgConfigDTO + * @author generator + * @date 2020-05-27 + */ + ImgConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-27 + */ + void save(ImgConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-27 + */ + void update(ImgConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-27 + */ + void delete(String[] ids); + + /** + * 根据数据字典类型获取简版数据字典列表,用于页面下拉菜单 + * + * @param dictType + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @Author zhangyong + * @Date 15:27 2020-05-27 + **/ + Result> getListSimpleDictInfo(String dictType); +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java new file mode 100644 index 00000000..e2110d01 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java @@ -0,0 +1,113 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.commons.tools.utils.Result; +import com.elink.esua.epdc.dao.ImgConfigDao; +import com.elink.esua.epdc.dto.ImgConfigDTO; +import com.elink.esua.epdc.dto.SysSimpleDictDTO; +import com.elink.esua.epdc.entity.ImgConfigEntity; +import com.elink.esua.epdc.feign.AdminFeignClient; +import com.elink.esua.epdc.redis.ImgConfigRedis; +import com.elink.esua.epdc.service.ImgConfigService; +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-27 + */ +@Service +public class ImgConfigServiceImpl extends BaseServiceImpl implements ImgConfigService { + + @Autowired + private ImgConfigRedis imgConfigRedis; + + @Autowired + private AdminFeignClient adminFeignClient; + + @Override + public PageData page(Map params) { + IPage page = getPage(params); + List list = baseDao.selectListImgConfig(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ImgConfigDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ImgConfigDTO get(String id) { + ImgConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ImgConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ImgConfigDTO dto) { + ImgConfigEntity entity = ConvertUtils.sourceToTarget(dto, ImgConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ImgConfigDTO dto) { + ImgConfigEntity entity = ConvertUtils.sourceToTarget(dto, ImgConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result> getListSimpleDictInfo(String dictType) { + return adminFeignClient.getListSimpleDictInfo(dictType); + } + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/resources/mapper/ImgConfigDao.xml b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/resources/mapper/ImgConfigDao.xml new file mode 100644 index 00000000..44f5781d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/resources/mapper/ImgConfigDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + +