Browse Source

代码提交 榆山图片配置及小程序首页电话代码开发 api

origin/dept_screen
zhangfh 4 years ago
parent
commit
fba59cb938
  1. 50
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java
  2. 107
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java
  3. 56
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java
  4. 66
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java
  5. 65
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java
  6. 68
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.java
  7. 67
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java
  8. 13
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java
  9. 5
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java
  10. 47
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.java
  11. 126
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java
  12. 131
      epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java
  13. 53
      epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml

50
epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ApiImgConfigController.java

@ -0,0 +1,50 @@
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.form.EpdcAppImgTypeListFormDTO;
import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO;
import com.elink.esua.epdc.service.ImgConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* APP 获取咨询热线图片
*
* @author zhangyong
* @date 2020/05/27 18:30
*/
@RestController
@RequestMapping("imgConfig")
public class ApiImgConfigController {
@Autowired
private ImgConfigService imgConfigService;
/**
* 根据 志愿者模块图片类型 查询图片列表
* @param imgType 志愿者模块图片类型
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO>>
* @Author zhangyong
* @Date 17:04 2020-05-27
**/
@GetMapping("getImgUrl/{imgType}")
public Result<List<EpdcImgConfigResultDTO>> getImgUrlList(@PathVariable("imgType") String imgType){
return imgConfigService.listImgUrl(imgType);
}
/**
* 根据 志愿者模块图片类型 查询图片列表
* @param epdcAppImgTypeListFormDTO 志愿者模块图片类型
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO>>
* @Author zhangyong
* @Date 17:04 2020-05-27
**/
@GetMapping("getImgUrlList")
public Result<List<EpdcImgConfigResultDTO>> getImgUrlList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO){
return imgConfigService.listImgUrlByTypeList(epdcAppImgTypeListFormDTO);
}
}

107
epdc-cloud-api/src/main/java/com/elink/esua/epdc/controller/ImgConfigController.java

@ -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.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.DefaultGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
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<PageData<ImgConfigDTO>> page(@RequestParam Map<String, Object> params){
PageData<ImgConfigDTO> page = imgConfigService.page(params);
return new Result<PageData<ImgConfigDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ImgConfigDTO> get(@PathVariable("id") String id){
ImgConfigDTO data = imgConfigService.get(id);
return new Result<ImgConfigDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
List<ImgConfigDTO> list = imgConfigService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ImgConfigExcel.class);
}
/**
* 根据数据字典类型获取简版数据字典列表用于页面下拉菜单
*
* @param dictType
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.SysSimpleDictDTO>>
* @Author zhangyong
* @Date 15:27 2020-05-27
**/
@GetMapping("heartImgType/{dictType}")
public Result<List<SysSimpleDictDTO>> listSimpleDictInfo(@PathVariable("dictType") String dictType){
return imgConfigService.getListSimpleDictInfo(dictType);
}
}

56
epdc-cloud-api/src/main/java/com/elink/esua/epdc/dao/ImgConfigDao.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.ImgConfigDTO;
import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO;
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<ImgConfigEntity> {
/**
* 图片配置 首页查询
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.ImgConfigDTO>
* @Author zhangyong
* @Date 17:25 2020-05-27
**/
List<ImgConfigDTO> selectListImgConfig(Map<String, Object> params);
/**
* 根据 志愿者模块图片类型 查询图片列表
* @param imgType 志愿者模块图片类型
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO>>
* @Author zhangyong
* @Date 17:04 2020-05-27
**/
List<EpdcImgConfigResultDTO> selectListImgConfigByImgType(String imgType);
}

66
epdc-cloud-api/src/main/java/com/elink/esua/epdc/entity/ImgConfigEntity.java

@ -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.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-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;
/**
* 图片地址
*/
private String imgCode;
/**
* 备注
*/
private String remark;
/**
* 启用标识 0未启用 1启用
*/
private String enableFlag;
}

65
epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ImgConfigExcel.java

@ -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.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;
}

68
epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/ResidentConfigExcel.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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 居民端配置表
*
* @author elink elink@elink-cn.com
* @since v1.0.0 2020-06-08
*/
@Data
public class ResidentConfigExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "配置类型")
private String residentType;
@Excel(name = "配置编码")
private String residentCode;
@Excel(name = "配置内容")
private String residentValue;
@Excel(name = "排序")
private String sort;
@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;
}

67
epdc-cloud-api/src/main/java/com/elink/esua/epdc/excel/StartupPageExcel.java

@ -0,0 +1,67 @@
/**
* 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;
/**
* @Description 启动页管理 启动页管理
* @Author songyunpeng
* @Date 2020/4/27
**/
@Data
public class StartupPageExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "图片地址")
private String imgUrl;
@Excel(name = "停留时长 单位:秒")
private Integer duration;
@Excel(name = "启用标识 0:否,1:是")
private String enableFlag;
@Excel(name = "备注")
private String remark;
@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;
@Excel(name = "删除标记")
private String delFlag;
}

13
epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/AdminFeignClient.java

@ -25,7 +25,7 @@ import java.util.List;
* @email yujintao@elink-cn.com
* @date 2019/9/7 9:27
*/
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class,url = "http://localhost:9092")
public interface AdminFeignClient {
/**
@ -186,4 +186,15 @@ public interface AdminFeignClient {
*/
@GetMapping("sys/gridmember/getMemberList")
Result getMemberList(AppMemberListFromDTO dto);
/**
* 根据数据字典类型获取简版数据字典列表用于页面下拉菜单
*
* @param dictType
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.SysSimpleDictDTO>>
* @Author zhangyong
* @Date 15:27 2020-05-27
**/
@GetMapping("sys/dict/listSimple/{dictType}")
Result<List<SysSimpleDictDTO>> getListSimpleDictInfo(@PathVariable("dictType") String dictType);
}

5
epdc-cloud-api/src/main/java/com/elink/esua/epdc/feign/fallback/AdminFeignClientFallback.java

@ -96,4 +96,9 @@ public class AdminFeignClientFallback implements AdminFeignClient {
public Result getMemberList(AppMemberListFromDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER,"getMemberList",dto);
}
@Override
public Result<List<SysSimpleDictDTO>> getListSimpleDictInfo(String dictType) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getListSimpleDictInfo", dictType);
}
}

47
epdc-cloud-api/src/main/java/com/elink/esua/epdc/redis/ImgConfigRedis.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 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;
}
}

126
epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/ImgConfigService.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.ImgConfigDTO;
import com.elink.esua.epdc.dto.SysSimpleDictDTO;
import com.elink.esua.epdc.dto.form.EpdcAppImgTypeListFormDTO;
import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO;
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<ImgConfigEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ImgConfigDTO>
* @author generator
* @date 2020-05-27
*/
PageData<ImgConfigDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ImgConfigDTO>
* @author generator
* @date 2020-05-27
*/
List<ImgConfigDTO> list(Map<String, Object> 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<java.util.List<com.elink.esua.epdc.dto.SysSimpleDictDTO>>
* @Author zhangyong
* @Date 15:27 2020-05-27
**/
Result<List<SysSimpleDictDTO>> getListSimpleDictInfo(String dictType);
/**
* 根据 志愿者模块图片类型 查询图片列表
* @param imgType 志愿者模块图片类型
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO>>
* @Author zhangyong
* @Date 17:04 2020-05-27
**/
Result<List<EpdcImgConfigResultDTO>> listImgUrl(String imgType);
/**
* @Description 根据 志愿者模块图片类型列表 查询图片列表
* @Author songyunpeng
* @Date 2021/5/14
* @Param [epdcAppImgTypeListFormDTO]
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO>>
**/
Result<List<EpdcImgConfigResultDTO>> listImgUrlByTypeList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO);
}

131
epdc-cloud-api/src/main/java/com/elink/esua/epdc/service/impl/ImgConfigServiceImpl.java

@ -0,0 +1,131 @@
/**
* 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.constant.FieldConstant;
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.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.dto.form.EpdcAppImgTypeListFormDTO;
import com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO;
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<ImgConfigDao, ImgConfigEntity> implements ImgConfigService {
@Autowired
private ImgConfigRedis imgConfigRedis;
@Autowired
private AdminFeignClient adminFeignClient;
@Override
public PageData<ImgConfigDTO> page(Map<String, Object> params) {
IPage<ImgConfigDTO> page = getPage(params);
List<ImgConfigDTO> list = baseDao.selectListImgConfig(params);
return new PageData<>(list, page.getTotal());
}
@Override
public List<ImgConfigDTO> list(Map<String, Object> params) {
List<ImgConfigEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ImgConfigDTO.class);
}
private QueryWrapper<ImgConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ImgConfigEntity> 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<List<SysSimpleDictDTO>> getListSimpleDictInfo(String dictType) {
return adminFeignClient.getListSimpleDictInfo(dictType);
}
@Override
public Result<List<EpdcImgConfigResultDTO>> listImgUrl(String imgType) {
List<EpdcImgConfigResultDTO> list = baseDao.selectListImgConfigByImgType(imgType);
return new Result<List<EpdcImgConfigResultDTO>>().ok(list);
}
@Override
public Result<List<EpdcImgConfigResultDTO>> listImgUrlByTypeList(EpdcAppImgTypeListFormDTO epdcAppImgTypeListFormDTO) {
QueryWrapper<ImgConfigEntity> queryWrapper = new QueryWrapper();
queryWrapper.eq("ENABLE_FLAG",1);
queryWrapper.in(epdcAppImgTypeListFormDTO.getImageTypes()!=null && epdcAppImgTypeListFormDTO.getImageTypes().size()>0,"IMG_TYPE",epdcAppImgTypeListFormDTO.getImageTypes());
List<ImgConfigEntity> imgConfigEntities = baseDao.selectList(queryWrapper);
List<EpdcImgConfigResultDTO> epdcImgConfigResultDTOS = ConvertUtils.sourceToTarget(imgConfigEntities, EpdcImgConfigResultDTO.class);
return new Result<List<EpdcImgConfigResultDTO>>().ok(epdcImgConfigResultDTOS);
}
}

53
epdc-cloud-api/src/main/resources/mapper/ImgConfigDao.xml

@ -0,0 +1,53 @@
<?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.ImgConfigDao">
<resultMap type="com.elink.esua.epdc.entity.ImgConfigEntity" id="imgConfigMap">
<result property="id" column="ID"/>
<result property="imgType" column="IMG_TYPE"/>
<result property="imgUrl" column="IMG_URL"/>
<result property="sort" column="SORT"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="imgCode" column="IMG_CODE"/>
<result property="remark" column="REMARK"/>
<result property="enableFlag" column="ENABLE_FLAG"/>
</resultMap>
<select id="selectListImgConfig" resultType="com.elink.esua.epdc.dto.ImgConfigDTO">
SELECT
ID id,
IMG_TYPE imgType,
IMG_URL imgUrl,
SORT sort,
IMG_CODE imgCode,
CREATED_TIME createdTime,
REMARK remark,
ENABLE_FLAG
FROM
`epdc_img_config`
WHERE DEL_FLAG = 0
<if test="imgType != null and imgType != ''">
AND IMG_TYPE = #{imgType,jdbcType=VARCHAR}
</if>
ORDER BY SORT,CREATED_TIME DESC
</select>
<select id="selectListImgConfigByImgType" resultType="com.elink.esua.epdc.dto.result.EpdcImgConfigResultDTO">
SELECT
IMG_URL imgUrl,
IMG_TYPE imgType,
IMG_CODE imgCode,
REMARK remark
FROM
`epdc_img_config`
WHERE DEL_FLAG = 0 and ENABLE_FLAG = '1'
AND IMG_TYPE = #{imgType,jdbcType=VARCHAR}
ORDER BY SORT,CREATED_TIME DESC
</select>
</mapper>
Loading…
Cancel
Save