Compare commits
No commits in common. "0d1904a5c50900f1551981315d24c329b43f46e6" and "9bca03b78a3954e04d4772abf72585fa1d9adc4c" have entirely different histories.
0d1904a5c5
...
9bca03b78a
ruoyi-admin/src/main
java/com/ruoyi/base
controller
domain
mapper
service
resources/mapper/base
@ -1,127 +0,0 @@
|
|||||||
package com.ruoyi.base.controller;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
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.ruoyi.common.annotation.Log;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
|
||||||
import com.ruoyi.base.domain.BaseCity;
|
|
||||||
import com.ruoyi.base.service.IBaseCityService;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市Controller
|
|
||||||
*
|
|
||||||
* @author vinjor-m
|
|
||||||
* @date 2025-03-18
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/base/city")
|
|
||||||
public class BaseCityController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IBaseCityService baseCityService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询城市列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public AjaxResult list(BaseCity baseCity)
|
|
||||||
{
|
|
||||||
List<BaseCity> list = baseCityService.list();
|
|
||||||
return success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出城市列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:export')")
|
|
||||||
@Log(title = "城市", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, BaseCity baseCity)
|
|
||||||
{
|
|
||||||
List<BaseCity> list = baseCityService.list();
|
|
||||||
ExcelUtil<BaseCity> util = new ExcelUtil<BaseCity>(BaseCity.class);
|
|
||||||
util.exportExcel(response, list, "城市数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取城市详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return success(baseCityService.getById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增城市
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:add')")
|
|
||||||
@Log(title = "城市", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody BaseCity baseCity)
|
|
||||||
{
|
|
||||||
return toAjax(baseCityService.save(baseCity));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改城市
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:edit')")
|
|
||||||
@Log(title = "城市", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody BaseCity baseCity)
|
|
||||||
{
|
|
||||||
return toAjax(baseCityService.updateById(baseCity));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除城市
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('base:city:remove')")
|
|
||||||
@Log(title = "城市", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
List<Long> list = new ArrayList<>(Arrays.asList(ids));
|
|
||||||
return toAjax(baseCityService.removeByIds(list));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询子级城市
|
|
||||||
* @author vinjor-M
|
|
||||||
* @date 18:09 2025/3/18
|
|
||||||
* @param parentId 父级id
|
|
||||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
|
||||||
**/
|
|
||||||
@GetMapping("/listByPid")
|
|
||||||
public AjaxResult listByPid(@RequestParam(value = "parentId",required = false) Long parentId)
|
|
||||||
{
|
|
||||||
if(null==parentId){
|
|
||||||
parentId = 0L;
|
|
||||||
}
|
|
||||||
List<BaseCity> list = baseCityService.list(new LambdaQueryWrapper<BaseCity>().eq(BaseCity::getParentId,parentId).orderByAsc(BaseCity::getAreaCode));
|
|
||||||
return success(list);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.ruoyi.base.domain;
|
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
|
||||||
import lombok.*;
|
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市对象 dl_base_city
|
|
||||||
*
|
|
||||||
* @author vinjor-m
|
|
||||||
* @date 2025-03-18
|
|
||||||
*/
|
|
||||||
@TableName("dl_base_city")
|
|
||||||
@Data
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class BaseCity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** $column.columnComment */
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 城市id */
|
|
||||||
@Excel(name = "城市id")
|
|
||||||
private Long cityId;
|
|
||||||
|
|
||||||
/** 省市级别 */
|
|
||||||
@Excel(name = "省市级别")
|
|
||||||
private Long level;
|
|
||||||
|
|
||||||
/** 父级id */
|
|
||||||
@Excel(name = "父级id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/** 区号 */
|
|
||||||
@Excel(name = "区号")
|
|
||||||
private String areaCode;
|
|
||||||
|
|
||||||
/** 名称 */
|
|
||||||
@Excel(name = "名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/** 合并名称 */
|
|
||||||
@Excel(name = "合并名称")
|
|
||||||
private String mergerName;
|
|
||||||
|
|
||||||
/** 经度 */
|
|
||||||
@Excel(name = "经度")
|
|
||||||
private String lng;
|
|
||||||
|
|
||||||
/** 纬度 */
|
|
||||||
@Excel(name = "纬度")
|
|
||||||
private String lat;
|
|
||||||
|
|
||||||
/** 是否展示 */
|
|
||||||
@Excel(name = "是否展示")
|
|
||||||
private Integer isShow;
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.ruoyi.base.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.ruoyi.base.domain.BaseCity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市Mapper接口
|
|
||||||
*
|
|
||||||
* @author vinjor-m
|
|
||||||
* @date 2025-03-18
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BaseCityMapper extends BaseMapper<BaseCity>
|
|
||||||
{
|
|
||||||
IPage<BaseCity> queryListPage(@Param("entity") BaseCity entity, Page<BaseCity> page);
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.ruoyi.base.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.ruoyi.base.domain.BaseCity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市Service接口
|
|
||||||
*
|
|
||||||
* @author vinjor-m
|
|
||||||
* @date 2025-03-18
|
|
||||||
*/
|
|
||||||
public interface IBaseCityService extends IService<BaseCity>
|
|
||||||
{
|
|
||||||
IPage<BaseCity> queryListPage(BaseCity pageReqVO, Page<BaseCity> page);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.ruoyi.base.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.ruoyi.base.mapper.BaseCityMapper;
|
|
||||||
import com.ruoyi.base.domain.BaseCity;
|
|
||||||
import com.ruoyi.base.service.IBaseCityService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市Service业务层处理
|
|
||||||
*
|
|
||||||
* @author vinjor-m
|
|
||||||
* @date 2025-03-18
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BaseCityServiceImpl extends ServiceImpl<BaseCityMapper,BaseCity> implements IBaseCityService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private BaseCityMapper baseCityMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IPage<BaseCity> queryListPage(BaseCity pageReqVO, Page<BaseCity> page) {
|
|
||||||
return baseCityMapper.queryListPage(pageReqVO, page);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<?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.ruoyi.base.mapper.BaseCityMapper">
|
|
||||||
|
|
||||||
<resultMap type="BaseCity" id="BaseCityResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="cityId" column="city_id" />
|
|
||||||
<result property="level" column="level" />
|
|
||||||
<result property="parentId" column="parent_id" />
|
|
||||||
<result property="areaCode" column="area_code" />
|
|
||||||
<result property="name" column="name" />
|
|
||||||
<result property="mergerName" column="merger_name" />
|
|
||||||
<result property="lng" column="lng" />
|
|
||||||
<result property="lat" column="lat" />
|
|
||||||
<result property="isShow" column="is_show" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectBaseCityVo">
|
|
||||||
select id, city_id, level, parent_id, area_code, name, merger_name, lng, lat, is_show, create_time, update_time from dl_base_city
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="queryListPage" parameterType="BaseCity" resultMap="BaseCityResult">
|
|
||||||
<include refid="selectBaseCityVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="entity.cityId != null "> and city_id = #{entity.cityId}</if>
|
|
||||||
<if test="entity.level != null "> and level = #{entity.level}</if>
|
|
||||||
<if test="entity.parentId != null "> and parent_id = #{entity.parentId}</if>
|
|
||||||
<if test="entity.areaCode != null and entity.areaCode != ''"> and area_code = #{entity.areaCode}</if>
|
|
||||||
<if test="entity.name != null and entity.name != ''"> and name like concat('%', #{entity.name}, '%')</if>
|
|
||||||
<if test="entity.mergerName != null and entity.mergerName != ''"> and merger_name like concat('%', #{entity.mergerName}, '%')</if>
|
|
||||||
<if test="entity.lng != null and entity.lng != ''"> and lng = #{entity.lng}</if>
|
|
||||||
<if test="entity.lat != null and entity.lat != ''"> and lat = #{entity.lat}</if>
|
|
||||||
<if test="entity.isShow != null "> and is_show = #{entity.isShow}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue
Block a user