liujie
昨天 c983a0a398504697a777ffae48e59961b5ee2bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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));
    }
}