报告模版配置联调
This commit is contained in:
@@ -112,6 +112,22 @@ public class EventDictController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询字典列表_新
|
||||
* @param dictQueryParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getReportDictList")
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("查询字典列表_新")
|
||||
@ApiImplicitParam(name = "dictQueryParam", value = "查询字典列表实体", required = true)
|
||||
public HttpResult<List<EventReportDictVO>> getReportDictList(@RequestBody EventDictParam.DictQueryParam dictQueryParam){
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
List<EventReportDictVO> res = iEventDictService.getReportDictList(dictQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -137,11 +153,11 @@ public class EventDictController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo
|
||||
@GetMapping("/DictTree")
|
||||
@PostMapping("/DictTree")
|
||||
@ApiOperation("字典树")
|
||||
public HttpResult<List<EventReportDictVO>> getDictTree(){
|
||||
public HttpResult<List<EventReportDictVO>> getDictTree(@RequestParam @Validated String type){
|
||||
String methodDescribe = getMethodDescribe("getDictTree");
|
||||
List<EventReportDictVO> list = iEventDictService.getDictTree();
|
||||
List<EventReportDictVO> list = iEventDictService.getDictTree(type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package com.njcn.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.system.pojo.dto.EventReportDictDTO;
|
||||
import com.njcn.system.pojo.po.ReportDict;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EventDictMapper extends BaseMapper<ReportDict> {
|
||||
|
||||
List<EventReportDictDTO> getAllDict();
|
||||
List<EventReportDictDTO> getAllDict(@Param("type") String type);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<mapper namespace="com.njcn.system.mapper.EventDictMapper">
|
||||
|
||||
<select id="getAllDict" resultType="EventReportDictDTO">
|
||||
SELECT * from report_dict WHERE State = 1
|
||||
SELECT * from report_dict WHERE State = 1 AND Type = #{type}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -40,6 +40,8 @@ public interface IEventDictService {
|
||||
*/
|
||||
Page<ReportDict> getList(EventDictParam.DictQueryParam dictQueryParam);
|
||||
|
||||
List<EventReportDictVO> getReportDictList (EventDictParam.DictQueryParam dictQueryParam);
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -50,6 +52,7 @@ public interface IEventDictService {
|
||||
/**
|
||||
* 获取字典树
|
||||
* @return
|
||||
* @param type
|
||||
*/
|
||||
List<EventReportDictVO> getDictTree();
|
||||
List<EventReportDictVO> getDictTree(String type);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -101,7 +102,7 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<ReportDict> getList(EventDictParam.DictQueryParam dictQueryParam){
|
||||
public Page<ReportDict> getList (EventDictParam.DictQueryParam dictQueryParam) {
|
||||
QueryWrapper<ReportDict> queryWrapper = new QueryWrapper<>();
|
||||
if (Objects.nonNull(dictQueryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
@@ -124,6 +125,51 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
||||
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(dictQueryParam),PageFactory.getPageSize(dictQueryParam)),queryWrapper);
|
||||
}
|
||||
|
||||
public List<EventReportDictVO> getReportDictList (EventDictParam.DictQueryParam dictQueryParam) {
|
||||
QueryWrapper<ReportDict> queryWrapper = new QueryWrapper<>();
|
||||
if (Objects.nonNull(dictQueryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(dictQueryParam.getSearchValue())) {
|
||||
//字典类型表,提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("report_dict.name",dictQueryParam.getSearchValue())
|
||||
.or().like("report_dict.report_describe",dictQueryParam.getSearchValue()));
|
||||
}
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(dictQueryParam.getSortBy(), dictQueryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, dictQueryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(dictQueryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "report_dict.update_time");
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("report_dict.state", DataStateEnum.ENABLE.getCode());
|
||||
List<ReportDict> reportAllDicts = this.baseMapper.selectList(queryWrapper);
|
||||
List<ReportDict> reportDicts = new ArrayList<>();
|
||||
reportAllDicts.stream().filter(reportDict -> reportDict.getId().equals(dictQueryParam.getId())).forEach(reportDict -> {
|
||||
reportDicts.add(reportDict);
|
||||
getChild(reportDicts, reportDict, reportAllDicts);
|
||||
});
|
||||
Map<String, String> map = reportAllDicts.stream().collect(Collectors.toMap(ReportDict::getId, ReportDict::getName));
|
||||
List<EventReportDictVO> list = new ArrayList<>();
|
||||
reportDicts.forEach(dict -> {
|
||||
EventReportDictVO dictVO = new EventReportDictVO();
|
||||
BeanUtil.copyProperties(dict, dictVO);
|
||||
dictVO.setPidName(map.get(dict.getPid()));
|
||||
list.add(dictVO);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private void getChild(List<ReportDict> reportDicts, ReportDict reportDict, List<ReportDict> reportAllDicts) {
|
||||
for (ReportDict dict : reportAllDicts) {
|
||||
if (dict.getPid().equals(reportDict.getId())) {
|
||||
reportDicts.add(dict);
|
||||
getChild(reportDicts,dict,reportAllDicts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典
|
||||
* @param id
|
||||
@@ -137,11 +183,12 @@ public class EventDictServiceImpl extends ServiceImpl<EventDictMapper, ReportDic
|
||||
/**
|
||||
* 获取字典树
|
||||
* @return
|
||||
* @param type
|
||||
*/
|
||||
@Override
|
||||
public List<EventReportDictVO> getDictTree() {
|
||||
public List<EventReportDictVO> getDictTree(String type) {
|
||||
List<EventReportDictVO> list = new ArrayList<>();
|
||||
List<EventReportDictDTO> dictList = eventDictMapper.getAllDict();
|
||||
List<EventReportDictDTO> dictList = eventDictMapper.getAllDict(type);
|
||||
dictList.forEach(item -> {
|
||||
EventReportDictVO dictVO = new EventReportDictVO();
|
||||
BeanUtil.copyProperties(item, dictVO);
|
||||
|
||||
Reference in New Issue
Block a user