package com.chaozhanggui.admin.system.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chaozhanggui.admin.system.service.AppMenuService;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.entity.TbPlussAppMenu;
import com.chaozhanggui.system.service.AliPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * app菜单相关
 * @author lyf
 */
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/AppMenu")
@Slf4j
public class AppMenuController {

    @Resource
    private AppMenuService appMenuService;

    /**
     * app菜单相关
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/page")
    @ResponseBody
    public RespBody page(@RequestParam("page")Integer page, @RequestParam("size")Integer size) {
        return appMenuService.getAppMenuList(page,size);
    }

    @PostMapping("/save")
    public RespBody save(@RequestBody TbPlussAppMenu entity) {
        return appMenuService.saveAppMenu(entity);
    }

    @PostMapping("/update")
    public RespBody update(@RequestBody TbPlussAppMenu entity) {
        return appMenuService.saveAppMenu(entity);
    }


    @Resource
    private AliPayService aliPayService;
//    @PostMapping("/AlipayTransferTest")
//    public RespBody AlipayTransferTest() throws Exception{
//        Long l = System.currentTimeMillis();
//        String amount = "0.20";
//        String accountNo = "15619297581";
//        String accountName = "刘一帆";
//        String remake = "11111111111111";
//        String s = aliPayService.alipayTransfer(amount, accountNo, accountName,remake, l.toString());
//        return new RespBody(s);
//    }

}
