附件管理
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package com.ktg.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.system.domain.SysAttachment;
|
||||
import com.ktg.system.service.ISysAttachmentService;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 附件Controller
|
||||
*
|
||||
* @author yinjinlu
|
||||
* @date 2022-07-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/attachment")
|
||||
public class SysAttachmentController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysAttachmentService sysAttachmentService;
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysAttachment sysAttachment)
|
||||
{
|
||||
startPage();
|
||||
List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出附件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:export')")
|
||||
@Log(title = "附件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysAttachment sysAttachment)
|
||||
{
|
||||
List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
|
||||
ExcelUtil<SysAttachment> util = new ExcelUtil<SysAttachment>(SysAttachment.class);
|
||||
util.exportExcel(response, list, "附件数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取附件详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:query')")
|
||||
@GetMapping(value = "/{attachmentId}")
|
||||
public AjaxResult getInfo(@PathVariable("attachmentId") Long attachmentId)
|
||||
{
|
||||
return AjaxResult.success(sysAttachmentService.selectSysAttachmentByAttachmentId(attachmentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:add')")
|
||||
@Log(title = "附件", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysAttachment sysAttachment)
|
||||
{
|
||||
return toAjax(sysAttachmentService.insertSysAttachment(sysAttachment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:edit')")
|
||||
@Log(title = "附件", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysAttachment sysAttachment)
|
||||
{
|
||||
return toAjax(sysAttachmentService.updateSysAttachment(sysAttachment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:remove')")
|
||||
@Log(title = "附件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{attachmentIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] attachmentIds)
|
||||
{
|
||||
return toAjax(sysAttachmentService.deleteSysAttachmentByAttachmentIds(attachmentIds));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user