|  |  |  | 
|---|
|  |  |  | public class DocTypeServiceImpl extends ServiceImpl<DocTypeMapper, DocType> implements DocTypeService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public DocType selectOrAdd(String docName) { | 
|---|
|  |  |  | @Deprecated | 
|---|
|  |  |  | public DocType selectOrAdd(String docName, Boolean pakin) { | 
|---|
|  |  |  | if (Cools.isEmpty(docName)) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.insert(docType)) { | 
|---|
|  |  |  | throw new CoolException("单据类型错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return docType; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public DocType selectOrAdd(String docName, String dccType, Boolean pakin) { | 
|---|
|  |  |  | if (Cools.isEmpty(docName) || Cools.isEmpty(docName)) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DocType docType = this.selectOne(new EntityWrapper<DocType>().eq("doc_code", dccType)); | 
|---|
|  |  |  | if (docType == null) { | 
|---|
|  |  |  | long docId = 1L; | 
|---|
|  |  |  | DocType last = this.selectOne(new EntityWrapper<DocType>().orderBy("doc_id", false)); | 
|---|
|  |  |  | if (last != null) { | 
|---|
|  |  |  | docId = last.getDocId() + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | docType = new DocType(); | 
|---|
|  |  |  | docType.setDocId(docId); | 
|---|
|  |  |  | docType.setDocName(docName); | 
|---|
|  |  |  | docType.setDocCode(dccType); | 
|---|
|  |  |  | if (null != pakin) { | 
|---|
|  |  |  | docType.setPakin(pakin ? 1 : 0); | 
|---|
|  |  |  | docType.setPakout(pakin ? 0 : 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | docType.setStatus(1); | 
|---|
|  |  |  | docType.setCreateTime(new Date()); | 
|---|
|  |  |  | docType.setUpdateTime(new Date()); | 
|---|