|
@@ -0,0 +1,48 @@
|
|
|
|
+package com.huimv.produce.produce.controller;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.huimv.common.utils.Result;
|
|
|
|
+import com.huimv.common.utils.ResultCode;
|
|
|
|
+import com.huimv.produce.produce.entity.Kesou;
|
|
|
|
+import com.huimv.produce.produce.service.KesouService;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/v1.0.0/kesou")
|
|
|
|
+public class KesouController {
|
|
|
|
+ @Resource
|
|
|
|
+ private KesouService kesouService;
|
|
|
|
+
|
|
|
|
+ @PostMapping("/list")
|
|
|
|
+ public Result listKesou(HttpServletRequest request, @RequestBody Map<String, String> paramsMap){
|
|
|
|
+ String farmId = paramsMap.get("farmId");
|
|
|
|
+ List<Kesou> farm_id = kesouService.list(new QueryWrapper<Kesou>().eq("farm_id", farmId));
|
|
|
|
+ return new Result(ResultCode.SUCCESS,farm_id);
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/add")
|
|
|
|
+ public Result add(HttpServletRequest request, @RequestBody Kesou kesou){
|
|
|
|
+ kesouService.save(kesou);
|
|
|
|
+ return new Result(10000,"添加成功",true);
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/update")
|
|
|
|
+ public Result update(HttpServletRequest request, @RequestBody Kesou kesou){
|
|
|
|
+ kesouService.updateById(kesou);
|
|
|
|
+ return new Result(10000,"修改成功",true);
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/remove")
|
|
|
|
+ public Result remove(HttpServletRequest request, @RequestBody Map<String, String> paramsMap){
|
|
|
|
+ String id = paramsMap.get("id");
|
|
|
|
+ kesouService.removeById(id);
|
|
|
|
+ return new Result(10000,"删除成功",true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|