From 5cbd7a21164c756f2e9c6e0f0ad7664e21cc6675 Mon Sep 17 00:00:00 2001 From: tamguo Date: Tue, 31 Jul 2018 17:21:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/dao/MyMetaObjectHandler.java | 3 +- .../modules/sys/model/SysOfficeEntity.java | 5 +- .../service/impl/SysOfficeServiceImpl.java | 78 ++++++++++++------- 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java b/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java index f066a23..d5ef840 100644 --- a/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java +++ b/tamguo-oms/src/main/java/com/tamguo/config/dao/MyMetaObjectHandler.java @@ -14,10 +14,9 @@ import org.slf4j.LoggerFactory; public class MyMetaObjectHandler extends MetaObjectHandler { protected final static Logger logger = LoggerFactory.getLogger(MyMetaObjectHandler.class); - + @Override public void insertFill(MetaObject metaObject) { - logger.info("新增的时候干点不可描述的事情"); Object testType = getFieldValByName("createBy", metaObject); if (testType == null) { setFieldValByName("createBy", ShiroUtils.getUser() , metaObject); //mybatis-plus版本2.0.9+ diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java index 9c78a44..79240a1 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/model/SysOfficeEntity.java @@ -15,7 +15,10 @@ import com.baomidou.mybatisplus.annotations.TableName; @TableName(value="sys_office") public class SysOfficeEntity implements Serializable { private static final long serialVersionUID = 1L; - + public static final String ROOT_OFFICE_CODE = "0"; + public static final String TREE_CODE_OFFICE_SEPARATE = ","; + public static final String TREE_NAME_OFFICE_SEPARATE = "/"; + @TableId private String officeCode; private String address; diff --git a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java index 7e71be9..faba318 100644 --- a/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java +++ b/tamguo-oms/src/main/java/com/tamguo/modules/sys/service/impl/SysOfficeServiceImpl.java @@ -62,37 +62,24 @@ public class SysOfficeServiceImpl extends ServiceImpl 0) { + office.setTreeLeaf(false); }else { - oldOffice.setParentCodes(parentOffice.getParentCodes() + parentOffice.getOfficeCode() + ","); - oldOffice.setTreeLeaf(true); - oldOffice.setTreeLevel(parentOffice.getTreeLevel().add(BigDecimal.valueOf(1))); + office.setTreeLeaf(true); } - sysOfficeMapper.updateById(oldOffice); + return office; } }