Ver código fonte

消防水源管理相关接口开发

jichaobo 2 anos atrás
pai
commit
bf18505516

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java

@@ -71,7 +71,7 @@ public class MybatisGeneratorUtils {
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表
-        strategy.setInclude("dem_micro_station");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("dem_water_source");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 71 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemWaterSourceController.java

@@ -0,0 +1,71 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.log.annotation.Log;
+import com.usky.common.log.enums.BusinessType;
+import com.usky.fire.domain.DemWaterSource;
+import com.usky.fire.service.DemWaterSourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 水源信息表 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-24
+ */
+@RestController
+@RequestMapping("/demWaterSource")
+public class DemWaterSourceController {
+
+    @Autowired
+    private DemWaterSourceService demWaterSourceService;
+
+    /**
+     * 消防水源管理-列表
+     *
+     * @param waterName 水源名称
+     * @param id        主键ID
+     * @param pageNum   当前页
+     * @param pageSize  每页条数
+     * @return
+     */
+    @GetMapping("waterSourceList")
+    public ApiResult<CommonPage<Map<String, Object>>> waterSourceList(@RequestParam(value = "waterName", required = false) String waterName,
+                                                                      @RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
+                                                                      @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+                                                                      @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(demWaterSourceService.waterSourceList(waterName, id, pageNum, pageSize));
+    }
+
+    /**
+     * 消防水源管理-修改
+     *
+     * @param demWaterSource
+     */
+    @Log(title = "消防水源管理-修改", businessType = BusinessType.UPDATE)
+    @PutMapping("updateWaterSource")
+    public ApiResult<Void> updateWaterSource(@RequestBody DemWaterSource demWaterSource) {
+        demWaterSourceService.updateWaterSource(demWaterSource);
+        return ApiResult.success();
+    }
+
+    /**
+     * 消防水源管理-删除
+     *
+     * @param id 主键ID
+     */
+    @Log(title = "消防水源管理-删除", businessType = BusinessType.DELETE)
+    @DeleteMapping("delWaterSource")
+    public ApiResult<Void> delWaterSource(@RequestParam(value = "id") Integer id) {
+        demWaterSourceService.delWaterSource(id);
+        return ApiResult.success();
+    }
+}
+

+ 226 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemWaterSource.java

@@ -0,0 +1,226 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 水源信息表
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DemWaterSource implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * ID;
+     */
+    private String waterId;
+
+    /**
+     * 水源名称;
+     */
+    private String waterName;
+
+    /**
+     * 水源地址;
+     */
+    private String waterAddress;
+
+    /**
+     * 水源类型代码;
+     */
+    private String waterTypeCode;
+
+    /**
+     * 水源类型;
+     */
+    private String waterType;
+
+    /**
+     * 机构ID;
+     */
+    private String organizateId;
+
+    /**
+     * 管辖机构名称;
+     */
+    private String organizateName;
+
+    /**
+     * 取水形式;
+     */
+    private String waterForm;
+
+    /**
+     * 可用状态;
+     */
+    private Integer availableStatus;
+
+    /**
+     * 可用状态名称;
+     */
+    private String availableStatusName;
+
+    /**
+     * 性质;
+     */
+    private String nature;
+
+    /**
+     * 水源性质;
+     */
+    private String waterNature;
+
+    /**
+     * GIS_X;
+     */
+    private String gisX;
+
+    /**
+     * GIS_Y;
+     */
+    private String gisY;
+
+    /**
+     * 建造时间;
+     */
+    private LocalDateTime buildTime;
+
+    /**
+     * 记录状态;
+     */
+    private Integer recordStatus;
+
+    /**
+     * SJC;
+     */
+    private String sjc;
+
+    /**
+     * BZ;
+     */
+    private String remark;
+
+    /**
+     * GIS_X百度坐标;
+     */
+    private String gisXBaidu;
+
+    /**
+     * GIS_Y百度坐标;
+     */
+    private String gisYBaidu;
+
+    /**
+     * 管网单位;
+     */
+    private String pipeCompany;
+
+    /**
+     * 设置形式;
+     */
+    private String setForm;
+
+    /**
+     * 消火栓设置形式;
+     */
+    private String hydrantSetForm;
+
+    /**
+     * 联系方式;
+     */
+    private String contactMode;
+
+    /**
+     * 管网形式;
+     */
+    private String pipeForm;
+
+    /**
+     * 管网供水形式;
+     */
+    private String pipeWater;
+
+    /**
+     * 管网直径;
+     */
+    private String pipeDiameter;
+
+    /**
+     * 管网压力;
+     */
+    private String pipePressure;
+
+    /**
+     * 接口形式;
+     */
+    private Integer interfaceForm;
+
+    /**
+     * 消火栓接口形式;
+     */
+    private String hydrantInterface;
+
+    /**
+     * 供水单位;
+     */
+    private String waterCompany;
+
+    /**
+     * 消防名称;
+     */
+    private String fireName;
+
+    /**
+     * 消防站简称;
+     */
+    private String fireAbbreviat;
+
+    /**
+     * 支队ID;
+     */
+    private String branchId;
+
+    /**
+     * 支队名称;
+     */
+    private String branchName;
+
+    /**
+     * 支队简称;
+     */
+    private String branchAbbreviat;
+
+    /**
+     * BDP_AUDIT;
+     */
+    private LocalDateTime bdpAudit;
+
+    /**
+     * unionKey;
+     */
+    private String unionKey;
+
+    /**
+     * 删除标识
+     */
+    private String deleteFlag;
+
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/DemWaterSourceMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.DemWaterSource;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 水源信息表 Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-24
+ */
+public interface DemWaterSourceMapper extends CrudMapper<DemWaterSource> {
+
+}

+ 43 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemWaterSourceService.java

@@ -0,0 +1,43 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.domain.DemWaterSource;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 水源信息表 服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-24
+ */
+public interface DemWaterSourceService extends CrudService<DemWaterSource> {
+
+    /**
+     * 消防水源管理-列表
+     *
+     * @param waterName 水源名称
+     * @param id        主键ID
+     * @param pageNum   当前页
+     * @param pageSize  每页条数
+     * @return
+     */
+    CommonPage<Map<String, Object>> waterSourceList(String waterName, Integer id, Integer pageNum, Integer pageSize);
+
+    /**
+     * 消防水源管理-修改
+     *
+     * @param demWaterSource
+     */
+    void updateWaterSource(DemWaterSource demWaterSource);
+
+    /**
+     * 消防水源管理-删除
+     *
+     * @param id 主键ID
+     */
+    void delWaterSource(Integer id);
+}

+ 79 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemWaterSourceServiceImpl.java

@@ -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);
+    }
+
+}

+ 49 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/DemWaterSourceMapper.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.fire.mapper.DemWaterSourceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.DemWaterSource">
+        <id column="id" property="id" />
+        <result column="water_id" property="waterId" />
+        <result column="water_name" property="waterName" />
+        <result column="water_address" property="waterAddress" />
+        <result column="water_type_code" property="waterTypeCode" />
+        <result column="water_type" property="waterType" />
+        <result column="organizate_id" property="organizateId" />
+        <result column="organizate_name" property="organizateName" />
+        <result column="water_form" property="waterForm" />
+        <result column="available_status" property="availableStatus" />
+        <result column="available_status_name" property="availableStatusName" />
+        <result column="nature" property="nature" />
+        <result column="water_nature" property="waterNature" />
+        <result column="gis_x" property="gisX" />
+        <result column="gis_y" property="gisY" />
+        <result column="build_time" property="buildTime" />
+        <result column="record_status" property="recordStatus" />
+        <result column="sjc" property="sjc" />
+        <result column="remark" property="remark" />
+        <result column="gis_x_baidu" property="gisXBaidu" />
+        <result column="gis_y_baidu" property="gisYBaidu" />
+        <result column="pipe_company" property="pipeCompany" />
+        <result column="set_form" property="setForm" />
+        <result column="hydrant_set_form" property="hydrantSetForm" />
+        <result column="contact_mode" property="contactMode" />
+        <result column="pipe_form" property="pipeForm" />
+        <result column="pipe_water" property="pipeWater" />
+        <result column="pipe_diameter" property="pipeDiameter" />
+        <result column="pipe_pressure" property="pipePressure" />
+        <result column="interface_form" property="interfaceForm" />
+        <result column="hydrant_interface" property="hydrantInterface" />
+        <result column="water_company" property="waterCompany" />
+        <result column="fire_name" property="fireName" />
+        <result column="fire_abbreviat" property="fireAbbreviat" />
+        <result column="branch_id" property="branchId" />
+        <result column="branch_name" property="branchName" />
+        <result column="branch_abbreviat" property="branchAbbreviat" />
+        <result column="bdp_audit" property="bdpAudit" />
+        <result column="union_key" property="unionKey" />
+        <result column="delete_flag" property="deleteFlag" />
+    </resultMap>
+
+</mapper>