|
@@ -1,16 +1,14 @@
|
|
|
package com.huimv.env.manage.controller;
|
|
|
|
|
|
|
|
|
-import com.huimv.env.manage.entity.EnvPushMessge;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.huimv.env.manage.entity.EnvPushMessage;
|
|
|
import com.huimv.env.manage.service.IEnvPushMessgeService;
|
|
|
import com.huimv.env.manage.utils.Result;
|
|
|
+import com.huimv.env.manage.utils.ResultCode;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-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 org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -34,15 +32,44 @@ public class EnvPushMessgeController {
|
|
|
return envPushMessgeService.listMessge(paramMap);
|
|
|
|
|
|
}
|
|
|
- @PostMapping("/delete")
|
|
|
- public Result delete(@RequestBody Map<String,Integer> paramMap){
|
|
|
- Integer id = paramMap.get("id");
|
|
|
- EnvPushMessge envPushMessge = new EnvPushMessge();
|
|
|
- envPushMessge.setId(id);
|
|
|
- envPushMessge.setId(0);
|
|
|
- envPushMessgeService.updateById(envPushMessge);
|
|
|
+ @GetMapping("/getById")
|
|
|
+ public Result listMessge(@RequestParam(name = "id")Integer id){
|
|
|
+ return new Result(ResultCode.SUCCESS,envPushMessgeService.getById(id));
|
|
|
+
|
|
|
+ }
|
|
|
+ @PostMapping("/update")
|
|
|
+ public Result update(@RequestBody EnvPushMessage envPushMessage){
|
|
|
+ envPushMessgeService.updateById(envPushMessage);
|
|
|
+ return new Result(10000,"修改成功",true);
|
|
|
+
|
|
|
+ }
|
|
|
+ @GetMapping("/updateAll")
|
|
|
+ public Result update(@RequestParam(name = "farmCode")Integer farmCode){
|
|
|
+ UpdateWrapper<EnvPushMessage> wrapper = new UpdateWrapper<>();
|
|
|
+ wrapper.eq("farm_code",farmCode);
|
|
|
+ EnvPushMessage envPushMessage = new EnvPushMessage();
|
|
|
+ envPushMessage.setReadStatus(1);
|
|
|
+ envPushMessgeService.update(envPushMessage,wrapper);
|
|
|
+ return new Result(10000,"修改成功",true);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/delete")
|
|
|
+ public Result delete(@RequestParam(name = "id")Integer id){
|
|
|
+
|
|
|
+ EnvPushMessage envPushMessage = new EnvPushMessage();
|
|
|
+ envPushMessage.setId(id);
|
|
|
+ envPushMessage.setDisplay(0);
|
|
|
+ envPushMessgeService.updateById(envPushMessage);
|
|
|
return new Result(10000,"删除成功",true) ;
|
|
|
|
|
|
}
|
|
|
+ @GetMapping("/countRead")
|
|
|
+ public Result countRead(@RequestParam(name = "farmCode")Integer farmCode){
|
|
|
+
|
|
|
+ return envPushMessgeService.countRead(farmCode);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|