Quellcode durchsuchen

消防水源管理-天然水源维护相关接口开发

jichaobo vor 2 Jahren
Ursprung
Commit
57ea554224

+ 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_water_source");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("dem_headwaters_source_maintain");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 81 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemWaterSourceMaintainController.java

@@ -0,0 +1,81 @@
+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.DemWaterSourceMaintain;
+import com.usky.fire.service.DemWaterSourceMaintainService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 天然水源信息表 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-25
+ */
+@RestController
+@RequestMapping("/demWaterSourceMaintain")
+public class DemWaterSourceMaintainController {
+
+    @Autowired
+    private DemWaterSourceMaintainService demWaterSourceMaintainService;
+
+    /**
+     * 消防水源管理-天然水源维护-列表
+     *
+     * @param squadron 所属中队
+     * @param id       主键ID
+     * @param pageNum  当前页面
+     * @param pageSize 每页条数
+     * @return
+     */
+    @GetMapping("waterSourceMaintainList")
+    public ApiResult<CommonPage<DemWaterSourceMaintain>> waterSourceMaintainList(@RequestParam(value = "squadron", required = false) String squadron,
+                                                                                 @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(demWaterSourceMaintainService.waterSourceMaintainList(squadron, id, pageNum, pageSize));
+    }
+
+    /**
+     * 消防水源管理-天然水源维护-新增
+     *
+     * @param demWaterSourceMaintain
+     */
+    @Log(title = "消防水源管理-天然水源维护-新增", businessType = BusinessType.INSERT)
+    @PostMapping("addWaterSourceMaintain")
+    public ApiResult<Void> addWaterSourceMaintain(@RequestBody DemWaterSourceMaintain demWaterSourceMaintain) {
+        demWaterSourceMaintainService.addWaterSourceMaintain(demWaterSourceMaintain);
+        return ApiResult.success();
+    }
+
+    /**
+     * 消防水源管理-天然水源维护-修改
+     *
+     * @param demWaterSourceMaintain
+     */
+    @Log(title = "消防水源管理-天然水源维护-修改", businessType = BusinessType.UPDATE)
+    @PutMapping("updateWaterSourceMaintain")
+    public ApiResult<Void> updateWaterSourceMaintain(@RequestBody DemWaterSourceMaintain demWaterSourceMaintain) {
+        demWaterSourceMaintainService.updateWaterSourceMaintain(demWaterSourceMaintain);
+        return ApiResult.success();
+    }
+
+    /**
+     * 消防水源管理-天然水源维护-删除
+     *
+     * @param id 主键ID
+     */
+    @Log(title = "消防水源管理-天然水源维护-删除", businessType = BusinessType.DELETE)
+    @DeleteMapping("delWaterSourceMaintain")
+    public ApiResult<Void> delWaterSourceMaintain(@RequestParam(value = "id") Integer id) {
+        demWaterSourceMaintainService.delWaterSourceMaintain(id);
+        return ApiResult.success();
+    }
+}
+

+ 73 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemWaterSourceMaintain.java

@@ -0,0 +1,73 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+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-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DemWaterSourceMaintain implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 支队
+     */
+    private String detachment;
+
+    /**
+     * 中队
+     */
+    private String squadron;
+
+    /**
+     * 取水点位置描述
+     */
+    @TableField(value = "`describe`")
+    private String describe;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 更新人
+     */
+    private String updatePerson;
+
+    /**
+     * 删除标识
+     */
+    private String deleteFlag;
+
+
+}

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

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

+ 48 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemWaterSourceMaintainService.java

@@ -0,0 +1,48 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.domain.DemWaterSourceMaintain;
+
+/**
+ * <p>
+ * 天然水源信息表 服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-25
+ */
+public interface DemWaterSourceMaintainService extends CrudService<DemWaterSourceMaintain> {
+
+    /**
+     * 消防水源管理-天然水源维护-列表
+     *
+     * @param squadron 所属中队
+     * @param id       主键ID
+     * @param pageNum  当前页面
+     * @param pageSize 每页条数
+     * @return
+     */
+    CommonPage<DemWaterSourceMaintain> waterSourceMaintainList(String squadron, Integer id, Integer pageNum, Integer pageSize);
+
+    /**
+     * 消防水源管理-天然水源维护-新增
+     *
+     * @param demWaterSourceMaintain
+     */
+    void addWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain);
+
+    /**
+     * 消防水源管理-天然水源维护-修改
+     *
+     * @param demWaterSourceMaintain
+     */
+    void updateWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain);
+
+    /**
+     * 消防水源管理-天然水源维护-删除
+     *
+     * @param id 主键ID
+     */
+    void delWaterSourceMaintain(Integer id);
+}

+ 65 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemWaterSourceMaintainServiceImpl.java

@@ -0,0 +1,65 @@
+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.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.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.DemWaterSourceMaintain;
+import com.usky.fire.mapper.DemWaterSourceMaintainMapper;
+import com.usky.fire.service.DemWaterSourceMaintainService;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * <p>
+ * 天然水源信息表 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-10-25
+ */
+@Service
+public class DemWaterSourceMaintainServiceImpl extends AbstractCrudService<DemWaterSourceMaintainMapper, DemWaterSourceMaintain> implements DemWaterSourceMaintainService {
+
+    @Override
+    public CommonPage<DemWaterSourceMaintain> waterSourceMaintainList(String squadron, Integer id, Integer pageNum, Integer pageSize) {
+        IPage<DemWaterSourceMaintain> page = new Page<>(pageNum, pageSize);
+        LambdaQueryWrapper<DemWaterSourceMaintain> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DemWaterSourceMaintain::getDeleteFlag, "0")
+                .like(StringUtils.isNotBlank(squadron), DemWaterSourceMaintain::getSquadron, squadron)
+                .eq(id != 0 && id != null, DemWaterSourceMaintain::getId, id)
+                .orderByDesc(DemWaterSourceMaintain::getId);
+        List<DemWaterSourceMaintain> list = this.list(queryWrapper);
+        page = this.page(page, queryWrapper);
+        return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
+    }
+
+    @Override
+    public void addWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain) {
+        demWaterSourceMaintain.setCreator(SecurityUtils.getUsername());
+        demWaterSourceMaintain.setCreateTime(LocalDateTime.now());
+        demWaterSourceMaintain.setDeleteFlag("0");
+        this.save(demWaterSourceMaintain);
+    }
+
+    @Override
+    public void updateWaterSourceMaintain(DemWaterSourceMaintain demWaterSourceMaintain) {
+        demWaterSourceMaintain.setUpdateTime(LocalDateTime.now());
+        demWaterSourceMaintain.setUpdatePerson(SecurityUtils.getUsername());
+        this.updateById(demWaterSourceMaintain);
+    }
+
+    @Override
+    public void delWaterSourceMaintain(Integer id) {
+        DemWaterSourceMaintain demWaterSourceMaintain = new DemWaterSourceMaintain();
+        demWaterSourceMaintain.setId(id);
+        demWaterSourceMaintain.setDeleteFlag("1");
+        this.updateById(demWaterSourceMaintain);
+    }
+}

+ 18 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/DemWaterSourceMaintainMapper.xml

@@ -0,0 +1,18 @@
+<?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.DemWaterSourceMaintainMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.DemWaterSourceMaintain">
+        <id column="id" property="id" />
+        <result column="detachment" property="detachment" />
+        <result column="squadron" property="squadron" />
+        <result column="describe" property="describe" />
+        <result column="create_time" property="createTime" />
+        <result column="creator" property="creator" />
+        <result column="update_time" property="updateTime" />
+        <result column="update_person" property="updatePerson" />
+        <result column="delete_flag" property="deleteFlag" />
+    </resultMap>
+
+</mapper>