浏览代码

修复bug343

oyq28 3 年之前
父节点
当前提交
81a6b638aa

+ 9 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/ResourceBusinessService.java

@@ -6,6 +6,7 @@ import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessS
 import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessUpdateDTO;
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.tenant.dto.WorkshopSaveDTO;
 
 public interface ResourceBusinessService extends SuperService<ResourceBusiness> {
 
@@ -32,4 +33,12 @@ public interface ResourceBusinessService extends SuperService<ResourceBusiness>
      */
     Boolean delete(ResourceBusiness model);
 
+
+    /**
+     * 检测用户名是否存在
+     *
+     * @return
+     */
+    Boolean check(String name);
+
 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProductionresourcePositionServiceImpl.java

@@ -158,7 +158,7 @@ public class ProductionresourcePositionServiceImpl extends SuperServiceImpl<Prod
         save(bean);
 
         //更新库位的point_id
-        if(StringUtil.isNotEmpty(data.getPointId())){
+        if(StringUtil.isNotEmpty(data.getPointId()) && null!=data.getStorgeId()){
             Storge storge = storgeMapper.selectById(storgeId);
             storge.setPointId(data.getPointId());
             storgeMapper.updateById(storge);

+ 6 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ResourceBusinessServiceImpl.java

@@ -9,6 +9,7 @@ import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessU
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
 import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -43,4 +44,9 @@ public class ResourceBusinessServiceImpl extends SuperServiceImpl<ResourceBusine
     public Boolean delete(ResourceBusiness model) {
         return removeById(model.getId());
     }
+
+    @Override
+    public Boolean check(String name) {
+        return super.count(Wraps.<ResourceBusiness>lbQ().eq(ResourceBusiness::getName, name.trim())) > 0;
+    }
 }

+ 8 - 2
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ResourceBusinessController.java

@@ -1,6 +1,7 @@
 package com.github.zuihou.business.controller.productionResourceCenter;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.base.R;
 import com.github.zuihou.base.controller.SuperController;
@@ -9,13 +10,11 @@ import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessP
 import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessSaveDTO;
 import com.github.zuihou.business.productionResourceCenter.dto.ResourceBusinessUpdateDTO;
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
-import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import com.github.zuihou.log.annotation.SysLog;
-import com.github.zuihou.utils.BeanPlusUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -23,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.UnsupportedEncodingException;
 import java.util.List;
 import java.util.Map;
 
@@ -90,4 +90,10 @@ public class ResourceBusinessController extends SuperController<ResourceBusiness
         return success(productionresourceBizService.pageList(map));
     }
 
+    @ApiOperation(value = "检测用户名是否存在", notes = "检测车间是否存在")
+    @RequestMapping(value = "/check", method = RequestMethod.POST)
+    public R<Boolean> check(@RequestBody String name) throws UnsupportedEncodingException {
+        JSONObject jsonObject = JSONObject.parseObject(name);
+        return success(baseService.check(jsonObject.getString("name")));
+    }
 }