package cn.pluss.platform.controller.store;

import cn.pluss.platform.AppletStoreUser.AppletStoreUserService;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.appletStore.AppletStoreService;
import cn.pluss.platform.entity.AppletStore;
import cn.pluss.platform.entity.AppletStoreUser;
import cn.pluss.platform.vo.AppletStoreVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lyf
 */
@RestController
@RequestMapping("/MercApplet")
public class MercAppletController {
    @Resource
    private AppletStoreService appletStoreService;
    @Resource
    private AppletStoreUserService appletStoreUserService;




    @GetMapping("/list")
    public Result<Object> menuList(Integer userId){
        List<AppletStoreVO> list = appletStoreService.getList(userId);
        return ResultGenerator.genSuccessResult(list);
    }

    @PostMapping("/add")
    public Result<Object> addStore(@RequestBody AppletStoreUser appletStoreUser){
        Integer integer = appletStoreUserService.addAppletStoreUser(appletStoreUser);
        if (integer > 0){
            return ResultGenerator.genSuccessResult("");
        }
        return ResultGenerator.genFailResult("");
    }
}
