diff --git a/src/main/java/com/glxp/api/controller/auth/DeptController.java b/src/main/java/com/glxp/api/controller/auth/DeptController.java
index 15391122..294806ed 100644
--- a/src/main/java/com/glxp/api/controller/auth/DeptController.java
+++ b/src/main/java/com/glxp/api/controller/auth/DeptController.java
@@ -1,6 +1,7 @@
 package com.glxp.api.controller.auth;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageInfo;
 import com.glxp.api.annotation.AuthRuleAnnotation;
@@ -228,6 +229,7 @@ public class DeptController extends BaseController {
             deptEntity.setPcode(deptEntity.getPcode());
         }
         deptEntity.setUpdateTime(new Date());
+        deptEntity.setId(IdUtil.getSnowflakeNextId());
         boolean b = deptService.insertInvWarehouse(deptEntity);
         if (!b) {
             return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
diff --git a/src/main/java/com/glxp/api/controller/auth/DeptUserController.java b/src/main/java/com/glxp/api/controller/auth/DeptUserController.java
index 3110a227..62115df1 100644
--- a/src/main/java/com/glxp/api/controller/auth/DeptUserController.java
+++ b/src/main/java/com/glxp/api/controller/auth/DeptUserController.java
@@ -64,23 +64,28 @@ public class DeptUserController {
     @PostMapping("udi/auth/dept/user/delete")
     @Log(title = "用户管理", businessType = BusinessType.DELETE)
     public BaseResponse delete(@RequestBody DeptUserEntity deptUserEntity) {
-            // 判断此用户是否创建单据
+        // 判断此用户是否创建单据
         List<IoOrderEntity> ioOrderEntities = ioOrderService.selectList(deptUserEntity.getUserId());
-        if( ioOrderEntities != null && ioOrderEntities.size() != 0 ){
-            return ResultVOUtils.error(500,"该用户已创建单据,不能移除!");
+        if (ioOrderEntities != null && ioOrderEntities.size() != 0) {
+            return ResultVOUtils.error(500, "该用户已创建单据,不能移除!");
         }
         //判断此用户是否与仓库有关联
         List<String> listWareHouse = warehouseUserService.selectCodeByUser(deptUserEntity.getUserId() + "");
-        if( listWareHouse != null  && listWareHouse.size() != 0){
-            return ResultVOUtils.error(500,"该用户已绑定仓库,不能移除!");
+        if (listWareHouse != null && listWareHouse.size() != 0) {
+            return ResultVOUtils.error(500, "该用户已绑定仓库,不能移除!");
         }
 
         //判断此用户是否与除一级部门 还绑定其他部门
         FilterDeptUserReqeust filterDeptUserReqeust = new FilterDeptUserReqeust();
         filterDeptUserReqeust.setUserId(deptUserEntity.getUserId());
         List<DeptUserEntity> deptUserEntities = deptUserService.selectDeptUser(filterDeptUserReqeust);
-        if( deptUserEntities != null && deptUserEntities.size()>1){
-            return ResultVOUtils.error(500,"该用户已绑定多个部门,不能移除!");
+        for (int i = 0; i < deptUserEntities.size(); i++) {
+            if (deptUserEntities.get(i).getDeptId() == 1) {
+                deptUserEntities.remove(deptUserEntities.get(i));
+            }
+        }
+        if (deptUserEntities != null && deptUserEntities.size() > 1) {
+            return ResultVOUtils.error(500, "该用户已绑定多个部门,不能移除!");
         }
 
 
diff --git a/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java b/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java
index 53c6c52f..c0c5fad0 100644
--- a/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java
+++ b/src/main/java/com/glxp/api/controller/auth/InvBusUserController.java
@@ -1,6 +1,7 @@
 package com.glxp.api.controller.auth;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.IdUtil;
 import com.github.pagehelper.PageInfo;
 import com.glxp.api.annotation.AuthRuleAnnotation;
 import com.glxp.api.annotation.Log;
@@ -131,15 +132,16 @@ public class InvBusUserController {
     @PostMapping("/spms/bus/user/warehouse/post")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     public BaseResponse postRes(@RequestBody UpdateUserRelBusRequset relBusRequset) {
-        boolean b = invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
         if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) {
+            invBusUserService.deleteByUnion(relBusRequset.getUserId(), relBusRequset.getSubInvCode());
             relBusRequset.getSelectActions().forEach(action ->
             {
                 InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
                 invBusUserEntity.setUserId(relBusRequset.getUserId());
                 invBusUserEntity.setSubInvCode(relBusRequset.getSubInvCode());
                 invBusUserEntity.setScAction(action);
-                invBusUserService.insertInvBusUser(invBusUserEntity);
+                invBusUserEntity.setId(IdUtil.getSnowflakeNextId());
+                invBusUserService.save(invBusUserEntity);
             });
         }
         InvBusUserEntity invBusUserEntity = new InvBusUserEntity();
diff --git a/src/main/java/com/glxp/api/controller/auth/SysUserController.java b/src/main/java/com/glxp/api/controller/auth/SysUserController.java
index 3beeeb25..f064d3f4 100644
--- a/src/main/java/com/glxp/api/controller/auth/SysUserController.java
+++ b/src/main/java/com/glxp/api/controller/auth/SysUserController.java
@@ -3,6 +3,7 @@ package com.glxp.api.controller.auth;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.github.pagehelper.PageInfo;
 import com.glxp.api.annotation.Log;
@@ -73,24 +74,24 @@ public class SysUserController extends BaseController {
             AuthAdminResponse authAdminResponse = new AuthAdminResponse();
             BeanUtils.copyProperties(item, authAdminResponse);
             List<Long> roles = sysRoleService.selectRoleListByUserId(authAdminResponse.getId());
-            List<DeptUserResponse> deptUserResponses=null;
-            if("key".equals(filterAuthUserRequest.getKey())){
-                deptUserResponses   = deptUserService.selectByUserIdKey(authAdminResponse.getId());
-            }else{
-             deptUserResponses = deptUserService.selectByUserId(authAdminResponse.getId());
+            List<DeptUserResponse> deptUserResponses = null;
+            if ("key".equals(filterAuthUserRequest.getKey())) {
+                deptUserResponses = deptUserService.selectByUserIdKey(authAdminResponse.getId());
+            } else {
+                deptUserResponses = deptUserService.selectByUserId(authAdminResponse.getId());
             }
             if (CollUtil.isNotEmpty(deptUserResponses)) {
                 List<Long> depts = new ArrayList<>();
                 String deptName = "";
                 for (DeptUserResponse deptUserResponse : deptUserResponses) {
-                    if(deptUserResponse.getDeptId()!=1){
+                    if (deptUserResponse.getDeptId() != 1) {
                         depts.add(deptUserResponse.getDeptId());
                         deptName = deptName + "," + deptUserResponse.getDeptName();
                     }
                 }
-                if(deptName.length()!=0){
+                if (deptName.length() != 0) {
                     authAdminResponse.setDeptName(deptName.substring(1));
-                }else{
+                } else {
                     authAdminResponse.setDeptName(deptName);
                 }
                 authAdminResponse.setDepts(depts);
@@ -194,7 +195,7 @@ public class SysUserController extends BaseController {
         String pid = invWarehouseService.selectParentIdByCode(authUserSaveRequest.getLocInvCode());
         authAdmin.setLocDeptCode(pid);
         authAdmin.setLocInvCode(authUserSaveRequest.getLocInvCode());
-
+        authAdmin.setId(IdUtil.getSnowflakeNextId());
         boolean b = userService.insertAuthAdmin(authAdmin);
         authAdmin = userService.findByUserName(authAdmin.getUserName());
         if (!b) {
@@ -212,15 +213,14 @@ public class SysUserController extends BaseController {
 //        sysUserRole.setRoleId(sysUserRole1.getRoleId());
 //        userService.insertUserAuth1(sysUserRole);
         //默认插入第一部门
-        List<Long> deptCodeList=authUserSaveRequest.getDepts();
-        if(deptCodeList == null){
-            deptCodeList=new ArrayList<>();
+        List<Long> deptCodeList = authUserSaveRequest.getDepts();
+        if (deptCodeList == null) {
+            deptCodeList = new ArrayList<>();
         }
         deptCodeList.add(1L);
         authUserSaveRequest.setDepts(deptCodeList);
 
 
-
         //插入部门
         if (CollUtil.isNotEmpty(authUserSaveRequest.getDepts())) {
             List<DeptUserEntity> list = new ArrayList<>();
@@ -296,24 +296,24 @@ public class SysUserController extends BaseController {
         userService.updateAuthAdmin(authAdmin);
 
 
-            //默认插入第一部门
+        //默认插入第一部门
         ArrayList<Long> deptCodeList = new ArrayList<>();
         FilterDeptUserReqeust filterDeptUserReqeust = new FilterDeptUserReqeust();
         filterDeptUserReqeust.setUserId(authUserSaveRequest.getId());
         List<DeptUserEntity> deptUserEntities = deptUserService.selectDeptUser(filterDeptUserReqeust);
-        if(deptUserEntities == null){
-                deptCodeList.add(1L);
-                authUserSaveRequest.setDepts(deptCodeList);
-            }else{
-            Boolean checkDeptId=false;
+        if (deptUserEntities == null) {
+            deptCodeList.add(1L);
+            authUserSaveRequest.setDepts(deptCodeList);
+        } else {
+            Boolean checkDeptId = false;
             for (DeptUserEntity deptUserEntity : deptUserEntities) {
-                if(deptUserEntity.getDeptId() == 1){
-                  checkDeptId=true;
-                }else{
+                if (deptUserEntity.getDeptId() == 1) {
+                    checkDeptId = true;
+                } else {
                     deptCodeList.add(deptUserEntity.getDeptId());
                 }
             }
-            if(checkDeptId==false){
+            if (checkDeptId == false) {
                 deptCodeList.add(1L);
                 authUserSaveRequest.setDepts(deptCodeList);
             }
diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java
index 4e227480..46ba0cb8 100644
--- a/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java
+++ b/src/main/java/com/glxp/api/controller/basic/UdiRelevanceController.java
@@ -379,12 +379,10 @@ public class UdiRelevanceController extends BaseController {
     //新增或修改关联
     @AuthRuleAnnotation("")
     @PostMapping("/udi/udirel/check/udi")
-
     public BaseResponse checkUdi(@RequestBody UdiCombineRequest udiCombineRequest) {
 
         List<String> keys = udiCombineRequest.getKeys();
         if (keys != null && keys.size() > 0) {
-
             List<UdiRelevanceEntity> datas = udiRelevanceService.batchSelectByUuid(keys);
             if (datas.isEmpty()) {
                 return ResultVOUtils.success("无被选入!");
diff --git a/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java b/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java
index bad14a81..c6fa891c 100644
--- a/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java
+++ b/src/main/java/com/glxp/api/dao/auth/WarehouseBussinessTypeDao.java
@@ -27,7 +27,6 @@ public interface WarehouseBussinessTypeDao extends BaseMapperPlus<WarehouseBussi
 
     int updateBatchSelective(List<WarehouseBussinessTypeEntity> list);
 
-    int batchInsert(@Param("list") List<WarehouseBussinessTypeEntity> list);
 
     List<WarehouseBussinessTypeEntity> selectListByCode(@Param("code") String code);
 
diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java
index b6b8fd5c..b8fbae06 100644
--- a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java
+++ b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java
@@ -243,5 +243,13 @@ public class IoOrderEntity {
 
     @TableField(value = "checkPreInOrders")
     private String checkPreInOrders;
+    
+    //    预验收按货位出库,退货
+    @TableField(value = "checkPreInInvCode")
+    private String checkPreInInvCode;
+
+    //    预验收按货位出库,退货
+    @TableField(value = "checkPreInSpaceCode")
+    private String checkPreInSpaceCode;
 
 }
diff --git a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java
index 027a6590..f1a5e85c 100644
--- a/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java
+++ b/src/main/java/com/glxp/api/res/basic/BasicBussinessTypeResponse.java
@@ -12,7 +12,7 @@ public class BasicBussinessTypeResponse {
     /**
      * 单据类型ID
      */
-    private Integer id;
+    private Long id;
 
     /**
      * 单据类型编码
diff --git a/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java
index a7bbb12e..2a1624b4 100644
--- a/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java
+++ b/src/main/java/com/glxp/api/service/auth/impl/WarehouseBussinessTypeServiceImpl.java
@@ -68,7 +68,7 @@ public class WarehouseBussinessTypeServiceImpl implements WarehouseBussinessType
             });
 
             //加入新数据
-            warehouseBussinessTypeDao.batchInsert(warehouseBussinessTypeEntities);
+            warehouseBussinessTypeDao.insertBatch(warehouseBussinessTypeEntities);
         }
     }
 
diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicBussinessTypeServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicBussinessTypeServiceImpl.java
index 2d8a6d7b..cf64ea84 100644
--- a/src/main/java/com/glxp/api/service/basic/impl/BasicBussinessTypeServiceImpl.java
+++ b/src/main/java/com/glxp/api/service/basic/impl/BasicBussinessTypeServiceImpl.java
@@ -84,7 +84,8 @@ public class BasicBussinessTypeServiceImpl extends ServiceImpl<BasicBussinessTyp
      * @param basicBussinessTypeEntity
      */
     private void setSupplementOrderType(BasicBussinessTypeEntity basicBussinessTypeEntity) {
-        if (null == basicBussinessTypeEntity.getId()) {
+        boolean isExit = basicBussinessTypeDao.exists(new QueryWrapper<BasicBussinessTypeEntity>().eq(basicBussinessTypeEntity.getId() != null, "id", basicBussinessTypeEntity.getId()));
+        if (null == basicBussinessTypeEntity.getId() || !isExit) {
             //处理添加新单据类型时的平衡补单逻辑
             if (StrUtil.isNotBlank(basicBussinessTypeEntity.getSupplementOrderType())) {
                 //查询平衡补单的单据类型数据是否存在
diff --git a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml
index cfa6f2ca..ca9ebd5b 100644
--- a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml
+++ b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml
@@ -6,8 +6,8 @@
             resultType="com.glxp.api.entity.auth.AuthAdmin">
         SELECT auth_user.*, auth_dept.name deptName, auth_warehouse.name warehouseName
         FROM auth_user
-                 left join auth_dept on auth_user.locDeptCode = auth_dept.code
-                 LEFT JOIN auth_warehouse on auth_user.locInvCode = auth_warehouse.code
+                     left join auth_dept on auth_user.locDeptCode = auth_dept.code
+                     LEFT JOIN auth_warehouse on auth_user.locInvCode = auth_warehouse.code
         <where>
             <if test="ids != null and ids.size > 0">
                 AND id IN
@@ -27,8 +27,8 @@
             <if test="lastUpdateTime != null and lastUpdateTime != ''">
                 <![CDATA[
                 and DATE_FORMAT(lastModifyTime
-                        , '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}
-                        , '%Y-%m-%d %H:%i:%S')
+                            , '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}
+                            , '%Y-%m-%d %H:%i:%S')
                 ]]>
             </if>
             <if test="deptCode != null and deptCode != ''">
@@ -77,10 +77,10 @@
     </select>
 
     <insert id="insertAuthAdmin" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthAdmin">
-        INSERT INTO auth_user( userName, passWord, lastLoginIp, lastLoginTime, createTime, userFlag
+        INSERT INTO auth_user( id, userName, passWord, lastLoginIp, lastLoginTime, createTime, userFlag
                              , employeeName, CustomerId, lastModifyTime, locDeptCode, locInvCode, comments)
-        values
-        (#{userName},
+                values
+                (#{id}, #{userName},
         <choose>
             <when test="passWord != null">
                 #{passWord},
@@ -118,9 +118,10 @@
 
     <insert id="replaceAuthAdmin" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthAdmin">
         replace
-            INTO auth_user(id, userName, passWord, lastLoginIp,
-                           lastLoginTime, createTime, userFlag, lastModifyTime, employeeName, CustomerId, locDeptCode,
-                           locInvCode, comments)
+                INTO auth_user(id, userName, passWord, lastLoginIp,
+                               lastLoginTime, createTime, userFlag, lastModifyTime, employeeName, CustomerId,
+                               locDeptCode,
+                               locInvCode, comments)
         values (#{id},
                 #{userName},
                 #{passWord},
@@ -189,7 +190,7 @@
     <select id="selectNotSelectUser" resultType="com.glxp.api.entity.auth.AuthAdmin">
         select *
         from auth_user
-                 left join auth_dept_user on auth_user.id = auth_dept_user.userId
+                     left join auth_dept_user on auth_user.id = auth_dept_user.userId
         <where>
             userFlag != 0
             <if test="deptId != null and '' != deptId">
@@ -210,8 +211,8 @@
             resultType="com.glxp.api.entity.auth.AuthAdmin">
         select u.*
         from auth_user u
-                 left join auth_user_role sur on u.id = sur.user_id
-                 left join auth_role r on r.role_id = sur.role_id
+                     left join auth_user_role sur on u.id = sur.user_id
+                     left join auth_role r on r.role_id = sur.role_id
         <where>
             <if test="roleId != null and '' != roleId">
                 AND r.role_id = #{roleId}
@@ -224,8 +225,8 @@
             resultType="com.glxp.api.entity.auth.AuthAdmin">
         select u.*
         from auth_user u
-                 left join auth_user_role sur on u.id = sur.user_id
-                 left join auth_role r on r.role_id = sur.role_id
+                     left join auth_user_role sur on u.id = sur.user_id
+                     left join auth_role r on r.role_id = sur.role_id
         <where>
             <if test="ids != null and ids.size() != 0">
                 u.id not in
diff --git a/src/main/resources/mybatis/mapper/auth/DeptDao.xml b/src/main/resources/mybatis/mapper/auth/DeptDao.xml
index 5c14ac9c..63ffbaaa 100644
--- a/src/main/resources/mybatis/mapper/auth/DeptDao.xml
+++ b/src/main/resources/mybatis/mapper/auth/DeptDao.xml
@@ -2,10 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 
 <mapper namespace="com.glxp.api.dao.auth.DeptDao">
-
     <select id="filterInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
             resultType="com.glxp.api.entity.auth.DeptEntity">
-        select * ,(select name from auth_dept WHERE a.pcode = code) pName
+        select *, (select name from auth_dept WHERE a.pcode = code) pName
         FROM auth_dept a
         <where>
             <if test="id != '' and id != null">
@@ -18,7 +17,7 @@
                 AND a.code = #{code}
             </if>
             <if test="name != '' and name != null">
-                AND a.name like concat('%',#{name},'%')
+                AND a.name like concat('%', #{name}, '%')
             </if>
             <if test="advanceType != null">
                 AND a.advanceType = #{advanceType}
@@ -38,15 +37,14 @@
             <if test="spUse != null">
                 AND a.spUse = #{spUse}
             </if>
-
         </where>
-
     </select>
 
     <select id="filterAllByUser" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
             resultType="com.glxp.api.entity.auth.DeptEntity">
-        select auth_dept.* from auth_dept INNER JOIN auth_warehouse
-        on auth_dept.`code` =auth_warehouse.parentId
+        select auth_dept.* from auth_dept
+                INNER JOIN auth_warehouse
+                on auth_dept.`code` = auth_warehouse.parentId
         <if test="CustomerId != '' and CustomerId != null">
             INNER JOIN auth_warehouse_user on auth_warehouse_user.`code` = auth_warehouse.code
         </if>
@@ -63,7 +61,7 @@
             <if test="name != '' and name != null">
                 AND name = #{name}
             </if>
-            <if test=" advanceType != null">
+            <if test="advanceType != null">
                 AND advanceType = #{advanceType}
             </if>
             <if test="isDefault != null">
@@ -84,7 +82,6 @@
             </if>
         </where>
         group by auth_dept.code
-
     </select>
 
 
@@ -93,7 +90,6 @@
         SELECT *
         FROM auth_dept
         WHERE id = #{id}
-
     </select>
 
     <select id="selectByIdCode"
@@ -108,12 +104,12 @@
                 </foreach>
             </if>
         </where>
-
     </select>
 
     <select id="selectMaxCode" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
             resultType="com.glxp.api.entity.auth.DeptEntity">
-        select max(code) as code from auth_dept
+        select max(code) as code
+        from auth_dept
         <where>
             <if test="id != '' and id != null">
                 AND id = #{id}
@@ -127,7 +123,7 @@
             <if test="name != '' and name != null">
                 AND name = #{name}
             </if>
-            <if test=" advanceType != null">
+            <if test="advanceType != null">
                 AND advanceType = #{advanceType}
             </if>
             <if test="isDefault != null">
@@ -140,13 +136,13 @@
                 AND `level` = #{level}
             </if>
         </where>
-
     </select>
 
 
     <select id="filterGroupInvWarehouse" parameterType="com.glxp.api.req.auth.FilterInvWarehouseRequest"
             resultType="com.glxp.api.entity.auth.DeptEntity">
-        SELECT * FROM auth_dept
+        SELECT *
+        FROM auth_dept
         <where>
             <if test="id != '' and id != null">
                 AND id = #{id}
@@ -175,14 +171,17 @@
             <if test="spUse != null">
                 AND spUse = #{spUse}
             </if>
-            <if test="updateTime!=null and updateTime!=''">
-                <![CDATA[   and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>=  DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S')   ]]>
+            <if test="updateTime != null and updateTime != ''">
+                <![CDATA[
+                and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{updateTime}, '%Y-%m-%d %H:%i:%S')
+                ]]>
             </if>
-            <if test="lastUpdateTime!=null and lastUpdateTime!=''">
-                <![CDATA[   and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>=  DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')   ]]>
+            <if test="lastUpdateTime != null and lastUpdateTime != ''">
+                <![CDATA[
+                and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
+                ]]>
             </if>
         </where>
-
     </select>
     <select id="getNameByCode" resultType="java.lang.String">
         select name
@@ -197,27 +196,25 @@
     <insert id="insertInvWarehouse" keyProperty="id"
             parameterType="com.glxp.api.entity.auth.DeptEntity">
         replace
-        INTO auth_dept
-        (pid, code, `name`, advanceType, isDefault,
-         status, updateTime, remark,`level`,pcode,spUse, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
-        values (
-        #{pid},
-        #{code},
-        #{name},
-        #{advanceType},
-        #{isDefault},
-        #{status},
-        #{updateTime},
-        #{remark},
-        #{level},
-        #{pcode},
-        #{spUse},
-        #{thirdId},
-        #{thirdId1},
-        #{thirdId2},
-        #{thirdId3},
-        #{thirdId4}
-        )
+                INTO auth_dept
+                (id, pid, code, `name`, advanceType, isDefault,
+                 status, updateTime, remark, `level`, pcode, spUse, thirdId, thirdId1, thirdId2, thirdId3, thirdId4)
+        values (#{id}, #{pid},
+                #{code},
+                #{name},
+                #{advanceType},
+                #{isDefault},
+                #{status},
+                #{updateTime},
+                #{remark},
+                #{level},
+                #{pcode},
+                #{spUse},
+                #{thirdId},
+                #{thirdId1},
+                #{thirdId2},
+                #{thirdId3},
+                #{thirdId4})
     </insert>
 
 
@@ -227,58 +224,87 @@
         WHERE id = #{id}
     </delete>
 
-    <select id="getDeptById" resultType="com.glxp.api.entity.auth.DeptEntity" >
+    <select id="getDeptById" resultType="com.glxp.api.entity.auth.DeptEntity">
         select *
         from auth_dept
-            where id in
-               <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
-                   #{item}
-               </foreach>
-
+                where id in
+        <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
+            #{item}
+        </foreach>
     </select>
 
     <update id="updateInvWarehouse" parameterType="com.glxp.api.entity.auth.DeptEntity">
         UPDATE auth_dept
         <trim prefix="set" suffixOverrides=",">
-            <if test="pid != null">pid=#{pid},</if>
-            <if test="name != null">name=#{name},</if>
-            <if test="code != null">code=#{code},</if>
-            <if test="advanceType != null">advanceType=#{advanceType},</if>
-            <if test="isDefault != null">isDefault=#{isDefault},</if>
-            <if test="status != null">status=#{status},</if>
-            <if test="updateTime != null">updateTime=#{updateTime},</if>
-            <if test="remark != null">remark=#{remark},</if>
-            <if test="level != null">level=#{level},</if>
-            <if test="pcode != null">pcode=#{pcode},</if>
-            <if test="thirdId != null">remark=#{thirdId},</if>
-            <if test="thirdId1 != null">remark=#{thirdId1},</if>
-            <if test="thirdId2 != null">remark=#{thirdId2},</if>
-            <if test="thirdId3 != null">remark=#{thirdId3},</if>
-            <if test="thirdId4 != null">remark=#{thirdId4},</if>
-            <if test="spUse != null">spUse=#{spUse},</if>
-
-
+            <if test="pid != null">
+                pid=#{pid},
+            </if>
+            <if test="name != null">
+                name=#{name},
+            </if>
+            <if test="code != null">
+                code=#{code},
+            </if>
+            <if test="advanceType != null">
+                advanceType=#{advanceType},
+            </if>
+            <if test="isDefault != null">
+                isDefault=#{isDefault},
+            </if>
+            <if test="status != null">
+                status=#{status},
+            </if>
+            <if test="updateTime != null">
+                updateTime=#{updateTime},
+            </if>
+            <if test="remark != null">
+                remark=#{remark},
+            </if>
+            <if test="level != null">
+                level=#{level},
+            </if>
+            <if test="pcode != null">
+                pcode=#{pcode},
+            </if>
+            <if test="thirdId != null">
+                remark=#{thirdId},
+            </if>
+            <if test="thirdId1 != null">
+                remark=#{thirdId1},
+            </if>
+            <if test="thirdId2 != null">
+                remark=#{thirdId2},
+            </if>
+            <if test="thirdId3 != null">
+                remark=#{thirdId3},
+            </if>
+            <if test="thirdId4 != null">
+                remark=#{thirdId4},
+            </if>
+            <if test="spUse != null">
+                spUse=#{spUse},
+            </if>
         </trim>
         WHERE id = #{id}
     </update>
 
     <insert id="importInvWarehouse" parameterType="java.util.List">
         replace into auth_dept (id, pid, code, `name`, advanceType, isDefault, status,
-        updateTime, remark, `level`, pcode, thirdId, thirdId1, thirdId2, thirdId3,
-        thirdId4,spUse) values
+                                updateTime, remark, `level`, pcode, thirdId, thirdId1, thirdId2, thirdId3,
+                                thirdId4, spUse) values
         <foreach collection="invWarehouseEntities" item="item" index="index" separator=",">
             (#{item.id},
-            #{item.pid},
-            #{item.code},
-            #{item.name},
-            #{item.advanceType},
-            #{item.isDefault},
-            #{item.status},
-            #{item.updateTime},
-            #{item.remark}, #{item.level},
-            #{item.pcode}, #{item.thirdId},
-            #{item.thirdId1}, #{item.thirdId2},
-            #{item.thirdId3}, #{item.thirdId4},#{item.spUse})
+             #{item.pid},
+             #{item.code},
+             #{item.name},
+             #{item.advanceType},
+             #{item.isDefault},
+             #{item.status},
+             #{item.updateTime},
+             #{item.remark}, #{item.level},
+             #{item.pcode}, #{item.thirdId},
+             #{item.thirdId1}, #{item.thirdId2},
+             #{item.thirdId3}, #{item.thirdId4}, #{item.spUse})
         </foreach>
     </insert>
 
@@ -308,28 +334,42 @@
     </select>
 
     <select id="selectNameByCode" resultType="java.lang.String">
-        select name from auth_dept where code = #{code}
+        select name
+        from auth_dept
+        where code = #{code}
     </select>
 
     <select id="selectByPcode" resultType="com.glxp.api.entity.auth.DeptEntity">
-        select * from auth_dept where pcode = #{pcode}
+        select *
+        from auth_dept
+        where pcode = #{pcode}
     </select>
 
     <select id="selectupDeptAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.auth.DeptEntity">
         with recursive table_a as (
-            select * from auth_dept ta where code = #{pcode}
-            union all
-            select tb.* from auth_dept tb inner join table_a on table_a.pcode = tb.code
-        )
-        select * from  table_a
+                select *
+                from auth_dept ta
+                where code = #{pcode}
+                union all
+                select tb.*
+                from auth_dept tb
+                             inner join table_a on table_a.pcode = tb.code
+                )
+        select *
+        from table_a
     </select>
 
     <select id="selectLowDeptAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.auth.DeptEntity">
         with recursive table_a as (
-            select * from auth_dept ta where pcode = #{pcode}
-            union all
-            select tb.* from auth_dept tb inner join table_a on table_a.code = tb.pcode
-        )
-        select * from  table_a
+                select *
+                from auth_dept ta
+                where pcode = #{pcode}
+                union all
+                select tb.*
+                from auth_dept tb
+                             inner join table_a on table_a.code = tb.pcode
+                )
+        select *
+        from table_a
     </select>
 </mapper>
diff --git a/src/main/resources/mybatis/mapper/auth/InvBusUserDao.xml b/src/main/resources/mybatis/mapper/auth/InvBusUserDao.xml
index 897eb5cf..d12c5d48 100644
--- a/src/main/resources/mybatis/mapper/auth/InvBusUserDao.xml
+++ b/src/main/resources/mybatis/mapper/auth/InvBusUserDao.xml
@@ -2,7 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 
 <mapper namespace="com.glxp.api.dao.auth.InvBusUserDao">
-
     <select id="filterInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
             resultType="com.glxp.api.entity.auth.InvBusUserEntity">
         select *
@@ -17,46 +16,43 @@
             <if test="scAction != '' and scAction != null">
                 AND scAction = #{scAction}
             </if>
-            <if test="selectedCodes != null and selectedCodes.size()!=0">
+            <if test="selectedCodes != null and selectedCodes.size() != 0">
                 and scAction not in
                 <foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-
         </where>
-
     </select>
 
 
     <select id="filterUnSelect" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
             resultType="com.glxp.api.entity.auth.WarehouseBussinessTypeEntity">
         select auth_warehouse_bustype.id,
-        auth_warehouse_bustype.code,
-        auth_warehouse_bustype.action,
-        basic_bussiness_type.name
+               auth_warehouse_bustype.code,
+               auth_warehouse_bustype.action,
+               basic_bussiness_type.name
         from auth_warehouse_bustype
-        inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
+                     inner join basic_bussiness_type on auth_warehouse_bustype.action = basic_bussiness_type.action
         <where>
             <if test="subInvCode != '' and subInvCode != null">
                 AND code = #{subInvCode}
             </if>
-            <if test="selectedCodes != null and selectedCodes.size()!=0">
+            <if test="selectedCodes != null and selectedCodes.size() != 0">
                 and auth_warehouse_bustype.action not in
                 <foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-
         </where>
-
     </select>
 
 
     <select id="filterJoinInvBusUser" parameterType="com.glxp.api.req.auth.FilterInvBusUserRequest"
             resultType="com.glxp.api.res.auth.InvBusUserResponse">
-        select auth_user_bustype.*,basic_bussiness_type.name billTypeName
-        FROM auth_user_bustype left join basic_bussiness_type on auth_user_bustype.scAction = basic_bussiness_type.action
+        select auth_user_bustype.*, basic_bussiness_type.name billTypeName
+        FROM auth_user_bustype
+                     left join basic_bussiness_type on auth_user_bustype.scAction = basic_bussiness_type.action
         <where>
             <if test="userId != '' and userId != null">
                 AND userId = #{userId}
@@ -67,24 +63,20 @@
             <if test="scAction != '' and scAction != null">
                 AND scAction = #{scAction}
             </if>
-
         </where>
         group by auth_user_bustype.id
-
     </select>
 
 
-    <insert id="insertInvBusUser" keyProperty="id"
+    <insert id="insertInvBusUser"
             parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
         replace
-        INTO  auth_user_bustype
-        (userId, `subInvCode`, scAction, remark)
-        values (
-        #{userId},
-        #{subInvCode},
-        #{scAction},
-        #{remark}
-        )
+                INTO auth_user_bustype
+                (userId, `subInvCode`, scAction, remark)
+        values (#{userId},
+                #{subInvCode},
+                #{scAction},
+                #{remark})
     </insert>
 
 
@@ -103,27 +95,34 @@
     <delete id="deleteByscAction" parameterType="Map">
         DELETE
         FROM auth_user_bustype
-            <where>
-                <if test="subInvCode != '' and subInvCode != null">
-                    AND subInvCode = #{subInvCode}
-                </if>
-                <if test="selectedCodes != null and selectedCodes.size()!=0">
-                    and scAction  in
-                    <foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
-                        #{item}
-                    </foreach>
-                </if>
-            </where>
+        <where>
+            <if test="subInvCode != '' and subInvCode != null">
+                AND subInvCode = #{subInvCode}
+            </if>
+            <if test="selectedCodes != null and selectedCodes.size() != 0">
+                and scAction in
+                <foreach collection="selectedCodes" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
     </delete>
     <update id="updateInvBusUser" parameterType="com.glxp.api.entity.auth.InvBusUserEntity">
         UPDATE auth_user_bustype
         <trim prefix="set" suffixOverrides=",">
-            <if test="userId != null">userId=#{userId},</if>
-            <if test="subInvCode != null">subInvCode=#{subInvCode},</if>
-            <if test="scAction != null">scAction=#{scAction},</if>
-            <if test="remark != null">remark=#{remark},</if>
+            <if test="userId != null">
+                userId=#{userId},
+            </if>
+            <if test="subInvCode != null">
+                subInvCode=#{subInvCode},
+            </if>
+            <if test="scAction != null">
+                scAction=#{scAction},
+            </if>
+            <if test="remark != null">
+                remark=#{remark},
+            </if>
         </trim>
         WHERE id = #{id}
     </update>
-
 </mapper>
diff --git a/src/main/resources/mybatis/mapper/auth/WarehouseBussinessTypeDao.xml b/src/main/resources/mybatis/mapper/auth/WarehouseBussinessTypeDao.xml
index 775664cf..54ee44bc 100644
--- a/src/main/resources/mybatis/mapper/auth/WarehouseBussinessTypeDao.xml
+++ b/src/main/resources/mybatis/mapper/auth/WarehouseBussinessTypeDao.xml
@@ -135,15 +135,6 @@
             #{item.id,jdbcType=INTEGER}
         </foreach>
     </update>
-    <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
-        <!--@mbg.generated-->
-        insert into auth_warehouse_bustype
-                (code, `action`, `name`)
-                values
-        <foreach collection="list" item="item" separator=",">
-            (#{item.code,jdbcType=VARCHAR}, #{item.action,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR})
-        </foreach>
-    </insert>
 
     <select id="selectListByCode" parameterType="java.lang.String" resultMap="BaseResultMap">
         select auth_warehouse_bustype.id,
diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrDeptDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrDeptDao.xml
index fd787d30..df2bf7e8 100644
--- a/src/main/resources/mybatis/mapper/thrsys/ThrDeptDao.xml
+++ b/src/main/resources/mybatis/mapper/thrsys/ThrDeptDao.xml
@@ -264,4 +264,4 @@
             thirdSysFk  = #{thirdSysFk,jdbcType=VARCHAR},
         </trim>
     </insert>
-</mapper>
\ No newline at end of file
+</mapper>
diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql
index 115a145b..f2ff9368 100644
--- a/src/main/resources/schemas/schema_v2.1.sql
+++ b/src/main/resources/schemas/schema_v2.1.sql
@@ -88,6 +88,9 @@ CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'checkCertExpire', 'tinyint', 1
 CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'preInBackAction', 'varchar(255) ', 1);
 CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'backPreinType', 'tinyint', 1);
 CALL Pro_Temp_ColumnWork('io_order', 'checkPreInOrders', 'varchar(255)', 1);
+CALL Pro_Temp_ColumnWork('io_order', 'checkPreInSpaceCode', 'varchar(255)', 1);
+CALL Pro_Temp_ColumnWork('io_order', 'checkPreInInvCode', 'varchar(255)', 1);
+
 CALL Pro_Temp_ColumnWork('basic_bussiness_type', 'sortNum', 'int', 1);
 
 
@@ -302,9 +305,6 @@ CREATE TABLE IF NOT EXISTS `sync_data_change_bustypes`
   ROW_FORMAT = DYNAMIC;
 
 
-
-
-
 # 修改主键为LONG
 CALL Pro_Temp_ColumnWork('basic_hosp_type', 'id', 'bigint', 2);
 CALL Pro_Temp_ColumnWork('basic_udirel', 'id', 'bigint', 2);