| | |
| | | |
| | | import java.util.Map; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | public PageResult list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return ResultBody.ok().data(sysDictionariesService.findList(params)); |
| | | return sysDictionariesService.findList(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/{id}") |
| | | public ResultBody findById(@PathVariable Long id) { |
| | | SysDictionaries model = sysDictionariesService.getById(id); |
| | | return ResultBody.ok().data(model).msg("查询成功"); |
| | | } |
| | | @ApiOperation(value = "根据SysDictionaries当做查询条件进行查询") |
| | | @PostMapping("/findAll") |
| | | public ResultBody findAll(@RequestBody Map<String, Object> params) { |
| | | List<SysDictionaries> model = sysDictionariesService.findAll(params); |
| | | return ResultBody.ok().data(model).msg("查询成功"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改字典表状态 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "修改字典表状态") |
| | | @GetMapping("/updateEnabled") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "enabled", value = "是否启用", required = true, dataType = "Integer") |
| | | }) |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params) { |
| | | Long id = MapUtils.getLong(params, "id"); |
| | | if (id==null) { |
| | | return ResultBody.failed("请选择一条数据"); |
| | | } |
| | | return sysDictionariesService.updateEnabled(params); |
| | | } |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @ApiOperation(value = "删除") |