package com.huimv.admin.system.controller;


import com.huimv.admin.system.entity.ProdFarmName;
import com.huimv.admin.system.service.IProdFarmNameService;
import com.huimv.common.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2021-11-20
 */
@RestController
@RequestMapping("/prodFarmName")
public class ProdFarmNameController {
    @Autowired
    IProdFarmNameService farmNameService;

    @GetMapping("/updatName")
    public Result updatName(){
        farmNameService.updatName();
        return new Result(10000,"同步成功",true);
    }

   /* @PostMapping("/add")
    public Result add(@RequestBody ProdFarmName farm){
        farmNameService.save(farm);
        return new Result(10000,"添加成功",true);
    }*/

    @PostMapping("/edit")
    public Result edit(@RequestBody ProdFarmName farm){

        farmNameService.updateById(farm);
        return new Result(10000,"修改成功",true);
    }

    @GetMapping("/remove")
    public Result remove(@RequestParam(name = "ids") List<Integer> ids){
        farmNameService.removeByIds(ids);
        return new Result(10000,"删除成功",true);
    }

    @PostMapping("/listFarmName")
    public Result listFarmName(@RequestBody Map map){
        return farmNameService.listPage(map);
    }
}
