|
@@ -0,0 +1,87 @@
|
|
|
+package com.abi.qms.platform.service.impl;
|
|
|
+
|
|
|
+import com.abi.qms.platform.dao.entity.BreweryProductionLine;
|
|
|
+import com.abi.qms.platform.dao.mapper.BreweryProductionLineMapper;
|
|
|
+import com.abi.qms.platform.dto.req.DeleteBreweryProductionLineReq;
|
|
|
+import com.abi.qms.platform.dto.req.QueryListBreweryProductionLineReq;
|
|
|
+import com.abi.qms.platform.dto.req.SaveBreweryProductionLineReq;
|
|
|
+import com.abi.qms.platform.dto.res.QueryListBreweryProductionLineRes;
|
|
|
+import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
+import com.abi.qms.platform.service.BreweryProductionLineService;
|
|
|
+import com.abi.task.common.api.exception.BusinessException;
|
|
|
+import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lu
|
|
|
+ * @date 2021年06月09日 14:04
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class BreweryProductionLineServiceImpl implements BreweryProductionLineService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BreweryProductionLineMapper breweryProductionLineMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增接口
|
|
|
+ * @author lu
|
|
|
+ * @date 2021/6/9 14:38
|
|
|
+ * @param req
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void saveBreweryProductionLine(SaveBreweryProductionLineReq req) {
|
|
|
+ QueryWrapper<BreweryProductionLine> insert = new QueryWrapper<>();
|
|
|
+ insert.eq("production_line_name",req.getProductionLineName());
|
|
|
+ insert.eq("user_id",req.getUserId());
|
|
|
+ insert.eq("is_delete",0);
|
|
|
+ //该用户下的产线名 不可以重复
|
|
|
+ Integer count = breweryProductionLineMapper.selectCount(insert);
|
|
|
+ if (!count.equals(0)) {
|
|
|
+ throw new BusinessException("产线名称已存在");
|
|
|
+ }
|
|
|
+ BreweryProductionLine parameter = new BreweryProductionLine();
|
|
|
+ parameter.setBeerFactoryId(req.getBeerFactoryId());
|
|
|
+ parameter.setUserId(req.getUserId());
|
|
|
+ parameter.setUserName(req.getUserName());
|
|
|
+ parameter.setProductionLineName(req.getProductionLineName());
|
|
|
+ breweryProductionLineMapper.insert(parameter);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增接口
|
|
|
+ * @author lu
|
|
|
+ * @date 2021/6/9 14:38
|
|
|
+ * @param req
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void deleteBreweryProductionLine(DeleteBreweryProductionLineReq req) {
|
|
|
+ BreweryProductionLine breweryProductionLine = breweryProductionLineMapper.selectById(req.getId());
|
|
|
+ AssertUtil.isNull(breweryProductionLine,"产线信息不存在");
|
|
|
+ breweryProductionLine.setIsDelete(1);
|
|
|
+ breweryProductionLineMapper.updateById(breweryProductionLine);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询当前登陆人的产线列表
|
|
|
+ * @author lu
|
|
|
+ * @date 2021/6/9 14:52
|
|
|
+ * @param req
|
|
|
+ * @return com.abi.qms.platform.dto.res.QueryListBreweryProductionLineRes
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public QueryListBreweryProductionLineRes queryListBreweryProductionLine(QueryListBreweryProductionLineReq req) {
|
|
|
+ QueryWrapper<BreweryProductionLine> query = new QueryWrapper<>();
|
|
|
+ query.eq("user_id",req.getUserId());
|
|
|
+ query.eq("is_delete",0);
|
|
|
+ List<BreweryProductionLine> breweryProductionLines = breweryProductionLineMapper.selectList(query);
|
|
|
+ //封装出参
|
|
|
+ QueryListBreweryProductionLineRes res = new QueryListBreweryProductionLineRes();
|
|
|
+ List<QueryListBreweryProductionLineRes.BreweryProductionLineBean> breweryProductionLineBeans = PojoConverterUtils.copyList(breweryProductionLines, QueryListBreweryProductionLineRes.BreweryProductionLineBean.class);
|
|
|
+ res.setRoleBeanList(breweryProductionLineBeans);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+}
|