package com.jeequan.jeepay.mch.ctrl.appmanage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeequan.jeepay.core.aop.MethodLog;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.db.entity.MchAppApplyment;
import com.jeequan.jeepay.mch.ctrl.CommonCtrl;
import com.jeequan.jeepay.service.impl.MchAppApplymentService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 应用管理类
 */
@RestController
@RequestMapping("/api/mchappapplyment")
public class MchAppApplymentController extends CommonCtrl {

    @Autowired
    private MchAppApplymentService mchAppApplymentService;

    /**
     * 查询应用与商户进件数据表
     *
     * @return
     */
    @PreAuthorize("true ")
    @GetMapping
    public ApiRes inquire() {
        MchAppApplyment queryObject = getObject(MchAppApplyment.class);
        //获取分页参数G
        Page<MchAppApplyment> page = getIPage();
        return ApiRes.ok(mchAppApplymentService.appApplymentsInquire(page, queryObject));
    }

    @PreAuthorize("true ")
    @PutMapping
    @MethodLog(remark = "修改调整商户池关联关系")
    public ApiRes update() {
        MchAppApplyment queryObject = getObject(MchAppApplyment.class);
        boolean delAuthenticationFlag = mchAppApplymentService.appApplymentRevamp(queryObject);
        return ApiRes.ok(delAuthenticationFlag);
    }


}
