| | |
| | | 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.dto.video.Camera; |
| | | import com.ycl.dto.video.PageResult; |
| | | import com.ycl.entity.dict.DataDictionary; |
| | | import com.ycl.enums.common.DictTypeEnum; |
| | | import com.ycl.service.dict.IDataDictionaryService; |
| | | import com.ycl.util.VideoUtil; |
| | | import com.ycl.vo.dict.DataDictionaryVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | 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 org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class DatabaseDictionaryController extends BaseController { |
| | | @Resource |
| | | private IDataDictionaryService iDatabaseDictionaryService; |
| | | @Autowired |
| | | private VideoUtil videoUtil; |
| | | |
| | | @GetMapping("/listAll") |
| | | @ApiOperation("获取所有字典") |
| | | private CommonResult<List<DataDictionary>> listAll() { |
| | | try { |
| | | PageResult<Camera> pageResult = videoUtil.callPostCameras(1, 20, "0"); |
| | | System.out.println("海康视频成功:" + pageResult.getTotal()); |
| | | } catch (Exception ex) { |
| | | System.out.println("海康视频:" + ex.getMessage()); |
| | | } |
| | | return CommonResult.success(iDatabaseDictionaryService.getAll()); |
| | | } |
| | | |
| | | @GetMapping("/queryByCode") |
| | | @ApiOperation(("/根据code获取字段信息")) |
| | | private CommonResult<DataDictionary> queryByCode(@RequestParam(value = "code") String code){ |
| | | DataDictionary dataDictionary = iDatabaseDictionaryService.queryByCode(code); |
| | | @ApiOperation(("根据code获取字段信息")) |
| | | private CommonResult<List<DataDictionary>> queryByCode(@RequestParam(value = "code") String code) { |
| | | List<DataDictionary> dataDictionary = iDatabaseDictionaryService.queryByCode(code, null); |
| | | return CommonResult.success(dataDictionary); |
| | | } |
| | | |
| | | @GetMapping("/queryTypeCode") |
| | | @ApiOperation(("获取字典表所有类型")) |
| | | private CommonResult<Map<String, String>> queryTypeCode() { |
| | | Map<String, String> s = DictTypeEnum.getAllToMap(); |
| | | return CommonResult.success(s); |
| | | } |
| | | |
| | | @GetMapping("/query_user_type") |
| | | @ApiOperation("查询用户类型") |
| | | private CommonResult queryUserType() { |
| | | String level = "1"; |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, DictTypeEnum.USER_TYPE.getCode()) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_role_type") |
| | | @ApiOperation("查询角色类型") |
| | | private CommonResult queryRoleType() { |
| | | String level = "1"; |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, DictTypeEnum.ROLE_TYPE.getCode()) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_depart_type") |
| | | @ApiOperation("查询部门类型") |
| | | private CommonResult queryDepartType() { |
| | | String level = "1"; |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, DictTypeEnum.DEPART_TYPE.getCode()) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_Street_type") |
| | | @ApiOperation("查询乡村街道类型") |
| | | private CommonResult queryStreetType() { |
| | | String level = "1"; |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, DictTypeEnum.STREET_TYPE.getCode()) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_social_type") |
| | | @ApiOperation("查询所辖村(社区") |
| | | private CommonResult querySocialTypeById(@RequestParam Integer id) { |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getParentId, id) |
| | | )); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/query_social") |
| | | @ApiOperation("查询所辖村(社区") |
| | | private CommonResult querySocialType() { |
| | | String level = "1"; |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, DictTypeEnum.COMMUNITY_TYPE.getCode()) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_type") |
| | | @ApiOperation("通过类型编码查询类型") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "typeCode", value = "01违规 02 事件等级 03证件类型 04文化 05名族 06违建 07用户类型 08 部门类型 09 角色类型 10 乡村街道 11 社区"), |
| | | @ApiImplicitParam(name = "level", value = "1 顶级 2 一级子级 3 二级子级 4三级子级") |
| | | } |
| | | ) |
| | | private CommonResult queryType(@RequestParam String typeCode, @RequestParam Integer level) { |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getLevel, level) |
| | | .eq(DataDictionary::getTypeCode, typeCode) |
| | | )); |
| | | } |
| | | |
| | | @GetMapping("/query_tree_type") |
| | | @ApiOperation("通过类型编码查询树形类型-只有两级") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "typeCode", value = "01违规 02 事件等级 03证件类型 04文化 05名族 06违建 07用户类型 08 部门类型 09 角色类型 10 乡村街道 11 社区"), |
| | | @ApiImplicitParam(name = "level", value = "1 顶级 2 一级子级 3 二级子级 4三级子级") |
| | | } |
| | | ) |
| | | private CommonResult queryTreeType(@RequestParam String typeCode, @RequestParam Integer level) { |
| | | |
| | | List<DataDictionaryVo> list = iDatabaseDictionaryService.queryTreeType(typeCode, level); |
| | | return CommonResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/addition") |
| | | @ApiOperation("通用添加") |
| | | private CommonResult queryType(@RequestBody DataDictionary dataDictionary) { |
| | | return CommonResult.success(iDatabaseDictionaryService.save(dataDictionary)); |
| | | } |
| | | |
| | | @GetMapping("/query") |
| | | @ApiOperation("通用id查询详情") |
| | | private CommonResult queryDictById(@RequestParam Integer id) { |
| | | return CommonResult.success(iDatabaseDictionaryService |
| | | .list(new LambdaQueryWrapper<DataDictionary>() |
| | | .eq(DataDictionary::getParentId, id))); |
| | | } |
| | | } |