package com.ruixuan.jinniu.controller;


import com.alibaba.fastjson.JSONObject;
import com.ruixuan.common.core.controller.BaseController;
import com.ruixuan.common.core.domain.AjaxResult;
import com.ruixuan.common.core.page.TableDataInfo;
import com.ruixuan.jinniu.entity.KuaishouTransferAccount;
import com.ruixuan.jinniu.service.IKuaishouTransferAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 账户转让记录Controller
 *
 * @author ruoyi
 * @date 2023-03-16
 */
@Api(tags = "账户转让记录Controller")
@RestController
@RequestMapping("/kuaishou/transfer")
public class KuaishouTransferAccountController extends BaseController {
    @Autowired
    private IKuaishouTransferAccountService kuaishouTransferAccountService;

    /**
     * 查询账户转让记录列表
     */
    @ApiOperation(value = "查询账户转让记录列表")
    @GetMapping("/list")
    public TableDataInfo list(KuaishouTransferAccount account) {
        List<JSONObject> list = kuaishouTransferAccountService.selectKuaishouTransferAccountList(account);
        return getDataTable(list);
    }

    /**
     * 新增账户转让记录
     */
    @ApiOperation(value = "新增账户转让记录")
    @PostMapping("/addTransferAccount")
    public AjaxResult addTransferAccount(@RequestBody KuaishouTransferAccount kuaishouTransferAccount) {
        return toAjax(kuaishouTransferAccountService.insertKuaishouTransferAccount(kuaishouTransferAccount));
    }

    /**
     * 更新账户转让状态
     */
    @ApiOperation(value = "更新账户转让状态")
    @PostMapping("/editTransferAccountStatus")
    public AjaxResult editTransferAccountStatus(@RequestBody KuaishouTransferAccount kuaishouTransferAccount) {
        return toAjax(kuaishouTransferAccountService.updateKuaishouTransferAccount(kuaishouTransferAccount));
    }
}
