feat(kangzai): 新增河流县区段信息表相关功能

master
fangjiakai 2025-06-16 11:50:52 +08:00
parent e7c885a541
commit 84560e6527
15 changed files with 368 additions and 5 deletions

View File

@ -0,0 +1,74 @@
package com.zcloud.modules.kangzai.controller;
import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.modules.kangzai.entity.BusRiverSectionsStreetEntity;
import com.zcloud.modules.kangzai.service.BusRiverSectionsStreetService;
import com.zcloud.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
/**
* @Author fangjiakai
* @Desc (BusRiverSectionsStreet)
* @Date 2025-06-12 17:14:57
*/
@Api(tags = "河流县区段信息表")
@RestController
@RequestMapping("busRiverSectionsStreet")
public class BusRiverSectionsStreetController extends AbstractController {
@Autowired
private BusRiverSectionsStreetService busRiverSectionsStreetService;
@ApiOperation("河流县区段信息表-新增数据")
@SysLog("河流县区段信息表-新增数据")
@PostMapping("/save")
public R insert(@RequestBody BusRiverSectionsStreetEntity param) {
busRiverSectionsStreetService.save(param);
return R.ok();
}
@ApiOperation("河流县区段信息表-编辑数据")
@SysLog("河流县区段信息表-编辑数据")
@PostMapping("/update")
public R update(@RequestBody BusRiverSectionsStreetEntity param) {
busRiverSectionsStreetService.updateById(param);
return R.ok();
}
@ApiOperation("河流县区段信息表-删除数据")
@SysLog("河流县区段信息表-删除数据")
@PostMapping("/delete")
public R delete(@RequestBody BusRiverSectionsStreetEntity param) {
busRiverSectionsStreetService.delete(param.getRiverSectionsStreetId(),getUserId());
return R.ok();
}
@ApiOperation("河流县区段信息表-分页查询")
@SysLog("河流县区段信息表-分页查询")
@PostMapping("/listPage")
public R listPage(@RequestBody Map<String, Object> params) {
PageUtils page = busRiverSectionsStreetService.listPage(params);
return R.ok().put("page", page);
}
@ApiOperation("河流县区段信息表-根据ID查详情")
@SysLog("河流县区段信息表-根据ID查详情")
@PostMapping("/info")
public R info(@RequestBody BusRiverSectionsStreetEntity param) {
BusRiverSectionsStreetEntity busRiverSectionsStreet = busRiverSectionsStreetService.getById(param.getRiverSectionsStreetId());
return R.ok().put("busRiverSectionsStreet", busRiverSectionsStreet);
}
}

View File

@ -78,7 +78,7 @@ public class Mapcontroller extends AbstractController {
@RequestMapping("/mountainFloodVillage")
public R mountainFloodVillage() {
List<BusMountainFloodVillageEntity> list = busMountainFloodVillageService.queryListByFlexibleParams("is_delete",0);
List<SysDictionariesEntity> sysDictionaries = sysDictionariesService.queryListParentId("e72d17163f3b4045a2f1eef8e55ea835");
List<SysDictionariesEntity> sysDictionaries = sysDictionariesService.queryListParentId("3faa58f95b2d482787ed29c9ec176fbf");
Map<String, String> dictMap = new HashMap<>();
for (SysDictionariesEntity entity : sysDictionaries) {
@ -150,7 +150,7 @@ public class Mapcontroller extends AbstractController {
@RequestMapping("/emergencyStorage")
public R emergencyStorage() {
List<BusEmergencyStorageEntity> list = busEmergencyStorageService.queryListByFlexibleParams("is_delete",0);
List<SysDictionariesEntity> sysDictionaries = sysDictionariesService.queryListParentId("e72d17163f3b4045a2f1eef8e55ea835");
List<SysDictionariesEntity> sysDictionaries = sysDictionariesService.queryListParentId("3faa58f95b2d482787ed29c9ec176fbf");
Map<String, String> dictMap = new HashMap<>();
for (SysDictionariesEntity entity : sysDictionaries) {

View File

@ -0,0 +1,22 @@
package com.zcloud.modules.kangzai.dao;
import com.zcloud.modules.kangzai.entity.BusRiverSectionsStreetEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* @Author fangjiakai
* @Desc (BusRiverSectionsStreet)访
* @Date 2025-06-12 17:14:57
*/
@Mapper
public interface BusRiverSectionsStreetDao extends BaseMapper<BusRiverSectionsStreetEntity> {
/**
*
*/
IPage<BusRiverSectionsStreetEntity> listPage(@Param("page") Page<Map<String,Object>> page,@Param("params") Map<String, Object> params);
}

View File

@ -43,12 +43,21 @@ public class BusRiverRiskVillagesEntity implements Serializable {
//地区
@ApiModelProperty(value = "地区")
private String areaName;
// 灾害涉及人员数
@ApiModelProperty(value = "灾害涉及人员数")
private Integer involvedPersonnelNum;
//隐患等级(1-低风险,2-中风险,3-高风险)
@ApiModelProperty(value = "隐患等级(1-低风险,2-中风险,3-高风险)")
private Integer riskLevel;
//隐患描述(如:堤防薄弱、河道淤积)
@ApiModelProperty(value = "隐患描述(如:堤防薄弱、河道淤积)")
private String riskDescription;
//经度
@ApiModelProperty(value = "经度")
private Double longitude;
//纬度
@ApiModelProperty(value = "纬度")
private Double latitude;
//是否删除
@ApiModelProperty(value = "是否删除")
@TableField(fill = FieldFill.INSERT)

View File

@ -0,0 +1,73 @@
package com.zcloud.modules.kangzai.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author fangjiakai
* @Desc (BusRiverSectionsStreet)
* @Date 2025-06-12 17:14:57
*/
@Data
@TableName("bus_river_sections_street")
public class BusRiverSectionsStreetEntity implements Serializable {
private static final long serialVersionUID = -37823698486825338L;
//河段ID
@ApiModelProperty(value = "河段ID")
@TableId
private String riverSectionsStreetId;
//关联河流ID
@ApiModelProperty(value = "关联河流ID")
private String riverId;
//县区段长度km
@ApiModelProperty(value = "县区段长度km")
private Double sectionLength;
//最小河宽m
@ApiModelProperty(value = "最小河宽m")
private Double riverWidthMin;
//最大河宽m
@ApiModelProperty(value = "最大河宽m")
private Double riverWidthMax;
//平均河宽m
@ApiModelProperty(value = "平均河宽m")
private Double riverWidthAvg;
//河段特征描述
@ApiModelProperty(value = "河段特征描述")
private String sectionDescription;
//省(字典)
@ApiModelProperty(value = "省(字典)")
private String province;
//区行政编码
@ApiModelProperty(value = "区行政编码")
private String county;
//市(字典)
@ApiModelProperty(value = "市(字典)")
private String city;
//村庄行政编码
@ApiModelProperty(value = "村庄行政编码")
private String village;
//街(字典)
@ApiModelProperty(value = "街(字典)")
private String street;
//区名称
@ApiModelProperty(value = "区名称")
private String areaName;
//经度
@ApiModelProperty(value = "经度")
private Double longitude;
//纬度
@ApiModelProperty(value = "纬度")
private Double latitude;
//是否删除
@ApiModelProperty(value = "是否删除")
@TableField(fill = FieldFill.INSERT)
private Integer isDelete;
}

View File

@ -0,0 +1,31 @@
package com.zcloud.modules.kangzai.service;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.modules.kangzai.entity.BusRiverSectionsStreetEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
* @Author fangjiakai
* @Desc (BusRiverSectionsStreet)
* @Date 2025-06-12 17:14:57
*/
public interface BusRiverSectionsStreetService extends IService<BusRiverSectionsStreetEntity> {
BusRiverSectionsStreetEntity queryByFlexibleParams(String paramName, Object paramValue);
List<BusRiverSectionsStreetEntity> queryListByFlexibleParams(String paramName, Object paramValue);
/**
*
*/
PageUtils listPage(Map<String, Object> params);
/**
*
*/
void delete(String riverSectionsStreetId,String userId);
}

View File

@ -0,0 +1,60 @@
package com.zcloud.modules.kangzai.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.modules.kangzai.dao.BusRiverSectionsStreetDao;
import com.zcloud.modules.kangzai.entity.BusRiverSectionsStreetEntity;
import com.zcloud.modules.kangzai.service.BusRiverSectionsStreetService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Map;
/**
* @Author fangjiakai
* @Desc (BusRiverSectionsStreet)
* @Date 2025-06-12 17:14:57
*/
@Service("busRiverSectionsStreetService")
public class BusRiverSectionsStreetServiceImpl extends ServiceImpl<BusRiverSectionsStreetDao, BusRiverSectionsStreetEntity> implements BusRiverSectionsStreetService {
@Override
public BusRiverSectionsStreetEntity queryByFlexibleParams(String paramName, Object paramValue) {
QueryWrapper<BusRiverSectionsStreetEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(paramName, paramValue); // 根据传入的参数名和参数值动态构建查询条件
return baseMapper.selectOne(queryWrapper);
}
@Override
public List<BusRiverSectionsStreetEntity> queryListByFlexibleParams(String paramName, Object paramValue) {
QueryWrapper<BusRiverSectionsStreetEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(paramName, paramValue); // 根据传入的参数名和参数值动态构建查询条件
return baseMapper.selectList(queryWrapper);
}
@Override
public PageUtils listPage(Map<String, Object> params) {
Page<Map<String,Object>> page = new Page<>(Integer.parseInt(params.get("curPage").toString()),Integer.parseInt(params.get("limit").toString()));
params.put("isDelete",0);
IPage<BusRiverSectionsStreetEntity> ipage = baseMapper.listPage(page,params);
return new PageUtils(ipage);
}
@Override
public void delete(String riverSectionsStreetId,String userId){
UpdateWrapper<BusRiverSectionsStreetEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("river_sections_street_id",riverSectionsStreetId);
BusRiverSectionsStreetEntity busRiverSectionsStreet = new BusRiverSectionsStreetEntity();
busRiverSectionsStreet.setIsDelete(1);
this.update(busRiverSectionsStreet, updateWrapper);
}
}

View File

@ -130,5 +130,12 @@ public class SysDictionariesController extends AbstractController {
dictionaries = sysDictionariesService.getById(dictionaries.getDictionariesId());
return R.ok().put("dictionaries", dictionaries);
}
@PostMapping("/init")
//@RequiresPermission("sys:dictionaries:info")
public R init(){
sysDictionariesService.importAreaFromJson();
return R.ok();
}
}

View File

@ -23,4 +23,6 @@ public interface SysDictionariesDao extends BaseMapper<SysDictionariesEntity> {
String getRecurrenceIds(String id);
List<SysDictionariesEntity> cteldAll(String parentId);
void deleteCte(String parentId);
}

View File

@ -160,7 +160,7 @@ public class SysDictionariesServiceImpl extends ServiceImpl<SysDictionariesDao,
SysDictionariesEntity spd = new SysDictionariesEntity();
spd.setDictionariesId(get32UUID()); //主键
spd.setName(street.getString("label"));
spd.setBianma(street.getString("value").substring(0,9));
spd.setBianma(street.getString("value"));
spd.setOrderBy(vorder);
spd.setParentId(vpd.getDictionariesId());
save(spd);

View File

@ -3,9 +3,9 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:33068/qa_mine?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf-8
url: jdbc:mysql://127.0.0.1:33080/qa_kangzai?serverTimezone=Asia/Shanghai&useSSL=true&useUnicode=true&characterEncoding=utf-8
username: root
password: Mysql@zcloud2025
password: Mysql@zcloud33080
initial-size: 10
max-active: 100
min-idle: 10

View File

@ -35,6 +35,9 @@
<if test="params.riskDescription != null and params.riskDescription != ''">
AND t.risk_description = #{params.riskDescription}
</if>
<if test="params.isDelete != null">
AND t.is_delete = #{params.isDelete}
</if>
</where>
ORDER BY t.village
</select>

View File

@ -38,6 +38,9 @@
<if test="params.sectionDescription != null and params.sectionDescription != ''">
AND t.section_description = #{params.sectionDescription}
</if>
<if test="params.isDelete != null">
AND t.is_delete = #{params.isDelete}
</if>
</where>
ORDER BY t.county DESC
</select>

View File

@ -0,0 +1,62 @@
<?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.zcloud.modules.kangzai.dao.BusRiverSectionsStreetDao">
<!--分页查询-->
<select id="listPage" resultType="com.zcloud.modules.kangzai.entity.BusRiverSectionsStreetEntity">
SELECT
t.*
FROM bus_river_sections_street t
<where>
<if test="params.riverSectionsStreetId != null and params.riverSectionsStreetId != ''">
AND t.river_sections_street_id = #{params.riverSectionsStreetId}
</if>
<if test="params.riverId != null and params.riverId != ''">
AND t.river_id = #{params.riverId}
</if>
<if test="params.sectionLength != null and params.sectionLength != ''">
AND t.section_length = #{params.sectionLength}
</if>
<if test="params.riverWidthMin != null and params.riverWidthMin != ''">
AND t.river_width_min = #{params.riverWidthMin}
</if>
<if test="params.riverWidthMax != null and params.riverWidthMax != ''">
AND t.river_width_max = #{params.riverWidthMax}
</if>
<if test="params.riverWidthAvg != null and params.riverWidthAvg != ''">
AND t.river_width_avg = #{params.riverWidthAvg}
</if>
<if test="params.sectionDescription != null and params.sectionDescription != ''">
AND t.section_description = #{params.sectionDescription}
</if>
<if test="params.province != null and params.province != ''">
AND t.province = #{params.province}
</if>
<if test="params.county != null and params.county != ''">
AND t.county = #{params.county}
</if>
<if test="params.city != null and params.city != ''">
AND t.city = #{params.city}
</if>
<if test="params.village != null and params.village != ''">
AND t.village = #{params.village}
</if>
<if test="params.street != null and params.street != ''">
AND t.street = #{params.street}
</if>
<if test="params.areaName != null and params.areaName != ''">
AND t.area_name = #{params.areaName}
</if>
<if test="params.longitude != null and params.longitude != ''">
AND t.longitude = #{params.longitude}
</if>
<if test="params.latitude != null and params.latitude != ''">
AND t.latitude = #{params.latitude}
</if>
<if test="params.isDelete != null">
AND t.is_delete = #{params.isDelete}
</if>
</where>
ORDER BY t.street
</select>
</mapper>

View File

@ -21,4 +21,21 @@
)
select * from cte order by order_by asc
</select>
<delete id="deleteCte" parameterType="string">
WITH RECURSIVE descendant_ids AS (
SELECT dictionaries_id
FROM sys_dictionaries
WHERE parent_id = #{parentId}
UNION ALL
SELECT child.dictionaries_id
FROM sys_dictionaries child
JOIN descendant_ids parent ON child.parent_id = parent.dictionaries_id
)
DELETE FROM sys_dictionaries
WHERE dictionaries_id IN (SELECT dictionaries_id FROM descendant_ids);
</delete>
</mapper>