package com.ruoyi.web.controller.project;
|
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.NotRepeatCommit;
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.exception.base.BaseException;
|
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.project.domain.BaseAnnextype;
|
import com.ruoyi.project.service.IBaseAnnextypeService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang3.ObjectUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Arrays;
|
import java.util.List;
|
|
/**
|
* 捐献附件Controller
|
*
|
* @author ruoyi
|
* @date 2023-11-10
|
*/
|
@Slf4j
|
@Api("捐献附件")
|
@RestController
|
@RequestMapping("/project/annextype")
|
public class BaseAnnextypeController extends BaseController {
|
@Autowired
|
private IBaseAnnextypeService baseAnnextypeService;
|
|
/**
|
* 查询捐献附件列表
|
*/
|
@ApiOperation("查询捐献附件列表")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:list')")
|
@GetMapping("/list")
|
public TableDataInfo list(BaseAnnextype baseAnnextype) {
|
startPage();
|
List<BaseAnnextype> list = baseAnnextypeService.queryList(baseAnnextype);
|
return getDataTable(list);
|
}
|
|
/**
|
* 导出捐献附件列表
|
*/
|
@ApiOperation("导出捐献附件列表")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:export')")
|
@Log(title = "捐献附件", businessType = BusinessType.EXPORT)
|
@GetMapping("/export")
|
public AjaxResult export(BaseAnnextype baseAnnextype) {
|
log.info("导出捐献附件列表{}:", baseAnnextype);
|
List<BaseAnnextype> list = baseAnnextypeService.queryList(baseAnnextype);
|
ExcelUtil<BaseAnnextype> util = new ExcelUtil<BaseAnnextype>(BaseAnnextype.class);
|
return util.exportExcel(list, "捐献附件数据");
|
}
|
|
/**
|
* 获取捐献附件详细信息
|
*/
|
@ApiOperation("获取捐献附件详细信息")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:query')")
|
@GetMapping(value = "/getInfo/{id}")
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
log.info("获取捐献附件详细信息{}:", id);
|
|
return AjaxResult.success(baseAnnextypeService.getById(id));
|
}
|
|
/**
|
* 新增捐献附件
|
*/
|
@ApiOperation("新增捐献附件")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:add')")
|
@Log(title = "捐献附件", businessType = BusinessType.INSERT)
|
@PostMapping("/add")
|
@RepeatSubmit
|
public AjaxResult add(@RequestBody BaseAnnextype baseAnnextype) {
|
log.info("新增捐献附件{}:", baseAnnextype);
|
|
if (ObjectUtils.isEmpty(baseAnnextype) || StringUtils.isEmpty(baseAnnextype.getDonationcategory()) || StringUtils.isEmpty(baseAnnextype.getAnnextype())) {
|
throw new BaseException("请检查捐献类别和附件类型,为空了");
|
}
|
boolean save = baseAnnextypeService.save(baseAnnextype);
|
return AjaxResult.success(baseAnnextype);
|
}
|
|
/**
|
* 修改捐献附件
|
*/
|
@ApiOperation("修改捐献附件")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:edit')")
|
@Log(title = "捐献附件", businessType = BusinessType.UPDATE)
|
@PostMapping("/edit")
|
@RepeatSubmit
|
public AjaxResult edit(@RequestBody BaseAnnextype baseAnnextype) {
|
log.info("修改捐献附件的入参{}:", baseAnnextype);
|
|
if (ObjectUtils.isEmpty(baseAnnextype) || baseAnnextype.getId() == null) {
|
throw new BaseException("修改的条件为空");
|
}
|
return toAjax(baseAnnextypeService.updateById(baseAnnextype));
|
}
|
|
/**
|
* 删除捐献附件
|
*/
|
@ApiOperation("删除捐献附件")
|
// @PreAuthorize("@ss.hasPermi('system:annextype:remove')")
|
@Log(title = "捐献附件", businessType = BusinessType.DELETE)
|
@GetMapping("/remove/{ids}")
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
log.info("删除捐献附件{}:", ids);
|
|
return toAjax(baseAnnextypeService.removeByIds(Arrays.asList(ids)));
|
}
|
}
|