editors;//记录可编辑者
+
+
+ //----------------------norm标准属性-----------------------
+ @Column(length = 126)
+ protected String name;//名称
+
+ protected Boolean avtag=true;//可用标记 1启用,0禁用
+
+ @ManyToOne
+ @JoinColumn(name = "crman", updatable = false)
+ protected SysOrg crman;//创建人
+
+ @Column(updatable = false)
+ protected Date crtim = new Date();//创建时间
+
+ @ManyToOne
+ @JoinColumn(name = "upman")
+ protected SysOrg upman;//更新人
+
+ protected Date uptim;//更新时间
+
+
+
+
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadConfigurationException.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadConfigurationException.java
new file mode 100644
index 0000000..fd96a60
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadConfigurationException.java
@@ -0,0 +1,77 @@
+package com.zsvg.vboot.common.mvc.exception;
+
+public class BadConfigurationException extends RuntimeException {
+ /**
+ * Constructs a new runtime exception with {@code null} as its
+ * detail message. The cause is not initialized, and may subsequently be
+ * initialized by a call to {@link #initCause}.
+ */
+ public BadConfigurationException() {
+ super();
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public BadConfigurationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this runtime exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BadConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified cause and a
+ * detail message of {@code (cause==null ? null : cause.toString())}
+ * (which typically contains the class and detail message of
+ * {@code cause}). This constructor is useful for runtime exceptions
+ * that are little more than wrappers for other throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public BadConfigurationException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail
+ * message, cause, suppression enabled or disabled, and writable
+ * stack trace enabled or disabled.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled
+ * or disabled
+ * @param writableStackTrace whether or not the stack trace should
+ * be writable
+ * @since 1.7
+ */
+ protected BadConfigurationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadRequestException.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadRequestException.java
new file mode 100644
index 0000000..f607426
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/BadRequestException.java
@@ -0,0 +1,21 @@
+package com.zsvg.vboot.common.mvc.exception;
+
+import lombok.Getter;
+import org.springframework.http.HttpStatus;
+
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
+
+@Getter
+public class BadRequestException extends RuntimeException{
+
+ private Integer status = BAD_REQUEST.value();
+
+ public BadRequestException(String msg){
+ super(msg);
+ }
+
+ public BadRequestException(HttpStatus status, String msg){
+ super(msg);
+ this.status = status.value();
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityExistException.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityExistException.java
new file mode 100644
index 0000000..8fe28b9
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityExistException.java
@@ -0,0 +1,15 @@
+package com.zsvg.vboot.common.mvc.exception;
+
+import org.springframework.util.StringUtils;
+
+public class EntityExistException extends RuntimeException {
+
+ public EntityExistException(Class clazz, String field, String val) {
+ super(EntityExistException.generateMessage(clazz.getSimpleName(), field, val));
+ }
+
+ private static String generateMessage(String entity, String field, String val) {
+ return StringUtils.capitalize(entity)
+ + " with " + field + " "+ val + " existed";
+ }
+}
\ No newline at end of file
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityNotFoundException.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityNotFoundException.java
new file mode 100644
index 0000000..362eb59
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/EntityNotFoundException.java
@@ -0,0 +1,15 @@
+package com.zsvg.vboot.common.mvc.exception;
+
+import org.springframework.util.StringUtils;
+
+public class EntityNotFoundException extends RuntimeException {
+
+ public EntityNotFoundException(Class clazz, String field, String val) {
+ super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val));
+ }
+
+ private static String generateMessage(String entity, String field, String val) {
+ return StringUtils.capitalize(entity)
+ + " with " + field + " "+ val + " does not exist";
+ }
+}
\ No newline at end of file
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ApiError.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ApiError.java
new file mode 100644
index 0000000..2623c68
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ApiError.java
@@ -0,0 +1,34 @@
+package com.zsvg.vboot.common.mvc.exception.handler;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+class ApiError {
+
+ private Integer status = 500;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime timestamp;
+ private String message;
+
+ private ApiError() {
+ timestamp = LocalDateTime.now();
+ }
+
+ public static ApiError error(String message){
+ ApiError apiError = new ApiError();
+ apiError.setMessage(message);
+ return apiError;
+ }
+
+ public static ApiError error(Integer status, String message){
+ ApiError apiError = new ApiError();
+ apiError.setStatus(status);
+ apiError.setMessage(message);
+ return apiError;
+ }
+}
+
+
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/GlobalExceptionHandler.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/GlobalExceptionHandler.java
new file mode 100644
index 0000000..fd3f7bc
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/GlobalExceptionHandler.java
@@ -0,0 +1,95 @@
+package com.zsvg.vboot.common.mvc.exception.handler;
+
+import com.zsvg.vboot.common.mvc.exception.BadRequestException;
+import com.zsvg.vboot.common.mvc.exception.EntityExistException;
+import com.zsvg.vboot.common.mvc.exception.EntityNotFoundException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import java.util.Objects;
+
+import static org.springframework.http.HttpStatus.NOT_FOUND;
+
+@Slf4j
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+
+ /**
+ * 处理所有不可知的异常
+ */
+ @ExceptionHandler(Throwable.class)
+ public ResponseEntity handleException(Throwable e){
+ // 打印堆栈信息
+ log.error(ThrowableUtil.getStackTrace(e));
+ return buildResponseEntity(ApiError.error(e.getMessage()));
+ }
+
+ /**
+ * BadCredentialsException
+ */
+ @ExceptionHandler(BadCredentialsException.class)
+ public ResponseEntity badCredentialsException(BadCredentialsException e){
+ // 打印堆栈信息
+ String message = "坏的凭证".equals(e.getMessage()) ? "用户名或密码不正确" : e.getMessage();
+ log.error(message);
+ return buildResponseEntity(ApiError.error(message));
+ }
+
+ /**
+ * 处理自定义异常
+ */
+ @ExceptionHandler(value = BadRequestException.class)
+ public ResponseEntity badRequestException(BadRequestException e) {
+ // 打印堆栈信息
+ log.error(ThrowableUtil.getStackTrace(e));
+ return buildResponseEntity(ApiError.error(e.getStatus(),e.getMessage()));
+ }
+
+ /**
+ * 处理 EntityExist
+ */
+ @ExceptionHandler(value = EntityExistException.class)
+ public ResponseEntity entityExistException(EntityExistException e) {
+ // 打印堆栈信息
+ log.error(ThrowableUtil.getStackTrace(e));
+ return buildResponseEntity(ApiError.error(e.getMessage()));
+ }
+
+ /**
+ * 处理 EntityNotFound
+ */
+ @ExceptionHandler(value = EntityNotFoundException.class)
+ public ResponseEntity entityNotFoundException(EntityNotFoundException e) {
+ // 打印堆栈信息
+ log.error(ThrowableUtil.getStackTrace(e));
+ return buildResponseEntity(ApiError.error(NOT_FOUND.value(),e.getMessage()));
+ }
+
+ /**
+ * 处理所有接口数据验证异常
+ */
+ @ExceptionHandler(MethodArgumentNotValidException.class)
+ public ResponseEntity handleMethodArgumentNotValidException(MethodArgumentNotValidException e){
+ // 打印堆栈信息
+ log.error(ThrowableUtil.getStackTrace(e));
+ String[] str = Objects.requireNonNull(e.getBindingResult().getAllErrors().get(0).getCodes())[1].split("\\.");
+ String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
+ String msg = "不能为空";
+ if(msg.equals(message)){
+ message = str[1] + ":" + message;
+ }
+ return buildResponseEntity(ApiError.error(message));
+ }
+
+ /**
+ * 统一返回
+ */
+ private ResponseEntity buildResponseEntity(ApiError apiError) {
+ return new ResponseEntity<>(apiError, HttpStatus.valueOf(apiError.getStatus()));
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ThrowableUtil.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ThrowableUtil.java
new file mode 100644
index 0000000..252de81
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/exception/handler/ThrowableUtil.java
@@ -0,0 +1,18 @@
+package com.zsvg.vboot.common.mvc.exception.handler;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class ThrowableUtil {
+
+ /**
+ * 获取堆栈信息
+ */
+ public static String getStackTrace(Throwable throwable){
+ StringWriter sw = new StringWriter();
+ try (PrintWriter pw = new PrintWriter(sw)) {
+ throwable.printStackTrace(pw);
+ return sw.toString();
+ }
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/others/MapHelper.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/others/MapHelper.java
new file mode 100644
index 0000000..5dfc661
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/others/MapHelper.java
@@ -0,0 +1,34 @@
+package com.zsvg.vboot.common.mvc.others;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MapHelper {
+ private Map map;
+
+ public MapHelper(){
+ map = new LinkedHashMap<>();
+ }
+
+ public MapHelper(String field,String title){
+ map = new LinkedHashMap<>();
+ map.put("field", field);
+ map.put("title", title);
+ }
+
+ public MapHelper put(String key,String value){
+ map.put(key, value);
+ return this;
+ }
+
+ public Map get(){
+ return map;
+ }
+
+ public MapHelper addTo(List list){
+ list.add(map);
+ return this;
+ }
+
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zconn.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zconn.java
new file mode 100644
index 0000000..7203c50
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zconn.java
@@ -0,0 +1,72 @@
+package com.zsvg.vboot.common.mvc.pojo;
+
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Zconn {
+ private String type;
+
+ private String url;
+
+ private String username;
+
+ private String passcode;
+
+
+
+ public String getSid()
+ {
+ if(isMysql())
+ {
+ return url.substring(url.lastIndexOf("/")+1).replaceAll("/","");
+ }
+ else if (isOracle())
+ {
+ return url.substring(url.lastIndexOf(":")+1);
+ }
+ else if (isDB2())
+ {
+ return url.substring(url.lastIndexOf("/")+1);
+ }
+ else{
+ return null;
+ }
+ }
+
+ public String getDriver(){
+ if(isOracle()){
+ return "oracle.jdbc.driver.OracleDriver";
+ }else if(isMysql()){
+ return "com.mysql.jdbc.Driver";
+ }else if(isMysql8()){
+ return "com.mysql.cj.jdbc.Driver";
+ }else if(isDB2()){
+ return "com.ibm.db2.jcc.DB2Driver";
+ }else{
+ return "暂不支持";
+ }
+ }
+
+ public boolean isOracle()
+ {
+ return "ORACLE".equals(type);
+ }
+ public boolean isMysql()
+ {
+ return "MYSQL".equals(type);
+ }
+ public boolean isMysql8()
+ {
+ return "MYSQL8".equals(type);
+ }
+ public boolean isDB2()
+ {
+ return "DB2".equals(type);
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/ZidName.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/ZidName.java
new file mode 100644
index 0000000..155c42a
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/ZidName.java
@@ -0,0 +1,47 @@
+package com.zsvg.vboot.common.mvc.pojo;
+
+
+public class ZidName
+{
+ private String id;
+ private String name;
+
+ @Override
+ public String toString() {
+ return "ZidName{" +
+ "id='" + id + '\'' +
+ ", name='" + name + '\'' +
+ '}';
+ }
+
+ public ZidName(String id, String name)
+ {
+ this.id = id;
+ this.name = name;
+ }
+
+ public ZidName()
+ {
+ }
+
+ //get and set-------
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zinp.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zinp.java
new file mode 100644
index 0000000..ab52953
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Zinp.java
@@ -0,0 +1,49 @@
+package com.zsvg.vboot.common.mvc.pojo;
+
+public class Zinp {
+ private String id;
+ private String name;
+ private String pid;
+
+ public Zinp() {
+ }
+
+ public Zinp(String id) {
+ this.id = id;
+ }
+
+ public Zinp(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public Zinp(String id, String name, String pid) {
+ this.id = id;
+ this.name = name;
+ this.pid = pid;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPid() {
+ return pid;
+ }
+
+ public void setPid(String pid) {
+ this.pid = pid;
+ }
+}
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Ztree.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Ztree.java
new file mode 100644
index 0000000..ab8f2af
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/pojo/Ztree.java
@@ -0,0 +1,23 @@
+package com.zsvg.vboot.common.mvc.pojo;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class Ztree {
+ private String id;
+
+ private String name;
+
+ @JsonIgnore
+ private String pid;
+
+ private List children;
+
+ private Map data;
+
+}
\ No newline at end of file
diff --git a/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/service/BaseCateService.java b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/service/BaseCateService.java
new file mode 100644
index 0000000..bcb69d2
--- /dev/null
+++ b/vboot-core/src/main/java/com/zsvg/vboot/common/mvc/service/BaseCateService.java
@@ -0,0 +1,229 @@
+package com.zsvg.vboot.common.mvc.service;
+
+import com.zsvg.vboot.common.mvc.api.RestResult;
+import com.zsvg.vboot.common.mvc.dao.JdbcDao;
+import com.zsvg.vboot.common.mvc.dao.Sqler;
+import com.zsvg.vboot.common.mvc.pojo.ZidName;
+import com.zsvg.vboot.common.mvc.pojo.Ztree;
+import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
+import com.zsvg.vboot.common.mvc.api.PageData;
+import com.zsvg.vboot.common.mvc.pojo.Zinp;
+import com.zsvg.vboot.common.util.lang.XstringUtil;
+import com.zsvg.vboot.common.util.web.XuserUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Transactional(rollbackFor = Exception.class)
+public abstract class BaseCateService {
+
+ @Transactional(readOnly = true)
+ public PageData findPageData(Sqler sqler) {
+ sqler.selectCUinfo().addSelect("t.label");
+ sqler.addOrder("t.ornum");
+ return jdbcDao.findPageData(sqler);
+ }
+
+ @Transactional(readOnly = true)
+ public List findIdNameRes(Sqler sqler) {
+ return jdbcDao.findIdNameList(sqler);
+ }
+
+
+
+ //用户编辑时选择父类别,不能选择自己及孩子节点,否则会造成无线循环
+ @Transactional(readOnly = true)
+ public List inpChoose(String table, String id, String name){
+ Sqler sqler = new Sqler(table);
+ sqler.addSelect("pid");
+ sqler.addWhere("t.avtag = 1");
+ if (XstringUtil.isNotBlank(id)) {
+ sqler.addWhere("t.tier not like ?", "%;" + id + ";%");
+ sqler.addWhere("t.id <> ?", id);
+ }
+ if(XstringUtil.isNotBlank(name)){
+ sqler.addLike("t.name", name);
+ }
+ sqler.addOrder("t.ornum");
+ return jdbcDao.findInpList(sqler);
+ }
+
+ @Transactional(readOnly = true)
+ public List tier2Choose(String table, String id, String name){
+ Sqler sqler = new Sqler(table);
+ sqler.addSelect("pid");
+ sqler.addWhere("t.avtag = 1");
+ if (XstringUtil.isNotBlank(id)) {
+ sqler.addWhere("t.tier not like ?", "%;" + id + ";%");
+ sqler.addWhere("t.id <> ?", id);
+ }
+ if(XstringUtil.isNotBlank(name)){
+ sqler.addLike("t.name", name);
+ }
+ sqler.addOrder("t.ornum");
+ return jdbcDao.findTreeList(sqler);
+ }
+
+
+ @Transactional(readOnly = true)
+ public RestResult inpFind(String table){
+ Sqler sqlHelper = new Sqler(table);
+ sqlHelper.addSelect("pid");
+ sqlHelper.addWhere("t.avtag = 1");
+ sqlHelper.addOrder("t.ornum");
+ return RestResult.ok(jdbcDao.findInpList(sqlHelper));
+ }
+
+ public RestResult inpDele(String table, String id){
+ String sql = "select id from " + table + " where tier like ? order by tier";
+ List stringList = jdbcDao.findStringList(sql, "%;" + id + ";%");
+ for (String sid : stringList) {
+ repo.deleteById(sid);
+ }
+ repo.deleteById(id);
+ return RestResult.ok();
+ }
+
+ public String insert(T cate) {
+ if(cate.getId()==null||"".equals(cate.getId())){
+ cate.setId(XstringUtil.getUUID());
+ }
+ if(cate.getCrman()==null){
+ cate.setCrman(XuserUtil.getUser());
+ }
+ if (cate.getParent() != null) {
+ T parent = repo.findById(cate.getParent().getId()).get();
+ cate.setTier(parent.getTier()+parent.getId()+ ";");
+ } else {
+ cate.setTier("null;");
+ }
+ repo.save(cate);
+ return cate.getId();
+ }
+
+ public String update(T cate){
+ cate.setUptim(new Date());
+ if(cate.getUpman()==null){
+ cate.setUpman(XuserUtil.getUser());
+ }
+ repo.save(cate);
+ return cate.getId();
+ }
+
+
+ public String update(T cate,String table){
+ cate.setUptim(new Date());
+ if(cate.getUpman()==null){
+ cate.setUpman(XuserUtil.getUser());
+ }
+ String newPid = "";
+ if(cate.getParent()!=null){
+ newPid=cate.getParent().getId();
+ }
+ T oldCate=repo.findById(cate.getId()).get();
+ String oldPid="";
+ if(oldCate.getParent()!=null){
+ oldPid =oldCate.getParent().getId();
+ }
+ String oldTier=oldCate.getTier();
+ if(oldPid.equals(newPid)){//如果父节点没有变,则只更新自己
+// System.out.println("父节点没有变");
+ cate.setTier(oldTier);
+ repo.save(cate);
+ }else{//如果父节点变了,则另外需要更新自己孩子节点的tier层级
+ String newTier = "null;";
+ if(cate.getParent()!=null){
+// System.out.println("父节点变成其他点了");
+ T newParentCate=repo.findById(cate.getParent().getId()).get();
+ newTier =newParentCate.getTier()+newParentCate.getId()+";";
+ }else{
+// System.out.println("父节点变成更节点了");
+ }
+ cate.setTier(newTier);
+ repo.save(cate);
+ //更新子节点
+ String sql = "select id,tier as name from " + table + " where tier like ? and id<>?";
+// System.out.println(sql);
+ List list = jdbcDao.findIdNameList(sql, oldTier+oldCate.getId()+";%",cate.getId());
+
+ String updateSql = "update " + table + " set tier=? where id=?";
+ List