|
@@ -0,0 +1,78 @@
|
|
|
+package com.huimv.production.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import com.huimv.production.domain.MOperationAnalysis;
|
|
|
+import com.huimv.production.repo.MOperationAnalysisRepository;
|
|
|
+import com.huimv.production.result.Result;
|
|
|
+import com.huimv.production.result.ResultStatus;
|
|
|
+import com.huimv.production.service.MOperationAnalysisService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Service
|
|
|
+@DS("thired")
|
|
|
+public class MOperationAnalysisServiceImpl implements MOperationAnalysisService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MOperationAnalysisRepository rep;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result add(MOperationAnalysis entity){
|
|
|
+ if (entity == null){
|
|
|
+ return new Result(10002, ResultStatus.addNull);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ rep.save(entity);
|
|
|
+ return new Result(10000,ResultStatus.addSuccess);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new Result(10001,ResultStatus.addFailed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result remove(Integer[] ids) {
|
|
|
+ if (ids == null || ids.length==0){
|
|
|
+ return new Result(10002,ResultStatus.deleteNull);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ for (Integer id : ids) {
|
|
|
+ rep.deleteById(id);
|
|
|
+ }
|
|
|
+ return new Result(10000,ResultStatus.deleteSuccess);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new Result(10001,ResultStatus.deleteFailed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result update(MOperationAnalysis entity) {
|
|
|
+ if (entity == null){
|
|
|
+ return new Result(10002,ResultStatus.updateNull);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ rep.save(entity);
|
|
|
+ return new Result(10000,ResultStatus.updateSuccess);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new Result(10001,ResultStatus.updateFailed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result findAll() {
|
|
|
+ return new Result(10000,ResultStatus.findSuccess,rep.findAll());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result findAllById(Integer id) {
|
|
|
+ try {
|
|
|
+ MOperationAnalysis entity = rep.findById(id).get();
|
|
|
+ return new Result(10000,ResultStatus.findSuccess,entity);
|
|
|
+ }catch (Exception e){
|
|
|
+ return new Result(10001,ResultStatus.findFailed,null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|