From b4adeadaceaed7cd5b5ae9b785fb375c71a33ecd Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 21 五月 2024 10:04:31 +0800
Subject: [PATCH] #
---
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/DocTypeServiceImpl.java | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/DocTypeServiceImpl.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/DocTypeServiceImpl.java
index fa68c2c..98ab54c 100644
--- a/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/DocTypeServiceImpl.java
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/DocTypeServiceImpl.java
@@ -1,12 +1,46 @@
package com.zy.asrs.common.wms.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.common.wms.mapper.DocTypeMapper;
import com.zy.asrs.common.wms.entity.DocType;
import com.zy.asrs.common.wms.service.DocTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.framework.exception.CoolException;
import org.springframework.stereotype.Service;
+
+import java.util.Date;
@Service("docTypeService")
public class DocTypeServiceImpl extends ServiceImpl<DocTypeMapper, DocType> implements DocTypeService {
+ @Override
+ public DocType selectOrAdd(String docName, Boolean pakin) {
+ if (Cools.isEmpty(docName)) {
+ return null;
+ }
+ DocType docType = this.getOne(new LambdaQueryWrapper<DocType>().eq(DocType::getDocName, docName));
+ if (docType == null) {
+ long docId = 1L;
+ DocType last = this.getOne(new LambdaQueryWrapper<DocType>().orderByDesc(DocType::getDocId));
+ if (last != null) {
+ docId = last.getDocId() + 1;
+ }
+ docType = new DocType();
+ docType.setDocId(docId);
+ docType.setDocName(docName);
+ if (null != pakin) {
+ docType.setPakin(pakin ? 1 : 0);
+ docType.setPakout(pakin ? 0 : 1);
+ }
+ docType.setStatus(1);
+ docType.setCreateTime(new Date());
+ docType.setUpdateTime(new Date());
+ if (!this.save(docType)) {
+ throw new CoolException("鍗曟嵁绫诲瀷閿欒");
+ }
+ }
+ return docType;
+ }
+
}
--
Gitblit v1.9.1