|
@@ -0,0 +1,52 @@
|
|
|
+package com.sqx.modules.lostAndFound.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.sqx.common.utils.Result;
|
|
|
+import com.sqx.modules.app.annotation.Login;
|
|
|
+import com.sqx.modules.lostAndFound.entity.LostFound;
|
|
|
+import com.sqx.modules.lostAndFound.service.LostFoundService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Api(value = "失物招领", tags = {"失物招领"})
|
|
|
+@RequestMapping("/app/lostFound")
|
|
|
+public class LostFoundController {
|
|
|
+ @Resource
|
|
|
+ private LostFoundService lostFoundService;
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @PostMapping("/insert")
|
|
|
+ @ApiOperation("新增")
|
|
|
+ public Result insert(@RequestAttribute("userId")Long userId, LostFound lostFound){
|
|
|
+ lostFound.setUserId(userId);
|
|
|
+ return lostFoundService.insert(lostFound);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Login
|
|
|
+ @GetMapping("/select")
|
|
|
+ @ApiOperation("查询")
|
|
|
+ public Result select(@RequestAttribute("userId")Long userId,Integer type){
|
|
|
+ List<LostFound> list = lostFoundService.list(new QueryWrapper<LostFound>().eq("user_id", userId).eq("type", type));
|
|
|
+ return Result.success().put("data",list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation("修改")
|
|
|
+ public Result update(LostFound lostFound){
|
|
|
+ lostFoundService.updateById(lostFound);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @ApiOperation("删除")
|
|
|
+ public Result delete(Long id){
|
|
|
+ lostFoundService.removeById(id);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|