|
|
@ -1,18 +1,21 @@ |
|
|
|
package com.kms.yxgh.common.controller; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.kms.common.utils.UserUtils; |
|
|
|
import com.kms.system.domain.SysXzqh; |
|
|
|
import com.kms.system.service.SysDictTypeService; |
|
|
|
import com.kms.system.service.SysXzqhService; |
|
|
|
import com.kms.yxgh.base.Response; |
|
|
|
import com.shuili.common.core.domain.AjaxResult; |
|
|
|
import com.shuili.common.core.domain.entity.SysDept; |
|
|
|
import com.shuili.common.core.domain.entity.SysDictData; |
|
|
|
import com.shuili.common.core.domain.entity.SysUser; |
|
|
|
import com.shuili.common.utils.StringUtils; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -36,11 +39,33 @@ public class CommonApiController { |
|
|
|
|
|
|
|
@GetMapping("/xzgh/getGuangDong") |
|
|
|
@ApiOperation("获取广东省下属市区") |
|
|
|
public Response<List<SysXzqh>> getGuangDong() { |
|
|
|
List<SysXzqh> list = sysXzqhService.list(Wrappers.lambdaQuery(SysXzqh.class) |
|
|
|
.likeRight(SysXzqh::getXzqhdm, "44") |
|
|
|
.eq(SysXzqh::getLayer, 2)); |
|
|
|
return Response.ok(list); |
|
|
|
public Response<List<SysXzqh>> getGuangDong(@RequestParam(value = "xzqhdm", required = false) String xzqhdm) { |
|
|
|
if (StringUtils.isEmpty(xzqhdm)) { |
|
|
|
QueryWrapper<SysXzqh> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.likeRight("XZQHDM", "44") |
|
|
|
.eq("LAYER", 5); |
|
|
|
List<SysXzqh> list = sysXzqhService.list(queryWrapper); |
|
|
|
return Response.ok(list); |
|
|
|
} else { |
|
|
|
SysXzqh xzqh = sysXzqhService.getById(xzqhdm); |
|
|
|
QueryWrapper<SysXzqh> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.likeRight("XZQHDM", getQuery(xzqh.getXzqhdm())) |
|
|
|
.eq("LAYER", xzqh.getLayer() - 1); |
|
|
|
List<SysXzqh> list = sysXzqhService.list(queryWrapper); |
|
|
|
return Response.ok(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String getQuery(String xzqhdm) { |
|
|
|
int index = xzqhdm.lastIndexOf("000"); |
|
|
|
if (index >= 6) { |
|
|
|
return getQuery(xzqhdm.substring(0, index)); |
|
|
|
} |
|
|
|
index = xzqhdm.lastIndexOf("00"); |
|
|
|
if (index >= 0 && index < 6) { |
|
|
|
return getQuery(xzqhdm.substring(0, index)); |
|
|
|
} |
|
|
|
return xzqhdm; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据字典类型查询字典数据信息") |
|
|
|