添加用户人脸相关的基础业务接口和实现
This commit is contained in:
parent
4538cf9f7b
commit
95cf0397e1
@ -0,0 +1,64 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.service.pc.FaceService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/2 16:33
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/face/v1")
|
||||
@Api(tags = "用户上传人脸管理")
|
||||
public class FaceController {
|
||||
@Autowired
|
||||
private FaceService faceService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@PostMapping("/page")
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(@RequestBody FaceReqQuery faceReqQuery) {
|
||||
return faceService.pageQuery(faceReqQuery);
|
||||
}
|
||||
@ApiOperation("列表查询")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse<List<FaceRespVO>> list(@RequestBody FaceReqQuery faceReqQuery) {
|
||||
return faceService.list(faceReqQuery);
|
||||
}
|
||||
@ApiOperation("详情查询")
|
||||
@GetMapping("/getDetail/{id}")
|
||||
public ApiResponse<FaceRespVO> getDetail(@PathVariable("id") Long id) {
|
||||
return faceService.getById(id);
|
||||
}
|
||||
@ApiOperation("添加")
|
||||
@PostMapping("/add")
|
||||
public ApiResponse<Integer> add(@RequestBody FaceEntity face) {
|
||||
return faceService.add(face);
|
||||
}
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/deleteById/{id}")
|
||||
public ApiResponse<Integer> deleteById(@PathVariable Long id) {
|
||||
return faceService.deleteById(id);
|
||||
}
|
||||
@ApiOperation("批量删除")
|
||||
@PostMapping("/deleteByIds")
|
||||
public ApiResponse<Integer> deleteByIds(@RequestBody List<Long> ids) {
|
||||
return faceService.deleteByIds(ids);
|
||||
}
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/update")
|
||||
public ApiResponse<Integer> update(@RequestBody FaceEntity face) {
|
||||
return faceService.update(face);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -19,6 +19,6 @@ public interface FaceMapper {
|
||||
FaceRespVO getById(Long id);
|
||||
int add(FaceEntity face);
|
||||
int deleteById(Long id);
|
||||
int deleteByIds(@Param("list") Long ids);
|
||||
int deleteByIds(@Param("list") List<Long> ids);
|
||||
int update(FaceEntity face);
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.ycwl.basic.service.impl.pc;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.mapper.pc.FaceMapper;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.service.pc.FaceService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/2 16:39
|
||||
*/
|
||||
@Service
|
||||
public class FaceServiceImpl implements FaceService {
|
||||
@Autowired
|
||||
private FaceMapper faceMapper;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
PageHelper.startPage(faceReqQuery.getPageNum(),faceReqQuery.getPageSize());
|
||||
List<FaceRespVO> list = faceMapper.list(faceReqQuery);
|
||||
PageInfo<FaceRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.buildSuccessResponse(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<List<FaceRespVO>> list(FaceReqQuery faceReqQuery) {
|
||||
return ApiResponse.buildSuccessResponse(faceMapper.list(faceReqQuery));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<FaceRespVO> getById(Long id) {
|
||||
return ApiResponse.buildSuccessResponse(faceMapper.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<Integer> add(FaceEntity face) {
|
||||
int i = faceMapper.add(face);
|
||||
if (i == 0) {
|
||||
return ApiResponse.buildCommonErrorResponse("添加失败");
|
||||
}
|
||||
return ApiResponse.buildSuccessResponse(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<Integer> deleteById(Long id) {
|
||||
int i = faceMapper.deleteById(id);
|
||||
if (i == 0) {
|
||||
return ApiResponse.buildCommonErrorResponse("删除失败");
|
||||
}
|
||||
return ApiResponse.buildSuccessResponse(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<Integer> deleteByIds(List<Long> ids) {
|
||||
int i = faceMapper.deleteByIds(ids);
|
||||
if (i == 0) {
|
||||
return ApiResponse.buildCommonErrorResponse("删除失败");
|
||||
}
|
||||
return ApiResponse.buildSuccessResponse(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<Integer> update(FaceEntity face) {
|
||||
int i = faceMapper.update(face);
|
||||
if (i == 0) {
|
||||
return ApiResponse.buildCommonErrorResponse("修改失败");
|
||||
}
|
||||
return ApiResponse.buildSuccessResponse(i);
|
||||
}
|
||||
}
|
24
src/main/java/com/ycwl/basic/service/pc/FaceService.java
Normal file
24
src/main/java/com/ycwl/basic/service/pc/FaceService.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/2 16:34
|
||||
*/
|
||||
public interface FaceService {
|
||||
ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery);
|
||||
ApiResponse<List<FaceRespVO>> list(FaceReqQuery faceReqQuery);
|
||||
ApiResponse<FaceRespVO> getById(Long id);
|
||||
ApiResponse<Integer> add(FaceEntity face);
|
||||
ApiResponse<Integer> deleteById(Long id);
|
||||
ApiResponse<Integer> deleteByIds(List<Long> ids);
|
||||
ApiResponse<Integer> update(FaceEntity face);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user