|
@@ -0,0 +1,79 @@
|
|
|
+package com.usky.fire.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.usky.common.core.bean.CommonPage;
|
|
|
+import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.domain.DemWaterSource;
|
|
|
+import com.usky.fire.mapper.DemWaterSourceMapper;
|
|
|
+import com.usky.fire.service.DemWaterSourceService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 水源信息表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author JCB
|
|
|
+ * @since 2022-10-24
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class DemWaterSourceServiceImpl extends AbstractCrudService<DemWaterSourceMapper, DemWaterSource> implements DemWaterSourceService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonPage<Map<String, Object>> waterSourceList(String waterName, Integer id, Integer pageNum, Integer pageSize) {
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ IPage<DemWaterSource> page = new Page<>(pageNum, pageSize);
|
|
|
+ LambdaQueryWrapper<DemWaterSource> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select()
|
|
|
+ .eq(DemWaterSource::getDeleteFlag, 0)
|
|
|
+ .like(StringUtils.isNotBlank(waterName), DemWaterSource::getWaterName, waterName)
|
|
|
+ .orderByDesc(DemWaterSource::getId);
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
|
|
+ for (int i = 0; i < page.getRecords().size(); i++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("id", page.getRecords().get(i).getId());
|
|
|
+ map.put("waterName", page.getRecords().get(i).getWaterName());
|
|
|
+ map.put("waterAddress", page.getRecords().get(i).getWaterAddress());
|
|
|
+ map.put("waterType", page.getRecords().get(i).getWaterType());
|
|
|
+ map.put("organizateName", page.getRecords().get(i).getOrganizateName());
|
|
|
+ map.put("waterForm", page.getRecords().get(i).getWaterForm());
|
|
|
+ map.put("availableStatusName", page.getRecords().get(i).getAvailableStatusName());
|
|
|
+ map.put("availableStatus", page.getRecords().get(i).getAvailableStatus());
|
|
|
+ map.put("waterNature", page.getRecords().get(i).getWaterNature());
|
|
|
+ map.put("buildTime", page.getRecords().get(i).getBuildTime());
|
|
|
+ map.put("pipeCompany", page.getRecords().get(i).getPipeCompany());
|
|
|
+ map.put("contactMode", page.getRecords().get(i).getContactMode());
|
|
|
+ map.put("fireAbbreviat", page.getRecords().get(i).getFireAbbreviat());
|
|
|
+ map.put("pipePressure", page.getRecords().get(i).getPipePressure());
|
|
|
+ map.put("hydrantInterface", page.getRecords().get(i).getHydrantInterface());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateWaterSource(DemWaterSource demWaterSource){
|
|
|
+ this.updateById(demWaterSource);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delWaterSource(Integer id) {
|
|
|
+ DemWaterSource demWaterSource = new DemWaterSource();
|
|
|
+ demWaterSource.setId(id);
|
|
|
+ demWaterSource.setDeleteFlag("1");
|
|
|
+ this.updateById(demWaterSource);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|