package com.ruoyi.system.controller;
|
|
import java.util.List;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.system.domain.SysAgreement;
|
import com.ruoyi.system.service.ISysAgreementService;
|
|
/**
|
* 协议配置 操作处理
|
*
|
* 网关把 /system/agreement/** 剥掉 /system 前缀转到这里,故外部路径是 /system/agreement/**。
|
* 只有查、查详情、发布三个接口:协议版本是追加式记录,不提供修改与删除,
|
* 「新发布」(先选类型再填内容)与「发布新版本」(基于已有版本再发一版)都走同一个 POST。
|
*
|
* @author ruoyi
|
*/
|
@RestController
|
@RequestMapping("/agreement")
|
public class SysAgreementController extends BaseController
|
{
|
@Autowired
|
private ISysAgreementService agreementService;
|
|
/**
|
* 查询协议版本列表
|
*/
|
@RequiresPermissions("system:agreement:list")
|
@GetMapping("/list")
|
public TableDataInfo list(SysAgreement agreement)
|
{
|
startPage();
|
List<SysAgreement> list = agreementService.selectAgreementList(agreement);
|
return getDataTable(list);
|
}
|
|
/**
|
* 根据协议编号获取详细信息
|
*/
|
@RequiresPermissions("system:agreement:query")
|
@GetMapping(value = "/{agreementId}")
|
public AjaxResult getInfo(@PathVariable Long agreementId)
|
{
|
return success(agreementService.selectAgreementById(agreementId));
|
}
|
|
/**
|
* 发布协议版本
|
*/
|
@RequiresPermissions("system:agreement:add")
|
@Log(title = "协议发布", businessType = BusinessType.INSERT)
|
@PostMapping
|
public AjaxResult publish(@Validated @RequestBody SysAgreement agreement)
|
{
|
agreement.setCreateBy(SecurityUtils.getUsername());
|
return toAjax(agreementService.publishAgreement(agreement));
|
}
|
}
|