 package com.huimv.management.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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 com.huimv.management.entity.ConsumeWarterEntity;
import com.huimv.management.service.ConsumeWarterService;
import com.huimv.common.utils.PageUtils;
import com.huimv.common.utils.R;



/**
 * 
 *
 * @author yinhao
 * @version ${version}
 * @date 2021-07-12 17:31:40
 */
@RestController
@RequestMapping("management/consumewarter")
public class ConsumeWarterController {
    @Autowired
    private ConsumeWarterService consumeWarterService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = consumeWarterService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		ConsumeWarterEntity consumeWarter = consumeWarterService.getById(id);

        return R.ok().put("consumeWarter", consumeWarter);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ConsumeWarterEntity consumeWarter){
		consumeWarterService.save(consumeWarter);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ConsumeWarterEntity consumeWarter){
		consumeWarterService.updateById(consumeWarter);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		consumeWarterService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
