系统字典通过父编码查子项

master
wany 2024-08-28 17:43:20 +08:00
parent e5a07d5328
commit ffe2d3d2f4
3 changed files with 19 additions and 0 deletions

View File

@ -106,6 +106,12 @@ public class SysDictBController {
return R.ok(query.list());
}
@Operation(summary = "列表 通过父编码查子项")
@GetMapping("/listByCd")
public R<List<SysDictB>> listByCd(@Schema(name = "dictCd",description = "父编码") @RequestParam(name = "dictCd") String dictCd) {
return R.ok(service.listByCd(dictCd));
}
@Operation(summary = "分页 只查父项")
@PostMapping("/page")
public R<Page<SysDictB>> page(@RequestBody GenericPageParams page) {

View File

@ -3,6 +3,10 @@ package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.model.SysDictB;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* :
@ -12,4 +16,10 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysDictBMapper extends BaseMapper<SysDictB> {
@Select("""
<script>
select t.* from public.sys_dict_b t where pid = (select id from public.sys_dict_b where dict_cd = #{dictCd})
</script>
""")
List<SysDictB> listByCd(@Param("dictCd") String dictCd);
}

View File

@ -52,6 +52,9 @@ public class SysDictBService extends ServiceImpl<SysDictBMapper, SysDictB>
return sorteds;
}
public List<SysDictB> listByCd(String dictCd) {
return this.baseMapper.listByCd(dictCd);
}
}