章节目录
This commit is contained in:
+28
-25
@@ -1,25 +1,30 @@
|
||||
package com.jero.modules.report.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportTitleTemplateEO;
|
||||
import com.jero.modules.report.service.ILawsMonthlyReportTitleTemplateEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.jero.modules.report.vo.LawsMonthlyReportTitleTemplateVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,23 +57,21 @@ public class LawsMonthlyReportTitleTemplateEOController extends JeroController<L
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<LawsMonthlyReportTitleTemplateEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsMonthlyReportTitleTemplateEO, req.getParameterMap());
|
||||
// Page<LawsMonthlyReportTitleTemplateEO> page = new Page<LawsMonthlyReportTitleTemplateEO>(pageNo, pageSize);
|
||||
// IPage<LawsMonthlyReportTitleTemplateEO> pageList = lawsMonthlyReportTitleTemplateEOService.page(page, queryWrapper);
|
||||
IPage<LawsMonthlyReportTitleTemplateEO> pageList = lawsMonthlyReportTitleTemplateEOService.getPageInfo(pageNo,pageSize, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
List<LawsMonthlyReportTitleTemplateEO> pageList = lawsMonthlyReportTitleTemplateEOService.getPageInfo(lawsMonthlyReportTitleTemplateEO, req);
|
||||
Page pages = lawsMonthlyReportTitleTemplateEOService.getPages(pageNo, pageSize, pageList);
|
||||
return Result.OK(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* 章节目录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "月报标题模板-列表查询")
|
||||
@ApiOperation(value="月报标题模板-列表查询", notes="月报标题模板-列表查询")
|
||||
@AutoLog(value = "章节目录")
|
||||
@ApiOperation(value="章节目录", notes="章节目录")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<LawsMonthlyReportTitleTemplateEO>> queryList() {
|
||||
List<LawsMonthlyReportTitleTemplateEO> list = lawsMonthlyReportTitleTemplateEOService.queryList();
|
||||
public Result<List<LawsMonthlyReportTitleTemplateVO>> queryList(String cut) {
|
||||
List<LawsMonthlyReportTitleTemplateVO> list = lawsMonthlyReportTitleTemplateEOService.queryList(cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -81,5 +81,4 @@ public class LawsMonthlyReportTitleTemplateEO implements Serializable {
|
||||
|
||||
//排序
|
||||
private int sort;
|
||||
|
||||
}
|
||||
|
||||
+9
-7
@@ -1,10 +1,11 @@
|
||||
package com.jero.modules.report.service;
|
||||
|
||||
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.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportTitleTemplateEO;
|
||||
import com.jero.modules.report.vo.LawsMonthlyReportTitleTemplateVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -60,16 +61,15 @@ public interface ILawsMonthlyReportTitleTemplateEOService extends IService<LawsM
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<LawsMonthlyReportTitleTemplateEO> queryList();
|
||||
List<LawsMonthlyReportTitleTemplateVO> queryList(String cut);
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param queryWrapper
|
||||
* @param lawsMonthlyReportTitleTemplateEO
|
||||
* @return
|
||||
*/
|
||||
IPage<LawsMonthlyReportTitleTemplateEO> getPageInfo(Integer pageNo,Integer pageSize, QueryWrapper<LawsMonthlyReportTitleTemplateEO> queryWrapper);
|
||||
List<LawsMonthlyReportTitleTemplateEO> getPageInfo(LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO,
|
||||
HttpServletRequest req);
|
||||
|
||||
/**
|
||||
* 一级菜单
|
||||
@@ -81,4 +81,6 @@ public interface ILawsMonthlyReportTitleTemplateEOService extends IService<LawsM
|
||||
* @param lawsMonthlyReportTitleTemplateEOS
|
||||
*/
|
||||
void move(List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS);
|
||||
|
||||
Page getPages(Integer currentPage, Integer pageSize, List<LawsMonthlyReportTitleTemplateEO> list);
|
||||
}
|
||||
|
||||
+58
-7
@@ -2,15 +2,18 @@ package com.jero.modules.report.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportTitleTemplateEO;
|
||||
import com.jero.modules.report.mapper.LawsMonthlyReportTitleTemplateEOMapper;
|
||||
import com.jero.modules.report.service.ILawsMonthlyReportTitleTemplateEOService;
|
||||
import com.jero.modules.report.vo.LawsMonthlyReportTitleTemplateVO;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -115,13 +118,62 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<LawsMonthlyReportTitleTemplateEO> queryList() {
|
||||
return list();
|
||||
public List<LawsMonthlyReportTitleTemplateVO> queryList(String cut) {
|
||||
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS = this.list();
|
||||
//数据结构重组
|
||||
List<LawsMonthlyReportTitleTemplateVO> lawsMonthlyReportTitleTemplateVOS = new ArrayList<>();
|
||||
for (LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO : lawsMonthlyReportTitleTemplateEOS) {
|
||||
LawsMonthlyReportTitleTemplateVO lawsMonthlyReportTitleTemplateVO = new LawsMonthlyReportTitleTemplateVO();
|
||||
lawsMonthlyReportTitleTemplateVO.setId(lawsMonthlyReportTitleTemplateEO.getId());
|
||||
lawsMonthlyReportTitleTemplateVO.setKey(lawsMonthlyReportTitleTemplateEO.getId());
|
||||
lawsMonthlyReportTitleTemplateVO.setValue(lawsMonthlyReportTitleTemplateEO.getId());
|
||||
lawsMonthlyReportTitleTemplateVO.setParentId(lawsMonthlyReportTitleTemplateEO.getParentId());
|
||||
lawsMonthlyReportTitleTemplateVO.setSort(lawsMonthlyReportTitleTemplateEO.getSort());
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
lawsMonthlyReportTitleTemplateVO.setTitle(lawsMonthlyReportTitleTemplateEO.getTitleCn());
|
||||
}else{
|
||||
lawsMonthlyReportTitleTemplateVO.setTitle(lawsMonthlyReportTitleTemplateEO.getTitleEn());
|
||||
}
|
||||
lawsMonthlyReportTitleTemplateVOS.add(lawsMonthlyReportTitleTemplateVO);
|
||||
}
|
||||
|
||||
List<LawsMonthlyReportTitleTemplateVO> parentList = lawsMonthlyReportTitleTemplateVOS.stream()
|
||||
.filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList());
|
||||
Collections.sort(parentList, new Comparator<LawsMonthlyReportTitleTemplateVO>() {
|
||||
@Override
|
||||
public int compare(LawsMonthlyReportTitleTemplateVO p1, LawsMonthlyReportTitleTemplateVO p2) {
|
||||
return String.valueOf(p1.getSort()).compareTo(String.valueOf(p2.getSort()));
|
||||
}
|
||||
});
|
||||
|
||||
for (LawsMonthlyReportTitleTemplateVO lawsMonthlyReportTitleTemplateVO : parentList) {
|
||||
List<LawsMonthlyReportTitleTemplateVO> children = lawsMonthlyReportTitleTemplateVOS.stream()
|
||||
.filter(e -> lawsMonthlyReportTitleTemplateVO.getId().equals(e.getParentId())).collect(Collectors.toList());
|
||||
if(children.size() != 0){
|
||||
Collections.sort(children, new Comparator<LawsMonthlyReportTitleTemplateVO>() {
|
||||
@Override
|
||||
public int compare(LawsMonthlyReportTitleTemplateVO p1, LawsMonthlyReportTitleTemplateVO p2) {
|
||||
return String.valueOf(p1.getSort()).compareTo(String.valueOf(p2.getSort()));
|
||||
}
|
||||
});
|
||||
for (LawsMonthlyReportTitleTemplateVO child : children) {
|
||||
if(child.getChildren().size() == 0){
|
||||
child.setChildren(null);
|
||||
}
|
||||
}
|
||||
lawsMonthlyReportTitleTemplateVO.setChildren(children);
|
||||
}
|
||||
else{
|
||||
lawsMonthlyReportTitleTemplateVO.setChildren(null);
|
||||
}
|
||||
}
|
||||
return parentList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<LawsMonthlyReportTitleTemplateEO> getPageInfo( Integer pageNo,Integer pageSize,QueryWrapper<LawsMonthlyReportTitleTemplateEO> queryWrapper) {
|
||||
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS = this.list();
|
||||
public List<LawsMonthlyReportTitleTemplateEO> getPageInfo(LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEOTemp, HttpServletRequest req) {
|
||||
QueryWrapper<LawsMonthlyReportTitleTemplateEO> queryWrapper = QueryGenerator.initQueryWrapper(lawsMonthlyReportTitleTemplateEOTemp, req.getParameterMap());
|
||||
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS = this.list(queryWrapper);
|
||||
List<LawsMonthlyReportTitleTemplateEO> parentList = lawsMonthlyReportTitleTemplateEOS.stream()
|
||||
.filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList());
|
||||
Collections.sort(parentList, new Comparator<LawsMonthlyReportTitleTemplateEO>() {
|
||||
@@ -152,8 +204,7 @@ public class LawsMonthlyReportTitleTemplateEOServiceImpl extends ServiceImpl<Law
|
||||
lawsMonthlyReportTitleTemplateEO.setChildren(null);
|
||||
}
|
||||
}
|
||||
Page pages = getPages(pageNo, pageSize, parentList);
|
||||
return pages;
|
||||
return parentList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.jero.modules.report.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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 lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 月报标题模板
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-06-29
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class LawsMonthlyReportTitleTemplateVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "父id")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
private List<LawsMonthlyReportTitleTemplateVO> children = new ArrayList<>();
|
||||
|
||||
private int sort;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user