Sfoglia il codice sorgente

新增失物招领接口

hjp 1 settimana fa
parent
commit
80e7d970cb

+ 6 - 0
pom.xml

@@ -447,6 +447,12 @@
 			<artifactId>sdk</artifactId>
 			<version>1.0.0</version>
 		</dependency>
+		<!-- 快手开放平台  可能没用,需要快手本地生活开放平台 -->
+		<dependency>
+			<groupId>com.github.kwaiopen</groupId>
+			<artifactId>kwai-open-sdk</artifactId>
+			<version>1.0.6</version>
+		</dependency>
 
 	</dependencies>
 

+ 52 - 0
src/main/java/com/sqx/modules/lostAndFound/controller/LostFoundController.java

@@ -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();
+    }
+
+}

+ 9 - 0
src/main/java/com/sqx/modules/lostAndFound/dao/LostFoundDao.java

@@ -0,0 +1,9 @@
+package com.sqx.modules.lostAndFound.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sqx.modules.lostAndFound.entity.LostFound;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface LostFoundDao extends BaseMapper<LostFound> {
+}

+ 41 - 0
src/main/java/com/sqx/modules/lostAndFound/entity/LostFound.java

@@ -0,0 +1,41 @@
+package com.sqx.modules.lostAndFound.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.models.auth.In;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class LostFound implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(type = IdType.AUTO)
+    /**
+     * id
+     */
+    private Long id;
+
+    private String name;
+
+    private String phone;
+
+    private String description;
+
+    private String image;
+
+    private Integer loss;
+
+    private Long userId;
+
+    private Long ordersId;
+
+    private Date createTime;
+
+    private Date foundTime;
+
+    private Integer type;
+}

+ 10 - 0
src/main/java/com/sqx/modules/lostAndFound/service/LostFoundService.java

@@ -0,0 +1,10 @@
+package com.sqx.modules.lostAndFound.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.sqx.modules.lostAndFound.entity.LostFound;
+import com.sqx.common.utils.Result;
+
+public interface LostFoundService extends IService<LostFound> {
+
+    Result insert(LostFound lostFound);
+}

+ 19 - 0
src/main/java/com/sqx/modules/lostAndFound/service/impl/LostFoundServiceImpl.java

@@ -0,0 +1,19 @@
+package com.sqx.modules.lostAndFound.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sqx.common.utils.Result;
+import com.sqx.modules.lostAndFound.dao.LostFoundDao;
+import com.sqx.modules.lostAndFound.entity.LostFound;
+import com.sqx.modules.lostAndFound.service.LostFoundService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+public class LostFoundServiceImpl extends ServiceImpl<LostFoundDao, LostFound> implements LostFoundService {
+
+    @Override
+    public Result insert(LostFound lostFound) {
+        return Result.success().put("data",baseMapper.insert(lostFound));
+    }
+}