自定义表头
This commit is contained in:
@@ -159,3 +159,19 @@ ALTER TABLE `laws_weilai`.`params_report_detail`
|
|||||||
|
|
||||||
-- 更新拆分详情列 展示顺序不在列表头展示sql 2022-12-30 已同步生产环境
|
-- 更新拆分详情列 展示顺序不在列表头展示sql 2022-12-30 已同步生产环境
|
||||||
UPDATE `laws_weilai`.`onl_cgform_field` SET `is_show_list` = 0 WHERE `id` = '1529373706885799937'
|
UPDATE `laws_weilai`.`onl_cgform_field` SET `is_show_list` = 0 WHERE `id` = '1529373706885799937'
|
||||||
|
|
||||||
|
-- 自定义表头 2023-01-05 未同步生产环境
|
||||||
|
CREATE TABLE `laws_weilai`.`head_custom` (
|
||||||
|
`id` varchar(36) NOT NULL COMMENT 'id',
|
||||||
|
`create_by` varchar(255) NULL COMMENT '创建人',
|
||||||
|
`create_time` datetime(0) NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(255) NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime(0) NULL COMMENT '修改时间',
|
||||||
|
`sys_org_code` varchar(255) NULL COMMENT '部门',
|
||||||
|
`head_field_cn` varchar(255) NULL COMMENT '表头字段中文',
|
||||||
|
`head_field_en` varchar(255) NULL COMMENT '表头字段英文',
|
||||||
|
`parent_id` varchar(36) NULL COMMENT '父id',
|
||||||
|
`module_flag` varchar(255) NULL COMMENT '模块标识',
|
||||||
|
`sort` varchar(255) NULL COMMENT '排序',
|
||||||
|
`field` varchar(255) NULL COMMENT '对应列表接口字段名',
|
||||||
|
PRIMARY KEY (`id`));
|
||||||
|
|||||||
+172
@@ -0,0 +1,172 @@
|
|||||||
|
package com.jero.modules.head.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
|
import com.jero.common.system.query.QueryGenerator;
|
||||||
|
import com.jero.modules.head.entity.HeadCustomEO;
|
||||||
|
import com.jero.modules.head.service.IHeadCustomEOService;
|
||||||
|
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.jero.modules.head.vo.HeadCustomVO;
|
||||||
|
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 io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 自定义表头
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-01-05
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags="自定义表头")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/head/headCustomEO")
|
||||||
|
@Slf4j
|
||||||
|
public class HeadCustomEOController extends JeroController<HeadCustomEO, IHeadCustomEOService> {
|
||||||
|
@Autowired
|
||||||
|
private IHeadCustomEOService headCustomEOService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param headCustomEO
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-分页列表查询")
|
||||||
|
@ApiOperation(value="自定义表头-分页列表查询", notes="自定义表头-分页列表查询")
|
||||||
|
@GetMapping(value = "/page")
|
||||||
|
public Result<?> queryPageList(HeadCustomEO headCustomEO,
|
||||||
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||||
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<HeadCustomEO> queryWrapper = QueryGenerator.initQueryWrapper(headCustomEO, req.getParameterMap());
|
||||||
|
Page<HeadCustomEO> page = new Page<HeadCustomEO>(pageNo, pageSize);
|
||||||
|
IPage<HeadCustomEO> pageList = headCustomEOService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表查询
|
||||||
|
* @param cut
|
||||||
|
* @param moduleFlag 模块标识
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-列表查询")
|
||||||
|
@ApiOperation(value="自定义表头-列表查询", notes="自定义表头-列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<List<HeadCustomVO>> queryList(String cut,String moduleFlag) {
|
||||||
|
List<HeadCustomVO> list = headCustomEOService.queryList(cut,moduleFlag);
|
||||||
|
return Result.OK(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param headCustomEOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-添加")
|
||||||
|
@ApiOperation(value="自定义表头-添加", notes="自定义表头-添加")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<?> add(@Validated @RequestBody List<HeadCustomEO> headCustomEOList) {
|
||||||
|
headCustomEOService.add(headCustomEOList);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param headCustomEO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-编辑")
|
||||||
|
@ApiOperation(value="自定义表头-编辑", notes="自定义表头-编辑")
|
||||||
|
@PutMapping(value = "/edit")
|
||||||
|
public Result<?> edit(@Validated @RequestBody HeadCustomEO headCustomEO) {
|
||||||
|
headCustomEOService.editById(headCustomEO);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-通过id删除")
|
||||||
|
@ApiOperation(value="自定义表头-通过id删除", notes="自定义表头-通过id删除")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||||
|
headCustomEOService.deleteById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-批量删除")
|
||||||
|
@ApiOperation(value="自定义表头-批量删除", notes="自定义表头-批量删除")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||||
|
this.headCustomEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "自定义表头-通过id查询")
|
||||||
|
@ApiOperation(value="自定义表头-通过id查询", notes="自定义表头-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||||
|
HeadCustomEO headCustomEO = headCustomEOService.queryById(id);
|
||||||
|
if(headCustomEO==null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(headCustomEO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param headCustomEO
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, HeadCustomEO headCustomEO) {
|
||||||
|
return super.exportXls(request, headCustomEO, HeadCustomEO.class, "自定义表头");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, HeadCustomEO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
package com.jero.modules.head.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.jero.modules.project.entity.ProjectLibraryBase;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import com.jero.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 自定义表头
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-01-05
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("head_custom")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="head_custom对象", description="自定义表头")
|
||||||
|
public class HeadCustomEO implements Comparable<HeadCustomEO> {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private java.lang.String id;
|
||||||
|
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private java.lang.String createBy;
|
||||||
|
|
||||||
|
/**创建日期*/
|
||||||
|
@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;
|
||||||
|
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private java.lang.String updateBy;
|
||||||
|
|
||||||
|
/**更新日期*/
|
||||||
|
@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;
|
||||||
|
|
||||||
|
/**所属部门*/
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private java.lang.String sysOrgCode;
|
||||||
|
|
||||||
|
/**表头字段中文*/
|
||||||
|
@Excel(name = "表头字段中文", width = 15)
|
||||||
|
@ApiModelProperty(value = "表头字段中文")
|
||||||
|
private java.lang.String headFieldCn;
|
||||||
|
|
||||||
|
/**表头字段英文*/
|
||||||
|
@Excel(name = "表头字段英文", width = 15)
|
||||||
|
@ApiModelProperty(value = "表头字段英文")
|
||||||
|
private java.lang.String headFieldEn;
|
||||||
|
|
||||||
|
/**对应列表接口字段名*/
|
||||||
|
@Excel(name = "对应列表接口字段名", width = 15)
|
||||||
|
@ApiModelProperty(value = "对应列表接口字段名")
|
||||||
|
private java.lang.String field;
|
||||||
|
|
||||||
|
/**父id*/
|
||||||
|
@Excel(name = "父id", width = 15)
|
||||||
|
@ApiModelProperty(value = "父id")
|
||||||
|
private java.lang.String parentId;
|
||||||
|
|
||||||
|
/**模块标识*/
|
||||||
|
@Excel(name = "模块标识", width = 15)
|
||||||
|
@ApiModelProperty(value = "模块标识")
|
||||||
|
private java.lang.String moduleFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ApiModelProperty(value = "二级标题")
|
||||||
|
private List<HeadCustomEO> children;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标题顺序")
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(HeadCustomEO o) {
|
||||||
|
return Integer.valueOf(this.getSort())-Integer.valueOf(o.getSort());//升序
|
||||||
|
// return o.id-this.id;//降序
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.jero.modules.head.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.jero.modules.head.entity.HeadCustomEO;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 自定义表头
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-01-05
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface HeadCustomEOMapper extends BaseMapper<HeadCustomEO> {
|
||||||
|
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
<?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.jero.modules.head.mapper.HeadCustomEOMapper">
|
||||||
|
<resultMap id="HeadCustomEOResultMap" type="com.jero.modules.head.entity.HeadCustomEO">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="create_by" property="createBy" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="update_by" property="updateBy" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
<result column="sys_org_code" property="sysOrgCode" />
|
||||||
|
<result column="head_field_cn" property="headFieldCn" />
|
||||||
|
<result column="head_field_en" property="headFieldEn" />
|
||||||
|
<result column="parent_id" property="parentId" />
|
||||||
|
<result column="module_flag" property="moduleFlag" />
|
||||||
|
<result column="sort" property="sort" />
|
||||||
|
<result column="field" property="field" />
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package com.jero.modules.head.service;
|
||||||
|
|
||||||
|
import com.jero.modules.head.entity.HeadCustomEO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jero.modules.head.vo.HeadCustomVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 自定义表头
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-01-05
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IHeadCustomEOService extends IService<HeadCustomEO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*
|
||||||
|
* @param headCustomEOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void add(List<HeadCustomEO> headCustomEOList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param headCustomEO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void editById(HeadCustomEO headCustomEO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void deleteById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void deleteByIds(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
HeadCustomEO queryById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表查询
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<HeadCustomVO> queryList(String cut, String moduleFlag);
|
||||||
|
}
|
||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
package com.jero.modules.head.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.jero.common.constant.enums.CutEnum;
|
||||||
|
import com.jero.common.system.vo.LoginUser;
|
||||||
|
import com.jero.modules.head.entity.HeadCustomEO;
|
||||||
|
import com.jero.modules.head.mapper.HeadCustomEOMapper;
|
||||||
|
import com.jero.modules.head.service.IHeadCustomEOService;
|
||||||
|
import com.jero.modules.head.vo.HeadCustomVO;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 自定义表头
|
||||||
|
* @Author: jero-boot
|
||||||
|
* @Date: 2023-01-05
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, HeadCustomEO> implements IHeadCustomEOService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*
|
||||||
|
* @param headCustomEOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(List<HeadCustomEO> headCustomEOList) {
|
||||||
|
if(ObjectUtils.isNotEmpty(headCustomEOList)){
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
//先删除再新增
|
||||||
|
LambdaQueryWrapper<HeadCustomEO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(HeadCustomEO::getCreateBy,loginUser.getUsername()).in(HeadCustomEO::getModuleFlag,headCustomEOList.get(0).getModuleFlag());
|
||||||
|
this.remove(wrapper);
|
||||||
|
|
||||||
|
List<HeadCustomEO> headCustomEOS = new ArrayList<>();
|
||||||
|
for (HeadCustomEO headCustomEO : headCustomEOList) {
|
||||||
|
//一级标题
|
||||||
|
String id = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
HeadCustomEO headCustomEOTemp = getHeadCustomEO(loginUser, headCustomEO, id);
|
||||||
|
headCustomEOS.add(headCustomEOTemp);
|
||||||
|
//二级标题
|
||||||
|
if(ObjectUtils.isNotEmpty(headCustomEO.getChildren())){
|
||||||
|
for (HeadCustomEO child : headCustomEO.getChildren()) {
|
||||||
|
String idTemp = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
HeadCustomEO customEO = getHeadCustomEO(loginUser, child, idTemp);
|
||||||
|
customEO.setParentId(id);
|
||||||
|
headCustomEOS.add(customEO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(headCustomEOS)){
|
||||||
|
this.saveBatch(headCustomEOS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private HeadCustomEO getHeadCustomEO(LoginUser loginUser, HeadCustomEO headCustomEO, String id) {
|
||||||
|
HeadCustomEO headCustomEOTemp = new HeadCustomEO();
|
||||||
|
headCustomEOTemp.setId(id);
|
||||||
|
headCustomEOTemp.setHeadFieldCn(headCustomEO.getHeadFieldCn());
|
||||||
|
headCustomEOTemp.setHeadFieldEn(headCustomEO.getHeadFieldEn());
|
||||||
|
headCustomEOTemp.setModuleFlag(headCustomEO.getModuleFlag());
|
||||||
|
headCustomEOTemp.setField(headCustomEO.getField());
|
||||||
|
headCustomEOTemp.setSort(headCustomEO.getSort());
|
||||||
|
headCustomEOTemp.setCreateBy(loginUser.getUsername());
|
||||||
|
headCustomEOTemp.setCreateTime(new Date());
|
||||||
|
headCustomEOTemp.setUpdateTime(new Date());
|
||||||
|
return headCustomEOTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param headCustomEO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void editById(HeadCustomEO headCustomEO) {
|
||||||
|
Date now = new Date();
|
||||||
|
headCustomEO.setUpdateTime(now);
|
||||||
|
saveOrUpdate(headCustomEO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteById(String id) {
|
||||||
|
removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteByIds(List<String> ids) {
|
||||||
|
removeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HeadCustomEO queryById(String id) {
|
||||||
|
return getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表查询
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HeadCustomVO> queryList(String cut,String moduleFlag) {
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
LambdaQueryWrapper<HeadCustomEO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(HeadCustomEO::getCreateBy,loginUser.getUsername()).in(HeadCustomEO::getModuleFlag,moduleFlag);
|
||||||
|
List<HeadCustomEO> list = this.list(wrapper);
|
||||||
|
List<HeadCustomVO> headCustomVOOneList = new LinkedList<>();
|
||||||
|
if(ObjectUtils.isNotEmpty(list)){
|
||||||
|
//列表表头一级
|
||||||
|
List<HeadCustomEO> oneList = list.stream()
|
||||||
|
.filter(e -> StringUtils.isBlank(e.getParentId())).collect(Collectors.toList());
|
||||||
|
//列表表头二级
|
||||||
|
List<HeadCustomEO> twoList = list.stream()
|
||||||
|
.filter(e -> StringUtils.isNotBlank(e.getParentId())).collect(Collectors.toList());
|
||||||
|
Collections.sort(oneList);
|
||||||
|
for (HeadCustomEO headCustomEO : oneList) {
|
||||||
|
HeadCustomVO headCustomVO = new HeadCustomVO();
|
||||||
|
if(ObjectUtils.isNotEmpty(twoList)){
|
||||||
|
List<HeadCustomEO> two = twoList.stream()
|
||||||
|
.filter(e -> headCustomEO.getId().equals(e.getParentId())).collect(Collectors.toList());
|
||||||
|
Collections.sort(two);
|
||||||
|
List<HeadCustomVO> headCustomVOTwoList = new LinkedList<>();
|
||||||
|
for (HeadCustomEO customEO : two) {
|
||||||
|
HeadCustomVO headCustomVOTemp = new HeadCustomVO();
|
||||||
|
getHeadCustomVO(cut, customEO, headCustomVOTemp);
|
||||||
|
headCustomVOTwoList.add(headCustomVOTemp);
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(headCustomVOTwoList)){
|
||||||
|
headCustomVO.setHeadCustomVOList(headCustomVOTwoList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getHeadCustomVO(cut, headCustomEO,headCustomVO);
|
||||||
|
headCustomVOOneList.add(headCustomVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return headCustomVOOneList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private HeadCustomVO getHeadCustomVO(String cut, HeadCustomEO headCustomEO,HeadCustomVO headCustomVO) {
|
||||||
|
headCustomVO.setDataIndex(headCustomEO.getField());
|
||||||
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
|
headCustomVO.setTitle(headCustomEO.getHeadFieldCn());
|
||||||
|
}else{
|
||||||
|
headCustomVO.setTitle(headCustomEO.getHeadFieldEn());
|
||||||
|
}
|
||||||
|
return headCustomVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.jero.modules.head.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description
|
||||||
|
* @date 2023/1/6 9:48
|
||||||
|
* @auth zhn
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HeadCustomVO {
|
||||||
|
private String title;//表头字段
|
||||||
|
|
||||||
|
private String dataIndex;//对应列表字段
|
||||||
|
|
||||||
|
private List<HeadCustomVO> headCustomVOList;//二级表头
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user