feat: 外标企标排序字段
This commit is contained in:
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.jero.modules.laws.enterprise.entity.vo;
|
package com.jero.modules.laws.enterprise.entity.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.jero.common.system.vo.SysDepartTreeModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@@ -76,7 +75,7 @@ public class LawsTreeNodeModel {
|
|||||||
private java.lang.Integer nodeType;
|
private java.lang.Integer nodeType;
|
||||||
/**排序*/
|
/**排序*/
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private java.lang.Integer nodeOrder;
|
private java.lang.Double nodeOrder;
|
||||||
|
|
||||||
private List<LawsTreeNodeModel> children = new ArrayList<>();
|
private List<LawsTreeNodeModel> children = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
+7
@@ -167,4 +167,11 @@ public class LawsTreeNodeController extends JeroController<LawsTreeNode, ILawsTr
|
|||||||
return this.commonDelete(map, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
|
return this.commonDelete(map, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "序号修复")
|
||||||
|
@ApiOperation(value = "序号修复", notes = "序号修复")
|
||||||
|
@GetMapping(value = "/orderFix")
|
||||||
|
public Result<T> orderFix() {
|
||||||
|
lawsTreeNodeService.orderFix();
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,20 @@
|
|||||||
package com.jero.modules.laws.standard.entity;
|
package com.jero.modules.laws.standard.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
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.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +78,7 @@ public class LawsTreeNode implements Serializable {
|
|||||||
private java.lang.Integer nodeType;
|
private java.lang.Integer nodeType;
|
||||||
/**排序*/
|
/**排序*/
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private java.lang.Integer nodeOrder;
|
private java.lang.Double nodeOrder;
|
||||||
|
|
||||||
public LawsTreeNode(String id, String parentId, String name) {
|
public LawsTreeNode(String id, String parentId, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
+2
@@ -42,4 +42,6 @@ public interface ILawsTreeNodeService extends IService<LawsTreeNode> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean delete(String id, String nodeCode);
|
boolean delete(String id, String nodeCode);
|
||||||
|
|
||||||
|
void orderFix();
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -112,7 +112,7 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 对当前层级的节点按 nodeOrder 排序,将 null 视为 0
|
// 对当前层级的节点按 nodeOrder 排序,将 null 视为 0
|
||||||
nodes.sort(Comparator.comparingInt(node ->
|
nodes.sort(Comparator.comparingDouble(node ->
|
||||||
node.getNodeOrder() != null ? node.getNodeOrder() : 0));
|
node.getNodeOrder() != null ? node.getNodeOrder() : 0));
|
||||||
|
|
||||||
// 递归对每个节点的子节点进行排序
|
// 递归对每个节点的子节点进行排序
|
||||||
@@ -246,6 +246,18 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void orderFix() {
|
||||||
|
// 找到所有数据,将order字段设置为nodeCode的最后一位数字
|
||||||
|
List<LawsTreeNode> list = this.list();
|
||||||
|
for (LawsTreeNode node : list) {
|
||||||
|
String nodeCode = node.getNodeCode();
|
||||||
|
String order = nodeCode.substring(nodeCode.length() - 1);
|
||||||
|
node.setNodeOrder(Double.valueOf(order));
|
||||||
|
this.updateById(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* delete 方法调用
|
* delete 方法调用
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user