|
@@ -25,6 +25,8 @@ 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 com.github.zuihou.tenant.dao.ProductionresourceviewMapper;
|
|
|
+import com.github.zuihou.tenant.dto.CodeRuleSaveDTO;
|
|
|
+import com.github.zuihou.tenant.entity.CodeRule;
|
|
|
import com.github.zuihou.tenant.service.CodeRuleService;
|
|
|
import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
import com.github.zuihou.utils.BeanPlusUtil;
|
|
@@ -98,6 +100,9 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public ZZone save(ZZoneSaveDTO data) {
|
|
|
+ isFalse(check(data.getName()), "该产线已存在,请重新输入");
|
|
|
+
|
|
|
+
|
|
|
ZZone zZone = BeanPlusUtil.toBean(data, ZZone.class);
|
|
|
//根据编码规则
|
|
|
String no = codeRuleService.getBillCode(CodeRuleModule.CODE_RULE_ZZONE);
|
|
@@ -107,10 +112,21 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
|
|
|
return zZone;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public boolean check(String name) {
|
|
|
+ return super.count(Wraps.<ZZone>lbQ().eq(ZZone::getName,name)) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public ZZone update(ZZoneUpdateDTO data) {
|
|
|
ZZone zZone = BeanPlusUtil.toBean(data, ZZone.class);
|
|
|
+ ZZone oriZone = baseMapper.selectById(zZone.getId());
|
|
|
+ if(!zZone.getName().equals(oriZone.getName())){//修改过名称
|
|
|
+ isFalse(check(data.getName()), "该产线已存在,请重新输入");
|
|
|
+ }
|
|
|
+
|
|
|
updateById(zZone);
|
|
|
|
|
|
return zZone;
|