| | |
| | | package com.kidgrow.oprationcenter.controller; |
| | | |
| | | import com.kidgrow.common.annotation.LoginUser; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.oprationcenter.model.SysFeedback; |
| | | import com.kidgrow.oprationcenter.service.ISysFeedbackService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: |
| | | * |
| | | * @Description: |
| | | * @Project: 运营中心 |
| | | * @CreateDate: Created in 2020-04-02 18:25:34 <br> |
| | | * @Author: <a href="4345453@kidgrow.com">liuke</a> |
| | |
| | | @RestController |
| | | @RequestMapping("/sysfeedback") |
| | | @Api(tags = "") |
| | | public class SysFeedbackController extends BaseController{ |
| | | public class SysFeedbackController extends BaseController { |
| | | @Autowired |
| | | private ISysFeedbackService sysFeedbackService; |
| | | |
| | |
| | | }) |
| | | @GetMapping |
| | | public PageResult list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return sysFeedbackService.findList(params); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody SysFeedback sysFeedback, BindingResult bindingResult) { |
| | | List<String> errMsg= new ArrayList<>(); |
| | | public ResultBody save(@Valid @RequestBody SysFeedback sysFeedback, BindingResult bindingResult, @LoginUser SysUser sysUser) { |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | boolean v= sysFeedbackService.saveOrUpdate(sysFeedback); |
| | | if(v) { |
| | | } else { |
| | | boolean v = sysFeedbackService.saveOrUpdateStr(sysFeedback, sysUser); |
| | | if (v) { |
| | | return ResultBody.ok().data(sysFeedback).msg("保存成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("保存失败"); |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | boolean v= sysFeedbackService.removeById(id); |
| | | if(v) { |
| | | boolean v = sysFeedbackService.removeById(id); |
| | | if (v) { |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | |
| | | @ApiImplicitParam(name = "enabled", value = "是否启用", required = true, dataType = "Boolean") |
| | | }) |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params) { |
| | | if (params.size()==0) |
| | | { |
| | | if (params.size() == 0) { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | return sysFeedbackService.updateEnabled(params); |