package com.pj.tb_agreement;


import com.pj.utils.sg.AjaxJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
* APP端服务协议
*
* @author loovi
* @date
*/
@RestController
@RequestMapping("/app/TbAgreement/")
public class TbAgreementAppController {

    @Autowired
    TbAgreementService tbAgreementService;

    /**
    *APP端获取服务协议
    *
    * @author loovi
    * @date
    */
    @RequestMapping("getById")
    public AjaxJson getById( Long id){
        // 根据id获取服务协议
        TbAgreement tbAgreement = tbAgreementService.getById(id);
        // 若无此服务协议，返回错误
        if(Objects.isNull(tbAgreement)){
            AjaxJson.getError("没有此协议");
        }
        // 返回获取的服务协议
        return AjaxJson.getSuccessData(tbAgreement);
    }
}
