forked from rongchao/epmet-cloud-rizhao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
4.0 KiB
143 lines
4.0 KiB
/**
|
|
* Copyright (c) 2018 人人开源 All rights reserved.
|
|
*
|
|
* https://www.renren.io
|
|
*
|
|
* 版权所有,侵权必究!
|
|
*/
|
|
|
|
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO;
|
|
import com.epmet.commons.tools.page.PageData;
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.commons.tools.validator.AssertUtils;
|
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
|
import com.epmet.commons.tools.validator.group.UpdateGroup;
|
|
import com.epmet.dto.SysDictDataDTO;
|
|
import com.epmet.service.SysDictDataService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 字典数据
|
|
*
|
|
* @author Mark sunlightcs@gmail.com
|
|
*/
|
|
@RestController
|
|
@RequestMapping("dict/data")
|
|
public class SysDictDataController {
|
|
@Autowired
|
|
private SysDictDataService sysDictDataService;
|
|
|
|
@GetMapping("page")
|
|
public Result<PageData<SysDictDataDTO>> page(@RequestParam Map<String, Object> params){
|
|
//字典类型
|
|
PageData<SysDictDataDTO> page = sysDictDataService.page(params);
|
|
|
|
return new Result<PageData<SysDictDataDTO>>().ok(page);
|
|
}
|
|
|
|
@GetMapping("{id}")
|
|
public Result<SysDictDataDTO> get(@PathVariable("id") Long id){
|
|
SysDictDataDTO data = sysDictDataService.get(id);
|
|
|
|
return new Result<SysDictDataDTO>().ok(data);
|
|
}
|
|
|
|
@PostMapping
|
|
public Result save(@RequestBody SysDictDataDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
|
|
|
|
sysDictDataService.save(dto);
|
|
|
|
return new Result();
|
|
}
|
|
|
|
@PutMapping
|
|
public Result update(@RequestBody SysDictDataDTO dto){
|
|
//效验数据
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
sysDictDataService.update(dto);
|
|
|
|
return new Result();
|
|
}
|
|
|
|
@DeleteMapping
|
|
public Result delete(@RequestBody Long[] ids){
|
|
//效验数据
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
sysDictDataService.delete(ids);
|
|
|
|
return new Result();
|
|
}
|
|
|
|
/**
|
|
* @Description 九小场所
|
|
* @Param
|
|
* @Return {@link Result<List<OptionResultDTO>>}
|
|
* @Author zhaoqifeng
|
|
* @Date 2021/10/26 17:27
|
|
*/
|
|
@PostMapping("ninesmallplaces")
|
|
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
|
|
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNineSmallPlacesOption());
|
|
}
|
|
|
|
/**
|
|
* @Description 文化程度
|
|
* @Param
|
|
* @Return {@link Result<List<OptionResultDTO>>}
|
|
* @Author zhaoqifeng
|
|
* @Date 2021/10/26 17:27
|
|
*/
|
|
@PostMapping("education")
|
|
public Result<List<OptionResultDTO>> getEducationOption() {
|
|
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getEducationOption());
|
|
}
|
|
|
|
/**
|
|
* @Description 民族
|
|
* @Param
|
|
* @Return {@link Result<List<OptionResultDTO>>}
|
|
* @Author zhaoqifeng
|
|
* @Date 2021/10/26 17:27
|
|
*/
|
|
@PostMapping("nation")
|
|
public Result<List<OptionResultDTO>> getNationOption() {
|
|
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getNationOption());
|
|
}
|
|
|
|
/**
|
|
* @Description 人员关系
|
|
* @Param
|
|
* @Return {@link Result<List<OptionResultDTO>>}
|
|
* @Author zhaoqifeng
|
|
* @Date 2021/10/26 17:27
|
|
*/
|
|
@PostMapping("relationship")
|
|
public Result<List<OptionResultDTO>> getRelationshipOption() {
|
|
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getRelationshipOption());
|
|
}
|
|
|
|
/**
|
|
* @Description 住房性质
|
|
* @Param
|
|
* @Return {@link Result<List<OptionResultDTO>>}
|
|
* @Author zhaoqifeng
|
|
* @Date 2021/10/26 17:27
|
|
*/
|
|
@PostMapping("house")
|
|
public Result<List<OptionResultDTO>> getHouseOption() {
|
|
return new Result<List<OptionResultDTO>>().ok(sysDictDataService.getHouseOption());
|
|
}
|
|
|
|
|
|
}
|
|
|