package com.ycl.controller.dict; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ycl.api.CommonResult; import com.ycl.controller.BaseController; import com.ycl.entity.dict.DataDictionary; import com.ycl.service.dict.IDataDictionaryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** *

* 前端控制器 *

* * @author lyq * @since 2022-09-15 */ @RestController @RequestMapping("/dict") @Api(tags = "字典模块") public class DatabaseDictionaryController extends BaseController { @Resource private IDataDictionaryService iDatabaseDictionaryService; @GetMapping("/listAll") @ApiOperation("获取所有字典") private CommonResult> listAll() { return CommonResult.success(iDatabaseDictionaryService.getAll()); } @GetMapping("/queryByCode") @ApiOperation(("根据code获取字段信息")) private CommonResult> queryByCode(@RequestParam(value = "code") String code){ List dataDictionary = iDatabaseDictionaryService.queryByCode(code); return CommonResult.success(dataDictionary); } @GetMapping("/query_user_type") @ApiOperation("查询用户类型") private CommonResult queryUserType() { String level = "1"; String typeCode = "07"; return CommonResult.success(iDatabaseDictionaryService .list(new LambdaQueryWrapper() .eq(DataDictionary::getLevel, level) .eq(DataDictionary::getTypeCode, typeCode) )); } @GetMapping("/query_role_type") @ApiOperation("查询角色类型") private CommonResult queryRoleType() { String level = "1"; String typeCode = "09"; return CommonResult.success(iDatabaseDictionaryService .list(new LambdaQueryWrapper() .eq(DataDictionary::getLevel, level) .eq(DataDictionary::getTypeCode, typeCode) )); } @GetMapping("/query_depart_type") @ApiOperation("查询部门类型") private CommonResult queryDepartType() { String level = "1"; String typeCode = "08"; return CommonResult.success(iDatabaseDictionaryService .list(new LambdaQueryWrapper() .eq(DataDictionary::getLevel, level) .eq(DataDictionary::getTypeCode, typeCode) )); } @GetMapping("/query_Street_type") @ApiOperation("查询乡村街道类型") private CommonResult queryStreetType() { String level = "1"; String typeCode = "10"; return CommonResult.success(iDatabaseDictionaryService .list(new LambdaQueryWrapper() .eq(DataDictionary::getLevel, level) .eq(DataDictionary::getTypeCode, typeCode) )); } @GetMapping("/query_social_type") @ApiOperation("查询所辖村(社区") private CommonResult querySocialType(@RequestParam Integer id) { return CommonResult.success(iDatabaseDictionaryService .list(new LambdaQueryWrapper() .eq(DataDictionary::getParentId, id) )); } }