| | |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.dto.request.configParam.CreateConfigParamDTO; |
| | | import com.mzl.flower.dto.request.configParam.ConfigParamDTO; |
| | | import com.mzl.flower.dto.request.configParam.QueryConfigParamDTO; |
| | | import com.mzl.flower.dto.request.configParam.UpdateConfigParamDTO; |
| | | import com.mzl.flower.dto.response.configParam.ConfigParamVO; |
| | | import com.mzl.flower.entity.configParam.ConfigParamGroupDO; |
| | | import com.mzl.flower.service.ConfigParamGroupService; |
| | | import com.mzl.flower.service.ConfigParamService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Positive; |
| | | import java.util.Map; |
| | | |
| | |
| | | @Autowired |
| | | private ConfigParamService configParamService; |
| | | |
| | | @PostMapping("") |
| | | @Autowired |
| | | private ConfigParamGroupService configParamGroupService; |
| | | |
| | | @PostMapping("/new") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateConfigParamDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody ConfigParamDTO dto) { |
| | | ConfigParamGroupDO configParamGroupDO = configParamGroupService.getById(dto.getParamGroupId()); |
| | | dto.setParamGroup(configParamGroupDO.getParamGroup()); |
| | | dto.setParamGroupName(configParamGroupDO.getParamGroupName()); |
| | | configParamService.saveConfigParam(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable Integer id,@Validated @RequestBody UpdateConfigParamDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody ConfigParamDTO dto) { |
| | | ConfigParamGroupDO configParamGroupDO = configParamGroupService.getById(dto.getParamGroupId()); |
| | | dto.setParamGroup(configParamGroupDO.getParamGroup()); |
| | | dto.setParamGroupName(configParamGroupDO.getParamGroupName()); |
| | | configParamService.updateConfigParam(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping(value = "/delete") |
| | | @ApiOperation(value = "删除系统配置配置 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity<ReturnDataDTO> delete(@NotNull(message = "id不能为空") Long id) { |
| | | configParamService.deleteConfigParam(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/config/list") |
| | | @ApiOperation(value = "配置查询-列表", notes = "配置查询-列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<ConfigParamVO>>> configlist(Page page, QueryConfigParamDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), configParamService.queryPage(dto, page)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-列表", notes = "查询-列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<ConfigParamVO>>> list(QueryConfigParamDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), configParamService.getList(dto)); |
| | | } |
| | | |
| | | @PutMapping("/update/batch") |
| | | @ApiOperation(value = "批量修改", notes = "批量修改") |
| | | public ResponseEntity<ReturnDataDTO> updateBath(@Validated @RequestBody UpdateConfigParamDTO dto) { |
| | | configParamService.updateConfigParamBatch(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(Integer id) { |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-列表", notes = "查询-列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<ConfigParamVO>>> list(QueryConfigParamDTO dto) { |
| | | // 设置只查询活动优惠券的 |
| | | return returnData(R.SUCCESS.getCode(), configParamService.getList(dto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/base/info") |
| | | @ApiOperation(value = "查询-备案信息", notes = "查询-备案信息" ) |
| | | public ResponseEntity<ReturnDataDTO<Map<String,Object>>> getBaseInfo() { |
| | |
| | | return returnData(R.SUCCESS.getCode(), configParamService.getBaseInfo()); |
| | | } |
| | | |
| | | @GetMapping(value = "/base/getBaseString") |
| | | @ApiOperation(value = "获取配置信息 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity getBaseString(@NotNull(message = "paramGroup") String paramGroup, @NotNull(message = "paramKey") String paramKey) { |
| | | configParamService.getBaseString(paramGroup, paramKey); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | } |