|
@@ -0,0 +1,84 @@
|
|
|
|
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.yh.saas.common.support.util.IdGenerator;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.WarehousePatrolInspectionInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.mapper.WarehousePatrolInspectionInfoMapper;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IWarehousePatrolInspectionInfoService;
|
|
|
|
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 记录巡检信息 服务实现类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author Gdc
|
|
|
|
+ * @since 2023-07-04
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class WarehousePatrolInspectionInfoServiceImpl extends ServiceImpl<WarehousePatrolInspectionInfoMapper, WarehousePatrolInspectionInfo> implements IWarehousePatrolInspectionInfoService {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public String addInfo(WarehousePatrolInspectionInfo warehousePatrolInspectionInfo) {
|
|
|
|
+ warehousePatrolInspectionInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ boolean one = this.insert(warehousePatrolInspectionInfo);
|
|
|
|
+ if (one) {
|
|
|
|
+ return "OK";
|
|
|
|
+ } else {
|
|
|
|
+ return "NG";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public WarehousePatrolInspectionInfo getInfo(String id) {
|
|
|
|
+ WarehousePatrolInspectionInfo warehousePatrolInspectionInfo=this.selectById(id);
|
|
|
|
+ return warehousePatrolInspectionInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void deleteInfo(String id) {
|
|
|
|
+ WarehousePatrolInspectionInfo warehousePatrolInspectionInfo=this.selectById(id);
|
|
|
|
+ if (warehousePatrolInspectionInfo!=null){
|
|
|
|
+ this.deleteById(warehousePatrolInspectionInfo.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public String editInfo(WarehousePatrolInspectionInfo warehousePatrolInspectionInfo) {
|
|
|
|
+ this.updateById(warehousePatrolInspectionInfo);
|
|
|
|
+ return warehousePatrolInspectionInfo.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<WarehousePatrolInspectionInfo> selectInfo(WarehousePatrolInspectionInfo warehousePatrolInspectionInfo) {
|
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
|
+ pageView.put("startRecord", (warehousePatrolInspectionInfo.getCurrentPage() - 1)
|
|
|
|
+ * warehousePatrolInspectionInfo.getPageSize());
|
|
|
|
+ //公司id
|
|
|
|
+ pageView.put("compId",warehousePatrolInspectionInfo.getCompId());
|
|
|
|
+ pageView.put("warehouseName",warehousePatrolInspectionInfo.getWarehouseName());
|
|
|
|
+ pageView.put("startDate",warehousePatrolInspectionInfo.getStartDate());
|
|
|
|
+ pageView.put("endDate",warehousePatrolInspectionInfo.getEndDate());
|
|
|
|
+ pageView.put("searchKeyWord",warehousePatrolInspectionInfo.getSearchKeyWord());
|
|
|
|
+ pageView.put("pageSize",warehousePatrolInspectionInfo.getPageSize());
|
|
|
|
+ pageView.put("currentPage",warehousePatrolInspectionInfo.getCurrentPage());
|
|
|
|
+ Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
|
|
+ List<WarehousePatrolInspectionInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
|
+ Page<WarehousePatrolInspectionInfo> page = new Page<>();
|
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
|
+ page.setCurrent(warehousePatrolInspectionInfo.getCurrentPage());
|
|
|
|
+ page.setSize(warehousePatrolInspectionInfo.getPageSize());
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+}
|