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.
69 lines
2.3 KiB
69 lines
2.3 KiB
2 years ago
|
package com.epmet.controller;
|
||
|
|
||
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
||
|
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.AddGroup;
|
||
|
import com.epmet.commons.tools.validator.group.DefaultGroup;
|
||
|
import com.epmet.commons.tools.validator.group.UpdateGroup;
|
||
|
import com.epmet.dto.PovertyManageDTO;
|
||
|
import com.epmet.dto.form.povertyManage.PovertyManageFormDto;
|
||
|
import com.epmet.service.PovertyManageService;
|
||
|
import com.github.pagehelper.Page;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @author generator generator@elink-cn.com
|
||
|
* @since v1.0.0 2023-06-16
|
||
|
*/
|
||
|
@RestController
|
||
|
@RequestMapping("povertyManage")
|
||
|
public class PovertyManageController {
|
||
|
|
||
|
@Autowired
|
||
|
private PovertyManageService povertyManageService;
|
||
|
|
||
|
@PostMapping("page")
|
||
|
public Result<PageData<PovertyManageDTO>> selectList(@RequestBody PovertyManageFormDto formDTO) {
|
||
|
Page<PovertyManageDTO> page = povertyManageService.selectPage(formDTO);
|
||
|
return new Result().ok(page);
|
||
|
}
|
||
|
|
||
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
|
||
|
public Result<PovertyManageDTO> get(@PathVariable("id") String id) {
|
||
|
PovertyManageDTO data = povertyManageService.get(id);
|
||
|
return new Result<PovertyManageDTO>().ok(data);
|
||
|
}
|
||
|
|
||
|
@NoRepeatSubmit
|
||
|
@PostMapping("save")
|
||
|
public Result save(@RequestBody PovertyManageFormDto dto) {
|
||
|
//效验数据
|
||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||
|
povertyManageService.save(dto);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
@NoRepeatSubmit
|
||
|
@PostMapping("update")
|
||
|
public Result update(@RequestBody PovertyManageFormDto dto) {
|
||
|
//效验数据
|
||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||
|
povertyManageService.update(dto);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
@PostMapping("delete")
|
||
|
public Result delete(@RequestBody String[] ids) {
|
||
|
//效验数据
|
||
|
AssertUtils.isArrayEmpty(ids, "id");
|
||
|
povertyManageService.delete(ids);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
}
|