|
|
|
package com.epmet.controller;
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
|
|
import com.epmet.commons.tools.annotation.MaskResponse;
|
|
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit;
|
|
|
|
import com.epmet.commons.tools.page.PageData;
|
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils;
|
|
|
|
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.ChangeDeathDTO;
|
|
|
|
import com.epmet.excel.ChangeDeathExcel;
|
|
|
|
import com.epmet.service.ChangeDeathService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 死亡名单表
|
|
|
|
*
|
|
|
|
* @author generator generator@elink-cn.com
|
|
|
|
* @since v1.0.0 2022-05-05
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("rentDeath")
|
|
|
|
public class ChangeDeathController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ChangeDeathService changeDeathService;
|
|
|
|
|
|
|
|
@RequestMapping("page")
|
|
|
|
@MaskResponse(fieldNames = {"MOBILE", "ID_CARD"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD})
|
|
|
|
public Result<PageData<ChangeDeathDTO>> page(@RequestParam Map<String, Object> params){
|
|
|
|
PageData<ChangeDeathDTO> page = changeDeathService.page(params);
|
|
|
|
return new Result<PageData<ChangeDeathDTO>>().ok(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET})
|
|
|
|
public Result<ChangeDeathDTO> get(@PathVariable("id") String id){
|
|
|
|
ChangeDeathDTO data = changeDeathService.get(id);
|
|
|
|
return new Result<ChangeDeathDTO>().ok(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("save")
|
|
|
|
public Result save(@LoginUser TokenDto tokenDto, @RequestBody ChangeDeathDTO dto){
|
|
|
|
dto.setStaffId(tokenDto.getUserId());
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|
|
|
return changeDeathService.save(dto);
|
|
|
|
}
|
|
|
|
|
|
|
|
@NoRepeatSubmit
|
|
|
|
@PostMapping("update")
|
|
|
|
public Result update(@RequestBody ChangeDeathDTO dto){
|
|
|
|
//效验数据
|
|
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
|
|
|
changeDeathService.update(dto);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE})
|
|
|
|
public Result delete(@RequestBody String[] ids){
|
|
|
|
//效验数据
|
|
|
|
AssertUtils.isArrayEmpty(ids, "id");
|
|
|
|
changeDeathService.delete(ids);
|
|
|
|
return new Result();
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("export")
|
|
|
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
|
|
|
List<ChangeDeathDTO> list = changeDeathService.list(params);
|
|
|
|
ExcelUtils.exportExcelToTarget(response, null, list, ChangeDeathExcel.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|