报告模板配置

This commit is contained in:
hanyong
2022-10-10 10:23:34 +08:00
parent f4934b9853
commit b56b2ca525
7 changed files with 20 additions and 20 deletions

View File

@@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
public class DictDTO implements Serializable { public class EventReportDictDTO implements Serializable {
@ApiModelProperty("组件Id") @ApiModelProperty("组件Id")
private String id; private String id;
@@ -28,5 +28,5 @@ public class DictDTO implements Serializable {
private Integer sort; private Integer sort;
@ApiModelProperty("子级") @ApiModelProperty("子级")
List<DictDTO> children; List<EventReportDictDTO> children;
} }

View File

@@ -7,7 +7,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
@Data @Data
public class DictVO implements Serializable { public class EventReportDictVO implements Serializable {
@ApiModelProperty("Id") @ApiModelProperty("Id")
private String id; private String id;
@@ -28,6 +28,6 @@ public class DictVO implements Serializable {
private Integer sort; private Integer sort;
@ApiModelProperty("子级") @ApiModelProperty("子级")
List<DictVO> children; List<EventReportDictVO> children;
} }

View File

@@ -10,7 +10,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.system.pojo.param.EventDictParam; import com.njcn.system.pojo.param.EventDictParam;
import com.njcn.system.pojo.po.ReportDict; import com.njcn.system.pojo.po.ReportDict;
import com.njcn.system.pojo.vo.DictVO; import com.njcn.system.pojo.vo.EventReportDictVO;
import com.njcn.system.service.IEventDictService; import com.njcn.system.service.IEventDictService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -133,9 +133,9 @@ public class EventDictController extends BaseController {
@OperateInfo @OperateInfo
@GetMapping("/DictTree") @GetMapping("/DictTree")
@ApiOperation("字典树") @ApiOperation("字典树")
public HttpResult<List<DictVO>> getDictTree(){ public HttpResult<List<EventReportDictVO>> getDictTree(){
String methodDescribe = getMethodDescribe("getDictTree"); String methodDescribe = getMethodDescribe("getDictTree");
List<DictVO> list = iEventDictService.getDictTree(); List<EventReportDictVO> list = iEventDictService.getDictTree();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
} }
} }

View File

@@ -1,12 +1,12 @@
package com.njcn.system.mapper; package com.njcn.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.system.pojo.dto.DictDTO; import com.njcn.system.pojo.dto.EventReportDictDTO;
import com.njcn.system.pojo.po.ReportDict; import com.njcn.system.pojo.po.ReportDict;
import java.util.List; import java.util.List;
public interface EventDictMapper extends BaseMapper<ReportDict> { public interface EventDictMapper extends BaseMapper<ReportDict> {
List<DictDTO> getAllDict(); List<EventReportDictDTO> getAllDict();
} }

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.system.mapper.EventDictMapper"> <mapper namespace="com.njcn.system.mapper.EventDictMapper">
<select id="getAllDict" resultType="DictDTO"> <select id="getAllDict" resultType="EventReportDictDTO">
SELECT * from report_dict WHERE State = 1 SELECT * from report_dict WHERE State = 1
</select> </select>
</mapper> </mapper>

View File

@@ -3,7 +3,7 @@ package com.njcn.system.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.system.pojo.param.EventDictParam; import com.njcn.system.pojo.param.EventDictParam;
import com.njcn.system.pojo.po.ReportDict; import com.njcn.system.pojo.po.ReportDict;
import com.njcn.system.pojo.vo.DictVO; import com.njcn.system.pojo.vo.EventReportDictVO;
import java.util.List; import java.util.List;
@@ -51,5 +51,5 @@ public interface IEventDictService {
* 获取字典树 * 获取字典树
* @return * @return
*/ */
List<DictVO> getDictTree(); List<EventReportDictVO> getDictTree();
} }

View File

@@ -14,10 +14,10 @@ import com.njcn.db.constant.DbConstant;
import com.njcn.system.enums.EventResponseEnum; import com.njcn.system.enums.EventResponseEnum;
import com.njcn.system.enums.TemplateTreeEnum; import com.njcn.system.enums.TemplateTreeEnum;
import com.njcn.system.mapper.EventDictMapper; import com.njcn.system.mapper.EventDictMapper;
import com.njcn.system.pojo.dto.DictDTO; import com.njcn.system.pojo.dto.EventReportDictDTO;
import com.njcn.system.pojo.param.EventDictParam; import com.njcn.system.pojo.param.EventDictParam;
import com.njcn.system.pojo.po.ReportDict; import com.njcn.system.pojo.po.ReportDict;
import com.njcn.system.pojo.vo.DictVO; import com.njcn.system.pojo.vo.EventReportDictVO;
import com.njcn.system.service.IEventDictService; import com.njcn.system.service.IEventDictService;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -25,7 +25,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -74,6 +73,7 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
checkName(dictUpdateParam,true); checkName(dictUpdateParam,true);
ReportDict rptDict = new ReportDict(); ReportDict rptDict = new ReportDict();
BeanUtils.copyProperties(dictUpdateParam,rptDict); BeanUtils.copyProperties(dictUpdateParam,rptDict);
rptDict.setPid(rptDict.getPids());
return this.updateById(rptDict); return this.updateById(rptDict);
} }
@@ -139,11 +139,11 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
* @return * @return
*/ */
@Override @Override
public List<DictVO> getDictTree() { public List<EventReportDictVO> getDictTree() {
List<DictVO> list = new ArrayList<>(); List<EventReportDictVO> list = new ArrayList<>();
List<DictDTO> dictList = eventDictMapper.getAllDict(); List<EventReportDictDTO> dictList = eventDictMapper.getAllDict();
dictList.forEach(item -> { dictList.forEach(item -> {
DictVO dictVO = new DictVO(); EventReportDictVO dictVO = new EventReportDictVO();
BeanUtil.copyProperties(item, dictVO); BeanUtil.copyProperties(item, dictVO);
list.add(dictVO); list.add(dictVO);
}); });
@@ -156,7 +156,7 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
/** /**
* 递归组装字典表 * 递归组装字典表
*/ */
private List<DictVO> getChildList(DictVO dictMenu, List<DictVO> categories) { private List<EventReportDictVO> getChildList(EventReportDictVO dictMenu, List<EventReportDictVO> categories) {
return categories.stream().filter(o -> Objects.equals(o.getPid(), dictMenu.getId())) return categories.stream().filter(o -> Objects.equals(o.getPid(), dictMenu.getId()))
.peek(o -> o.setChildren(getChildList(o, categories))) .peek(o -> o.setChildren(getChildList(o, categories)))
.collect(Collectors.toList()); .collect(Collectors.toList());