优化
This commit is contained in:
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.common.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.bo.AnnexRecordQueryBo;
|
||||
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.domain.AnnexRecord;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.service.IAnnexRecordService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件上传记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-20
|
||||
*/
|
||||
@Api(value = "附件上传记录控制器", tags = {"附件上传记录管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/common/record")
|
||||
public class AnnexRecordController extends BaseController {
|
||||
|
||||
private final IAnnexRecordService iCommonAnnexRecordService;
|
||||
|
||||
/**
|
||||
* 查询附件上传记录列表
|
||||
*/
|
||||
@ApiOperation("查询附件上传记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AnnexRecord> list(@Validated AnnexRecordQueryBo bo) {
|
||||
return iCommonAnnexRecordService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出附件上传记录列表
|
||||
*/
|
||||
@ApiOperation("导出附件上传记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:export')")
|
||||
@Log(title = "附件上传记录", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<AnnexRecord> export(@Validated AnnexRecordQueryBo bo) {
|
||||
List<AnnexRecord> list = iCommonAnnexRecordService.queryList(bo);
|
||||
ExcelUtil<AnnexRecord> util = new ExcelUtil<AnnexRecord>(AnnexRecord.class);
|
||||
return util.exportExcel(list, "附件上传记录");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取附件上传记录详细信息
|
||||
*/
|
||||
@ApiOperation("获取附件上传记录详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<AnnexRecord> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iCommonAnnexRecordService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件上传记录
|
||||
*/
|
||||
@ApiOperation("新增附件上传记录")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:add')")
|
||||
@Log(title = "附件上传记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody AnnexRecord bo) {
|
||||
return toAjax(iCommonAnnexRecordService.insert(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件上传记录
|
||||
*/
|
||||
@ApiOperation("修改附件上传记录")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:edit')")
|
||||
@Log(title = "附件上传记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody AnnexRecord bo) {
|
||||
return toAjax(iCommonAnnexRecordService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件上传记录
|
||||
*/
|
||||
@ApiOperation("删除附件上传记录")
|
||||
@PreAuthorize("@ss.hasPermi('common:record:remove')")
|
||||
@Log(title = "附件上传记录" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iCommonAnnexRecordService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user