package com.lz.modules.luck.controller;


import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.luck.entity.LuckGoods;
import com.lz.modules.luck.service.LuckGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/luckGoods")
public class LuckGoodsController {


    @Autowired
    private LuckGoodsService luckGoodsService;


    @RequestMapping("/list")
     public R list(@RequestBody String body) {
        return R.ok();
     }


     @RequestMapping("/getById")
     public R getById(@RequestBody LuckGoods luckGoods) {
        luckGoods = luckGoodsService.selectLuckGoodsById(luckGoods.getId());
        return R.ok().put("luckGoods",luckGoods);
     }


     @RequestMapping("/update")
     public R update(@RequestBody LuckGoods luckGoods) {
         luckGoodsService.updateLuckGoodsById(luckGoods);
        return R.ok();
     }


     @RequestMapping("/save")
        public R save(@RequestBody LuckGoods luckGoods) {
         luckGoodsService.insertLuckGoods(luckGoods);
        return R.ok();
     }


    @RequestMapping("/delete")
    public R list(@RequestBody Long id) {
        luckGoodsService.deleteLuckGoodsById(id);
        return R.ok();
     }
}
