diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionariesRecordController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionariesRecordController.java index ccece039f..fc7780c0c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionariesRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionariesRecordController.java @@ -8,6 +8,7 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord; import com.zhgd.xmgl.modules.basicdata.service.IDictionariesRecordService; import com.zhgd.xmgl.util.MessageUtil; +import com.zhgd.xmgl.util.ReflectionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -37,7 +38,7 @@ import java.util.Map; public class DictionariesRecordController { @Autowired private IDictionariesRecordService dictionariesRecordService; - + /** * 分页列表查询 * @param dictionariesRecord @@ -52,14 +53,15 @@ public class DictionariesRecordController { @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { - Result> result = new Result>(); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(dictionariesRecord, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = dictionariesRecordService.page(page, queryWrapper); - result.setSuccess(true); - result.setResult(pageList); - return result; - } + Result> result = new Result<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(dictionariesRecord, req.getParameterMap(), null, + ReflectionUtil.getFieldNameList(DictionariesRecord::getDictionaryName)); + Page page = new Page<>(pageNo, pageSize); + IPage pageList = dictionariesRecordService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } @ApiOperation(value = " 查询职务类型和职务列表", notes = "查询职务类型和职务列表", httpMethod="GET") @GetMapping(value = "/selectJobList") @@ -101,32 +103,24 @@ public class DictionariesRecordController { data.put("jobTypeList",typedata); return Result.success(data); } - - /** - * 添加 - * @param dictionariesRecord - * @return - */ + + /** + * 添加 + * @param dictionariesRecord + * @return + */ @ApiOperation(value = " 添加基础字典信息", notes = "添加基础字典信息" , httpMethod="POST") @PostMapping(value = "/add") public Result add(@RequestBody DictionariesRecord dictionariesRecord) { - Result result = new Result(); - try { - dictionariesRecordService.save(dictionariesRecord); - result.successMsg("添加成功!"); - } catch (Exception e) { - e.printStackTrace(); - log.info(e.getMessage()); - result.error500("操作失败"); - } - return result; - } - - /** - * 编辑 - * @param dictionariesRecord - * @return - */ + dictionariesRecordService.add(dictionariesRecord); + return Result.ok(); + } + + /** + * 编辑 + * @param dictionariesRecord + * @return + */ @ApiOperation(value = "编辑基础字典信息", notes = "编辑基础字典信息" , httpMethod="POST") @PostMapping(value = "/edit") public Result edit(@RequestBody DictionariesRecord dictionariesRecord) { @@ -141,15 +135,15 @@ public class DictionariesRecordController { result.successMsg(MessageUtil.get("editSucess")); } } - - return result; + + return result; } - - /** - * 通过id删除 - * @param - * @return - */ + + /** + * 通过id删除 + * @param + * @return + */ @ApiOperation(value = "删除基础字典信息", notes = "删除基础字典信息" , httpMethod="POST") @ApiImplicitParam(name = "id", value = "基础字典ID", paramType = "query", required = true, dataType = "Integer") @PostMapping(value = "/delete") @@ -164,13 +158,12 @@ public class DictionariesRecordController { result.successMsg(MessageUtil.get("deleteSucess")); } } - - return result; - } - - - /** + return result; + } + + + /** * 通过id查询 * @param * @return diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionaryController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionaryController.java new file mode 100644 index 000000000..29e1cc6da --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/DictionaryController.java @@ -0,0 +1,287 @@ +package com.zhgd.xmgl.modules.basicdata.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; +import com.zhgd.xmgl.modules.basicdata.entity.Dictionary; +import com.zhgd.xmgl.modules.basicdata.service.IDictionaryService; +import com.zhgd.xmgl.util.ReflectionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** + * @Title: Controller + * @Description: 字典 + * @author: pds + * @date: 2023-07-24 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/dictionary") +@Slf4j +@Api(tags = "DictionaryController相关Api") +public class DictionaryController { + @Autowired + private IDictionaryService dictionaryService; + + /** + * 分页列表查询 + * + * @param dictionary + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = " 分页列表查询字典信息", notes = "分页列表查询字典信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(Dictionary dictionary, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(dictionary, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = dictionaryService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 列表查询 + * + * @param dictionary + * @param req + * @return + */ + @ApiOperation(value = " 列表查询字典信息", notes = "列表查询字典信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(Dictionary dictionary, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(dictionary, req.getParameterMap(), null, + ReflectionUtil.getFieldNameList(Dictionary::getKeyName, Dictionary::getDictionaryValue)); + return Result.success(dictionaryService.list(queryWrapper)); + } + + /** + * 添加 + * + * @param dictionary + * @return + */ + @ApiOperation(value = " 添加字典信息", notes = "添加字典信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody Dictionary dictionary) { + Result result = new Result(); + try { + dictionaryService.save(dictionary); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑 + * + * @param dictionary + * @return + */ + @ApiOperation(value = "编辑字典信息", notes = "编辑字典信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody Dictionary dictionary) { + Result result = new Result(); + Dictionary dictionaryEntity = dictionaryService.getById(dictionary.getId()); + if (dictionaryEntity == null) { + result.error500("未找到对应实体"); + } else { + dictionaryService.updateById(dictionary); + result.success("修改成功!"); + } + + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除字典信息", notes = "删除字典信息", httpMethod = "POST") + @PostMapping(value = "/delete") + public Result delete(@RequestBody String id) { + JSONObject jsonObject = JSON.parseObject(id, JSONObject.class); + id = String.valueOf(jsonObject.get("id")); + Result result = new Result(); + Dictionary dictionary = dictionaryService.getById(id); + if (dictionary == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = dictionaryService.removeById(id); + if (ok) { + result.success("删除成功!"); + } + } + + return result; + } + + @ApiOperation(value = "物理删除字典信息", notes = "物理删除字典信息", httpMethod = "POST") + @PostMapping(value = "/deletePhysic") + public Result deletePhysic(@RequestBody String id) { + dictionaryService.deletePhysic(id); + return Result.ok(); + } + + @ApiOperation(value = "恢复逻辑删除的字典信息", notes = "恢复逻辑删除的字典信息", httpMethod = "POST") + @PostMapping(value = "/back") + public Result back(@RequestBody String id) { + dictionaryService.back(id); + return Result.ok(); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "批量删除字典信息", notes = "批量删除字典信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "字典ID字符串", paramType = "query", required = true, dataType = "String") + @PostMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.dictionaryService.removeByIds(Arrays.asList(ids.split(","))); + result.success("删除成功!"); + } + return result; + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @ApiOperation(value = "通过id查询字典信息", notes = "通过id查询字典信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "字典ID", paramType = "query", required = true, dataType = "Integer") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + Dictionary dictionary = dictionaryService.getById(id); + if (dictionary == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(dictionary); + result.setSuccess(true); + } + return result; + } + + /** + * 导出excel + * + * @param request + * @param response + */ + @ApiOperation(value = "导出excel字典信息", notes = "导出excel字典信息", httpMethod = "POST") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { + // Step.1 组装查询条件 + QueryWrapper queryWrapper = null; + try { + String paramsStr = request.getParameter("paramsStr"); + if (oConvertUtils.isNotEmpty(paramsStr)) { + String deString = URLDecoder.decode(paramsStr, "UTF-8"); + Dictionary dictionary = JSON.parseObject(deString, Dictionary.class); + queryWrapper = QueryGenerator.initQueryWrapper(dictionary, request.getParameterMap()); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List pageList = dictionaryService.list(queryWrapper); + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "字典列表"); + mv.addObject(NormalExcelConstants.CLASS, Dictionary.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("字典列表数据", "导出人:Jeecg", "导出信息")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @ApiOperation(value = "通过excel导入字典信息", notes = "通过excel导入字典信息", httpMethod = "POST") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List listDictionarys = ExcelImportUtil.importExcel(file.getInputStream(), Dictionary.class, params); + for (Dictionary dictionaryExcel : listDictionarys) { + dictionaryService.save(dictionaryExcel); + } + return Result.ok("文件导入成功!数据行数:" + listDictionarys.size()); + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("文件导入失败!"); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.ok("文件导入失败!"); + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/DictionariesRecord.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/DictionariesRecord.java index b7f9cf529..06b470544 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/DictionariesRecord.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/DictionariesRecord.java @@ -1,62 +1,81 @@ package com.zhgd.xmgl.modules.basicdata.entity; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import lombok.Data; -import org.jeecgframework.poi.excel.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + /** * @Description: 基础字典 * @author: pds - * @date: 2020-11-06 + * @date: 2020-11-06 * @version: V1.0 */ @Data @TableName("dictionaries_record") -@ApiModel(value="DictionariesRecord实体类",description="DictionariesRecord") +@ApiModel(value = "DictionariesRecord实体类", description = "DictionariesRecord") public class DictionariesRecord implements Serializable { private static final long serialVersionUID = 1L; - - /**id*/ + + /** + * id + */ @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value="id") - private java.lang.Long id ; - /**类型*/ - @Excel(name = "类型", width = 15) - @ApiModelProperty(value="类型") - private java.lang.Integer type ; - /**字典key值*/ - @Excel(name = "字典key值", width = 15) - @ApiModelProperty(value="字典key值") - private java.lang.String keyName ; - /**字典值*/ - @Excel(name = "字典值", width = 15) - @ApiModelProperty(value="字典值") - private java.lang.String dictionaryValue ; - /**字典名*/ - @Excel(name = "字典名", width = 15) - @ApiModelProperty(value="字典名") - private java.lang.String dictionaryName ; - /**父Id(父级Id 为0时为父)*/ - @Excel(name = "父Id(父级Id 为0时为父)", width = 15) + @ApiModelProperty(value = "id") + private java.lang.Long id; + @ApiModelProperty(value = "dictionary的id") + private java.lang.Long dictionaryId; + /** + * 类型 + */ + @Excel(name = "类型", width = 15) + @ApiModelProperty(value = "类型") + private java.lang.Integer type; + /** + * 字典key值 + */ + @Excel(name = "字典key值", width = 15) + @ApiModelProperty(value = "字典key值") + private java.lang.String keyName; + /** + * 字典值 + */ + @Excel(name = "字典值", width = 15) + @ApiModelProperty(value = "字典值") + private java.lang.String dictionaryValue; + /** + * 字典名 + */ + @Excel(name = "字典名", width = 15) + @ApiModelProperty(value = "字典名") + private java.lang.String dictionaryName; + /** + * 父Id(父级Id 为0时为父) + */ + @Excel(name = "父Id(父级Id 为0时为父)", width = 15) - @ApiModelProperty(value="父Id(父级Id 为0时为父)") - private java.lang.Long parentId ; - /**手动排序字段*/ - @Excel(name = "手动排序字段", width = 15) - @ApiModelProperty(value="手动排序字段") - private java.lang.Integer orderNum ; - /**描述*/ - @Excel(name = "描述", width = 15) - @ApiModelProperty(value="描述") - private java.lang.String remarks ; + @ApiModelProperty(value = "父Id(父级Id 为0时为父)") + private java.lang.Long parentId; + /** + * 手动排序字段 + */ + @Excel(name = "手动排序字段", width = 15) + @ApiModelProperty(value = "手动排序字段") + private java.lang.Integer orderNum; + /** + * 描述 + */ + @Excel(name = "描述", width = 15) + @ApiModelProperty(value = "描述") + private java.lang.String remarks; - @ApiModelProperty(value="接口路径") + @ApiModelProperty(value = "接口路径") private java.lang.String serviceUrl; + @ApiModelProperty(value = "是否启用,1是,0否") + private java.lang.Integer isEnable; } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Dictionary.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Dictionary.java new file mode 100644 index 000000000..2442b1e24 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Dictionary.java @@ -0,0 +1,75 @@ +package com.zhgd.xmgl.modules.basicdata.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * @Description: 字典 + * @author: pds + * @date: 2023-07-24 + * @version: V1.0 + */ +@Data +@TableName("dictionary") +@ApiModel(value = "Dictionary实体类", description = "Dictionary") +public class Dictionary implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键id") + private java.lang.Long id; + /** + * 字典名称 + */ + @Excel(name = "字典名称", width = 15) + @ApiModelProperty(value = "字典名称") + private java.lang.String keyName; + /** + * 字典编码 + */ + @Excel(name = "字典编码", width = 15) + @ApiModelProperty(value = "字典编码") + private java.lang.String dictionaryValue; + /** + * 描述 + */ + @Excel(name = "描述", width = 15) + @ApiModelProperty(value = "描述") + private java.lang.String remarks; + /** + * 删除状态 + */ + @Excel(name = "删除状态", width = 15) + @ApiModelProperty(value = "删除状态(0 删除 1正常默认)") + @TableLogic(value = "1", delval = "0") + private java.lang.Integer delFlag; + /** + * 创建时间 + */ + @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private java.util.Date createTime; + /** + * 更新时间 + */ + @Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private java.util.Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/DictionaryMapper.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/DictionaryMapper.java new file mode 100644 index 000000000..8dc892bd7 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/DictionaryMapper.java @@ -0,0 +1,17 @@ +package com.zhgd.xmgl.modules.basicdata.mapper; + +import org.apache.ibatis.annotations.Mapper; +import com.zhgd.xmgl.modules.basicdata.entity.Dictionary; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 字典 + * @author: pds + * @date: 2023-07-24 + * @version: V1.0 + */ +@Mapper +public interface DictionaryMapper extends BaseMapper { + + void deletePhysic(String id); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/DictionaryMapper.xml b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/DictionaryMapper.xml new file mode 100644 index 000000000..029d1aa47 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/mapper/xml/DictionaryMapper.xml @@ -0,0 +1,7 @@ + + + + + DELETE FROM dictionary where id=#{id} + + diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionariesRecordService.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionariesRecordService.java index 98965900e..cf9394441 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionariesRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionariesRecordService.java @@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IDictionariesRecordService extends IService { + void add(DictionariesRecord dictionariesRecord); } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionaryService.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionaryService.java new file mode 100644 index 000000000..321589046 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/IDictionaryService.java @@ -0,0 +1,17 @@ +package com.zhgd.xmgl.modules.basicdata.service; + +import com.zhgd.xmgl.modules.basicdata.entity.Dictionary; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 字典 + * @author: pds + * @date: 2023-07-24 + * @version: V1.0 + */ +public interface IDictionaryService extends IService { + + void deletePhysic(String id); + + void back(String id); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionariesRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionariesRecordServiceImpl.java index d519ae69b..0d3b961b9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionariesRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionariesRecordServiceImpl.java @@ -1,19 +1,36 @@ package com.zhgd.xmgl.modules.basicdata.service.impl; -import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord; -import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper; -import com.zhgd.xmgl.modules.basicdata.service.IDictionariesRecordService; -import org.springframework.stereotype.Service; - import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord; +import com.zhgd.xmgl.modules.basicdata.entity.Dictionary; +import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper; +import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryMapper; +import com.zhgd.xmgl.modules.basicdata.service.IDictionariesRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * @Description: 基础字典 * @author: pds - * @date: 2020-11-06 + * @date: 2020-11-06 * @version: V1.0 */ @Service public class DictionariesRecordServiceImpl extends ServiceImpl implements IDictionariesRecordService { + @Autowired + DictionariesRecordMapper dictionariesRecordMapper; + @Autowired + DictionaryMapper dictionaryMapper; + @Override + public void add(DictionariesRecord dictionariesRecord) { + Long dictionaryId = dictionariesRecord.getDictionaryId(); + if (dictionaryId == null) { + throw new OpenAlertException("dictionary的id不能为空"); + } + Dictionary dictionary = dictionaryMapper.selectById(dictionaryId); + dictionariesRecord.setKeyName(dictionary.getKeyName()); + dictionariesRecordMapper.insert(dictionariesRecord); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionaryServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionaryServiceImpl.java new file mode 100644 index 000000000..123ef1d5e --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/DictionaryServiceImpl.java @@ -0,0 +1,43 @@ +package com.zhgd.xmgl.modules.basicdata.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord; +import com.zhgd.xmgl.modules.basicdata.entity.Dictionary; +import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper; +import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryMapper; +import com.zhgd.xmgl.modules.basicdata.service.IDictionaryService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @Description: 字典 + * @author: pds + * @date: 2023-07-24 + * @version: V1.0 + */ +@Service +public class DictionaryServiceImpl extends ServiceImpl implements IDictionaryService { + @Autowired + DictionaryMapper dictionaryMapper; + @Autowired + DictionariesRecordMapper dictionariesRecordMapper; + + @Override + public void deletePhysic(String id) { + if (StringUtils.isBlank(id)) { + throw new OpenAlertException("id不能为空"); + } + dictionaryMapper.deletePhysic(id); + dictionariesRecordMapper.delete(new LambdaQueryWrapper().eq(DictionariesRecord::getDictionaryId, id)); + } + + @Override + public void back(String id) { + Dictionary dictionary = new Dictionary(); + dictionary.setDelFlag(0); + dictionaryMapper.updateById(dictionary); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java index d5cbda43f..21d58493c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerAttendanceServiceImpl.java @@ -809,7 +809,7 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl s.equals(activeProfile)); + return Stream.of("ljw-prod", "ljw-dev").anyMatch(s -> s.equals(activeEnvironment)); } /** @@ -39,7 +39,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isSjjtGsxDev() { - return "sjjt-gsx".equals(activeProfile); + return "sjjt-dev".equals(activeEnvironment); } /** @@ -48,7 +48,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isSjjt() { - return Stream.of("sjjt-gsx", "sjjt-prod").anyMatch(s -> s.equals(activeProfile)); + return Stream.of("sjjt-dev", "sjjt-prod").anyMatch(s -> s.equals(activeEnvironment)); } /** @@ -57,7 +57,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isZjsjProd() { - return "zjsj".equals(activeProfile); + return "zjsj-prod".equals(activeEnvironment); } /** @@ -66,7 +66,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isZjsj() { - return Stream.of("zjsj-gsx", "zjsj").anyMatch(s -> s.equals(activeProfile)); + return Stream.of("zjsj-dev", "zjsj-prod").anyMatch(s -> s.equals(activeEnvironment)); } /** @@ -75,7 +75,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isShahu() { - return Stream.of("shahu-gsx", "shahu").anyMatch(s -> s.equals(activeProfile)); + return Stream.of("shahu-dev", "shahu-prod").anyMatch(s -> s.equals(activeEnvironment)); } /** @@ -84,7 +84,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isYlwwProd() { - return "ylww".equals(activeProfile); + return "ylww-prod".equals(activeEnvironment); } /** @@ -93,7 +93,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isGxltProd() { - return "gxlt".equals(activeProfile); + return "gxlt-prod".equals(activeEnvironment); } /** @@ -102,7 +102,7 @@ public class ProfileJudgeUtil { * @return */ public boolean isGxlt() { - return Stream.of("gxlt", "gxlt-gsx").anyMatch(s -> s.equals(activeProfile)); + return Stream.of("gxlt-prod", "gxlt-dev").anyMatch(s -> s.equals(activeEnvironment)); } } diff --git a/src/main/resources/application-dev-gsx.properties b/src/main/resources/application-gsx-dev.properties similarity index 98% rename from src/main/resources/application-dev-gsx.properties rename to src/main/resources/application-gsx-dev.properties index 31ea5e6d8..43a45e2d0 100644 --- a/src/main/resources/application-dev-gsx.properties +++ b/src/main/resources/application-gsx-dev.properties @@ -71,4 +71,5 @@ double-carbon.ammeter-data-url=http://test.cesms.net license.licensePath=C:/jxj/prod/backEnd/license/license.lic license.publicKeysStorePath=C:/jxj/prod/backEnd/license/publicCerts.keystore #\u9AD8\u652F\u6A21\u7684tcp\u670D\u52A1\u7AEF\u7684\u7AEF\u53E3\u53F7 -high_formwork.netty.port=15333 \ No newline at end of file +high_formwork.netty.port=15333 +active.environment.name=dev diff --git a/src/main/resources/application-gsx-other-env-show.properties b/src/main/resources/application-gsx-other-env-show.properties index 2053f9189..e0102b23d 100644 --- a/src/main/resources/application-gsx-other-env-show.properties +++ b/src/main/resources/application-gsx-other-env-show.properties @@ -94,4 +94,4 @@ sj.business.gateway.url=http://116.169.63.183:30867/ sj.business.gateway.api.key=nDmkHCxlQzCqE-xfYteXMw #\u4E09\u6C5F\u56FE\u7247\u8BBF\u95EE\u8DEF\u5F84\uFF08\u7528\u4E8E\u63A8\u9001\u4E1A\u52A1\u4E2D\u53F0\uFF09 sj.upload.image.url.prefix=http://192.168.34.221:11111/image/ - +active.environment.name=gsx-other-env-show-dev diff --git a/src/main/resources/application-ljw-gsx.properties b/src/main/resources/application-ljw-gsx-dev.properties similarity index 99% rename from src/main/resources/application-ljw-gsx.properties rename to src/main/resources/application-ljw-gsx-dev.properties index 1a498dca6..02089ec16 100644 --- a/src/main/resources/application-ljw-gsx.properties +++ b/src/main/resources/application-ljw-gsx-dev.properties @@ -84,3 +84,4 @@ spring.boot.admin.client.instance.name=zjsj # \u6C34\u7535\u6570\u636E\u63A8\u9001\u5730\u5740 double-carbon.water-data-url=http://test.cesms.net double-carbon.ammeter-data-url=http://test.cesms.net +active.environment.name=ljw-dev