高德API
parent
4df1bd25ac
commit
6bd5d2be95
|
@ -0,0 +1,114 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.TreeEntity;
|
||||
import com.muyu.common.system.domain.req.SysDistrictEditReq;
|
||||
import com.muyu.common.system.domain.req.SysDistrictQueryReq;
|
||||
import com.muyu.common.system.domain.req.SysDistrictSaveReq;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 地域地区对象 sys_district
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("sys_district")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysDistrict", description = "地域地区")
|
||||
public class SysDistrict extends TreeEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "ID", value = "ID")
|
||||
private Long id;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
|
||||
/** 编码 */
|
||||
@Excel(name = "编码")
|
||||
@ApiModelProperty(name = "编码", value = "编码")
|
||||
private String code;
|
||||
|
||||
/** 级别 */
|
||||
@Excel(name = "级别")
|
||||
@ApiModelProperty(name = "级别", value = "级别")
|
||||
private String level;
|
||||
|
||||
/** 级别编码 */
|
||||
@ApiModelProperty(name = "级别编码", value = "级别编码")
|
||||
private String codeLevel;
|
||||
|
||||
/** 区域编码 */
|
||||
@Excel(name = "区域编码")
|
||||
@ApiModelProperty(name = "区域编码", value = "区域编码")
|
||||
private String areaCode;
|
||||
|
||||
/** 中心经纬度 */
|
||||
@Excel(name = "中心经纬度")
|
||||
@ApiModelProperty(name = "中心经纬度", value = "中心经纬度")
|
||||
private String center;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static SysDistrict queryBuild( SysDistrictQueryReq sysDistrictQueryReq){
|
||||
return SysDistrict.builder()
|
||||
.parentId(sysDistrictQueryReq.getParentId())
|
||||
.name(sysDistrictQueryReq.getName())
|
||||
.code(sysDistrictQueryReq.getCode())
|
||||
.level(sysDistrictQueryReq.getLevel())
|
||||
.areaCode(sysDistrictQueryReq.getAreaCode())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static SysDistrict saveBuild(SysDistrictSaveReq sysDistrictSaveReq){
|
||||
return SysDistrict.builder()
|
||||
.parentId(sysDistrictSaveReq.getParentId())
|
||||
.name(sysDistrictSaveReq.getName())
|
||||
.code(sysDistrictSaveReq.getCode())
|
||||
.level(sysDistrictSaveReq.getLevel())
|
||||
.codeLevel(sysDistrictSaveReq.getCodeLevel())
|
||||
.areaCode(sysDistrictSaveReq.getAreaCode())
|
||||
.center(sysDistrictSaveReq.getCenter())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static SysDistrict editBuild(Long id, SysDistrictEditReq sysDistrictEditReq){
|
||||
return SysDistrict.builder()
|
||||
.id(id)
|
||||
.parentId(sysDistrictEditReq.getParentId())
|
||||
.name(sysDistrictEditReq.getName())
|
||||
.code(sysDistrictEditReq.getCode())
|
||||
.level(sysDistrictEditReq.getLevel())
|
||||
.codeLevel(sysDistrictEditReq.getCodeLevel())
|
||||
.areaCode(sysDistrictEditReq.getAreaCode())
|
||||
.center(sysDistrictEditReq.getCenter())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.common.system.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 地域地区对象 sys_district
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "SysDistrictEditReq", description = "地域地区")
|
||||
public class SysDistrictEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 父级 */
|
||||
@ApiModelProperty(name = "父级", value = "父级")
|
||||
private Long parentId;
|
||||
|
||||
/** 名称 */
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
|
||||
/** 编码 */
|
||||
@ApiModelProperty(name = "编码", value = "编码")
|
||||
private String code;
|
||||
|
||||
/** 级别 */
|
||||
@ApiModelProperty(name = "级别", value = "级别")
|
||||
private String level;
|
||||
|
||||
/** 级别编码 */
|
||||
@ApiModelProperty(name = "级别编码", value = "级别编码")
|
||||
private String codeLevel;
|
||||
|
||||
/** 区域编码 */
|
||||
@ApiModelProperty(name = "区域编码", value = "区域编码")
|
||||
private String areaCode;
|
||||
|
||||
/** 中心经纬度 */
|
||||
@ApiModelProperty(name = "中心经纬度", value = "中心经纬度")
|
||||
private String center;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.common.system.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 地域地区对象 sys_district
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "SysDistrictQueryReq", description = "地域地区")
|
||||
public class SysDistrictQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 父级 */
|
||||
@ApiModelProperty(name = "父级", value = "父级")
|
||||
private Long parentId;
|
||||
|
||||
/** 名称 */
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
|
||||
/** 编码 */
|
||||
@ApiModelProperty(name = "编码", value = "编码")
|
||||
private String code;
|
||||
|
||||
/** 级别 */
|
||||
@ApiModelProperty(name = "级别", value = "级别")
|
||||
private String level;
|
||||
|
||||
/** 区域编码 */
|
||||
@ApiModelProperty(name = "区域编码", value = "区域编码")
|
||||
private String areaCode;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.common.system.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 地域地区对象 sys_district
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "SysDistrictSaveReq", description = "地域地区")
|
||||
public class SysDistrictSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
|
||||
@ApiModelProperty(name = "ID", value = "ID")
|
||||
private Long id;
|
||||
|
||||
/** 父级 */
|
||||
|
||||
@ApiModelProperty(name = "父级", value = "父级")
|
||||
private Long parentId;
|
||||
|
||||
/** 名称 */
|
||||
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
|
||||
/** 编码 */
|
||||
|
||||
@ApiModelProperty(name = "编码", value = "编码")
|
||||
private String code;
|
||||
|
||||
/** 级别 */
|
||||
|
||||
@ApiModelProperty(name = "级别", value = "级别")
|
||||
private String level;
|
||||
|
||||
/** 级别编码 */
|
||||
|
||||
@ApiModelProperty(name = "级别编码", value = "级别编码")
|
||||
private String codeLevel;
|
||||
|
||||
/** 区域编码 */
|
||||
|
||||
@ApiModelProperty(name = "区域编码", value = "区域编码")
|
||||
private String areaCode;
|
||||
|
||||
/** 中心经纬度 */
|
||||
|
||||
@ApiModelProperty(name = "中心经纬度", value = "中心经纬度")
|
||||
private String center;
|
||||
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.common.system.domain.SysDistrict;
|
||||
import com.muyu.common.system.domain.req.SysDistrictEditReq;
|
||||
import com.muyu.common.system.domain.req.SysDistrictQueryReq;
|
||||
import com.muyu.common.system.domain.req.SysDistrictSaveReq;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.service.SysDistrictService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 地域地区Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Api(tags = "地域地区")
|
||||
@RestController
|
||||
@RequestMapping("/district")
|
||||
public class SysDistrictController extends BaseController {
|
||||
@Autowired
|
||||
private SysDistrictService sysDistrictService;
|
||||
|
||||
/**
|
||||
* 查询地域地区列表
|
||||
*/
|
||||
@ApiOperation("获取地域地区列表")
|
||||
@RequiresPermissions("system:district:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<SysDistrict>> list(SysDistrictQueryReq sysDistrictQueryReq) {
|
||||
List<SysDistrict> list = sysDistrictService.list(SysDistrict.queryBuild(sysDistrictQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出地域地区列表
|
||||
*/
|
||||
@ApiOperation("导出地域地区列表")
|
||||
@RequiresPermissions("system:district:export")
|
||||
@Log(title = "地域地区", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDistrict sysDistrict) {
|
||||
List<SysDistrict> list = sysDistrictService.list(sysDistrict);
|
||||
ExcelUtil<SysDistrict> util = new ExcelUtil<SysDistrict>(SysDistrict.class);
|
||||
util.exportExcel(response, list, "地域地区数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地域地区详细信息
|
||||
*/
|
||||
@ApiOperation("获取地域地区详细信息")
|
||||
@RequiresPermissions("system:district:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<SysDistrict> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(sysDistrictService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地域地区
|
||||
*/
|
||||
@RequiresPermissions("system:district:add")
|
||||
@Log(title = "地域地区", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增地域地区")
|
||||
public Result<String> add(@RequestBody SysDistrictSaveReq sysDistrictSaveReq) {
|
||||
return toAjax(sysDistrictService.save(SysDistrict.saveBuild(sysDistrictSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地域地区
|
||||
*/
|
||||
@RequiresPermissions("system:district:edit")
|
||||
@Log(title = "地域地区", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改地域地区")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody SysDistrictEditReq sysDistrictEditReq) {
|
||||
return toAjax(sysDistrictService.updateById(SysDistrict.editBuild(id,sysDistrictEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地域地区
|
||||
*/
|
||||
@RequiresPermissions("system:district:remove")
|
||||
@Log(title = "地域地区", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除地域地区")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(sysDistrictService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysDistrict;
|
||||
|
||||
/**
|
||||
* 地域地区Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
public interface SysDistrictMapper extends BaseMapper<SysDistrict> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysDistrict;
|
||||
|
||||
/**
|
||||
* 地域地区Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
public interface SysDistrictService extends IService<SysDistrict> {
|
||||
/**
|
||||
* 查询地域地区列表
|
||||
*
|
||||
* @param sysDistrict 地域地区
|
||||
* @return 地域地区集合
|
||||
*/
|
||||
public List<SysDistrict> list(SysDistrict sysDistrict);
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import com.muyu.common.system.domain.SysDistrict;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.SysDistrictMapper;
|
||||
import com.muyu.system.service.SysDistrictService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 地域地区Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-04-11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SysDistrictServiceImpl extends ServiceImpl<SysDistrictMapper, SysDistrict> implements SysDistrictService {
|
||||
|
||||
/**
|
||||
* 查询地域地区列表
|
||||
*
|
||||
* @param sysDistrict 地域地区
|
||||
* @return 地域地区
|
||||
*/
|
||||
@Override
|
||||
public List<SysDistrict> list(SysDistrict sysDistrict) {
|
||||
LambdaQueryWrapper<SysDistrict> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(sysDistrict.getParentId())){
|
||||
queryWrapper.eq(SysDistrict::getParentId, sysDistrict.getParentId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(sysDistrict.getName())){
|
||||
queryWrapper.like(SysDistrict::getName, sysDistrict.getName());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(sysDistrict.getCode())){
|
||||
queryWrapper.eq(SysDistrict::getCode, sysDistrict.getCode());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(sysDistrict.getLevel())){
|
||||
queryWrapper.eq(SysDistrict::getLevel, sysDistrict.getLevel());
|
||||
}
|
||||
|
||||
|
||||
if (ObjUtils.notNull(sysDistrict.getAreaCode())){
|
||||
queryWrapper.eq(SysDistrict::getAreaCode, sysDistrict.getAreaCode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?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.muyu.system.mapper.SysDistrictMapper">
|
||||
|
||||
<resultMap type="com.muyu.common.system.domain.SysDistrict" id="SysDistrictResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="code" column="code" />
|
||||
<result property="level" column="level" />
|
||||
<result property="codeLevel" column="code_level" />
|
||||
<result property="areaCode" column="area_code" />
|
||||
<result property="center" column="center" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysDistrictVo">
|
||||
select id, parent_id, name, code, level, code_level, area_code, center, create_by, create_time, update_by, update_time, remark from sys_district
|
||||
</sql>
|
||||
</mapper>
|
|
@ -1,7 +1,6 @@
|
|||
package com.forest;
|
||||
|
||||
import com.muyu.system.MuYuSystemApplication;
|
||||
import com.muyu.system.forest.api.TestApi;
|
||||
import com.muyu.system.forest.gaode.api.GaoDeBaseApi;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
|
Loading…
Reference in New Issue