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.BizMerchantEntryAgreement;
import com.ruoyi.web.modules.content.service.IMerchantEntryAgreementService;

/**
 * 平台端商家入驻协议配置
 */
@RestController
@RequestMapping("/agri/merchantEntryAgreement")
public class MerchantEntryAgreementController extends BaseController
{
    @Autowired
    private IMerchantEntryAgreementService agreementService;

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

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