整合提交

This commit is contained in:
2026-06-23 18:46:45 +08:00
parent 32e35666af
commit 0b4860f46e
452 changed files with 21755 additions and 23 deletions
@@ -0,0 +1,61 @@
package com.weather.modules.region.controller;
import com.weather.common.annotation.LogOperation;
import com.weather.common.constant.Constant;
import com.weather.common.page.PageData;
import com.weather.common.utils.ExcelUtils;
import com.weather.common.utils.Result;
import com.weather.common.validator.AssertUtils;
import com.weather.common.validator.ValidatorUtils;
import com.weather.common.validator.group.AddGroup;
import com.weather.common.validator.group.DefaultGroup;
import com.weather.common.validator.group.UpdateGroup;
import com.weather.modules.region.dto.SysRegionDTO;
import com.weather.modules.region.excel.SysRegionExcel;
import com.weather.modules.region.service.SysRegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@RestController
@RequestMapping("region/sysregion")
@Tag(name="行政区划表")
public class SysRegionController {
@Autowired
private SysRegionService sysRegionService;
@GetMapping("parent/{id}")
@Operation(summary = "信息")
@RequiresPermissions("region:sysregion:info")
public Result<List<SysRegionDTO>> get(@PathVariable Long id){
List<SysRegionDTO> data = sysRegionService.getByParentId(id);
return new Result<List<SysRegionDTO>>().ok(data);
}
@GetMapping("export")
@Operation(summary = "导出")
@LogOperation("导出")
@RequiresPermissions("region:sysregion:export")
public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysRegionDTO> list = sysRegionService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "行政区划表", list, SysRegionExcel.class);
}
}
@@ -0,0 +1,16 @@
package com.weather.modules.region.dao;
import com.weather.common.dao.BaseDao;
import com.weather.modules.region.entity.SysRegionEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@Mapper
public interface SysRegionDao extends BaseDao<SysRegionEntity> {
}
@@ -0,0 +1,42 @@
package com.weather.modules.region.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@Data
@Schema(name = "行政区划表")
public class SysRegionDTO implements Serializable {
private static final long serialVersionUID = 1L;
@SchemaProperty(name = "行政区编码")
private Long id;
@SchemaProperty(name = "名称")
private String name;
@SchemaProperty(name = "层级 0国家 1省 2市 3区县")
private Integer level;
@SchemaProperty(name = "父级行政区")
private Long parentId;
@SchemaProperty(name = "经度")
private BigDecimal lon;
@SchemaProperty(name = "纬度")
private BigDecimal lat;
}
@@ -0,0 +1,43 @@
package com.weather.modules.region.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@Data
@TableName("sys_region")
public class SysRegionEntity {
/**
* 行政区编码
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 层级 0国家 1省 2市 3区县
*/
private Integer level;
/**
* 父级行政区
*/
private Long parentId;
/**
* 经度
*/
private BigDecimal lon;
/**
* 纬度
*/
private BigDecimal lat;
}
@@ -0,0 +1,33 @@
package com.weather.modules.region.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@Data
public class SysRegionExcel {
@ExcelProperty(value = "行政区编码")
private Long id;
@ExcelProperty(value = "名称")
private String name;
@ExcelProperty(value = "层级 0国家 1省 2市 3区县")
private Integer level;
@ExcelProperty(value = "父级行政区")
private Long parentId;
@ExcelProperty(value = "经度")
private BigDecimal lon;
@ExcelProperty(value = "纬度")
private BigDecimal lat;
}
@@ -0,0 +1,23 @@
package com.weather.modules.region.service;
import com.weather.common.service.CrudService;
import com.weather.modules.region.dto.SysRegionDTO;
import com.weather.modules.region.entity.SysRegionEntity;
import java.util.List;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
public interface SysRegionService extends CrudService<SysRegionEntity, SysRegionDTO> {
/**
* 获取子一级地区信息
* @param id 地区 id
* @return 地区信息
*/
List<SysRegionDTO> getByParentId(Long id);
}
@@ -0,0 +1,49 @@
package com.weather.modules.region.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.weather.common.service.impl.CrudServiceImpl;
import com.weather.common.utils.ConvertUtils;
import com.weather.modules.region.dao.SysRegionDao;
import com.weather.modules.region.dto.SysRegionDTO;
import com.weather.modules.region.entity.SysRegionEntity;
import com.weather.modules.region.service.SysRegionService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 行政区划表
*
* @author Mark 123
* @since 1.0.0 2026-03-05
*/
@Service
public class SysRegionServiceImpl extends CrudServiceImpl<SysRegionDao, SysRegionEntity, SysRegionDTO> implements SysRegionService {
@Override
public QueryWrapper<SysRegionEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get("id");
QueryWrapper<SysRegionEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(id), "id", id);
return wrapper;
}
/**
* 获取子一级地区信息
*
* @param id 地区 id
* @return 地区信息
*/
@Override
public List<SysRegionDTO> getByParentId(Long id) {
QueryWrapper<SysRegionEntity> wrapper = new QueryWrapper<>();
wrapper.eq("parent_id", id);
List<SysRegionEntity> sysRegionEntities = baseDao.selectList(wrapper);
return ConvertUtils.sourceToTarget(sysRegionEntities, SysRegionDTO.class);
}
}