package com.ruoyi.web.modules.content.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.modules.content.domain.BizMallServiceAgreement;
import com.ruoyi.web.modules.content.service.IMallServiceAgreementService;

/**
 * 平台端商城服务协议配置
 */
@RestController
@RequestMapping("/agri/mallServiceAgreement")
public class MallServiceAgreementController extends BaseController
{
    @Autowired
    private IMallServiceAgreementService agreementService;

    @PreAuthorize("@ss.hasPermi('agri:mallServiceAgreement:query')")
    @GetMapping
    public AjaxResult getConfig()
    {
        return success(agreementService.getConfig());
    }

    @PreAuthorize("@ss.hasPermi('agri:mallServiceAgreement:edit')")
    @Log(title = "商城服务协议", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult save(@RequestBody BizMallServiceAgreement row)
    {
        agreementService.saveConfig(row, getUsername());
        return success();
    }
}
