|
@@ -23,28 +23,32 @@ import com.xjrsoft.module.system.service.ICodeRuleService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/personnel" + "/facemanager")
|
|
|
-@Api(value = "/personnel" + "/facemanager",tags = "人脸管理")
|
|
|
+@Api(value = "/personnel" + "/facemanager", tags = "人脸管理")
|
|
|
@AllArgsConstructor
|
|
|
public class FaceManagementController {
|
|
|
- private final IFaceManagementService faceManagementService;
|
|
|
+ private final IFaceManagementService faceManagementService;
|
|
|
private ICodeRuleService codeRuleService;
|
|
|
|
|
|
@GetMapping(value = "/page")
|
|
|
- @ApiOperation(value="人脸列表(分页)")
|
|
|
+ @ApiOperation(value = "人脸列表(分页)")
|
|
|
@SaCheckPermission("facemanager:detail")
|
|
|
- public R Page(@Valid FaceManagementPageDto dto){
|
|
|
+ public R Page(@Valid FaceManagementPageDto dto) {
|
|
|
MPJLambdaWrapper<FaceManagement> queryWrapper = new MPJLambdaWrapper<>();
|
|
|
queryWrapper
|
|
|
.like(StrUtil.isNotBlank(dto.getFaceCode()), FaceManagement::getFaceCode, dto.getFaceCode())
|
|
|
.like(ObjectUtil.isNotNull(dto.getName()), FaceManagement::getName, dto.getName())
|
|
|
- .select(FaceManagement.class,x -> VoToColumnUtil.fieldsToColumns(FaceManagementVo.class).contains(x.getProperty()));
|
|
|
+ .select(FaceManagement.class, x -> VoToColumnUtil.fieldsToColumns(FaceManagementVo.class).contains(x.getProperty()));
|
|
|
|
|
|
IPage<FaceManagement> page = faceManagementService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
PageOutput<FaceManagementVo> pageOutput = ConventPage.getPageOutput(page, FaceManagementVo.class);
|
|
@@ -52,9 +56,9 @@ public class FaceManagementController {
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/info")
|
|
|
- @ApiOperation(value="根据id查询人脸信息")
|
|
|
+ @ApiOperation(value = "根据id查询人脸信息")
|
|
|
@SaCheckPermission("facemanager:detail")
|
|
|
- public R info(@RequestParam Long id){
|
|
|
+ public R info(@RequestParam Long id) {
|
|
|
FaceManagement faceManagement = faceManagementService.getByIdDeep(id);
|
|
|
if (faceManagement == null) {
|
|
|
return R.error("找不到此数据!");
|
|
@@ -63,7 +67,7 @@ public class FaceManagementController {
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/detail")
|
|
|
- @ApiOperation(value="根据当前用户查询人脸信息")
|
|
|
+ @ApiOperation(value = "根据当前用户查询人脸信息")
|
|
|
@SaCheckPermission("facemanager:detail")
|
|
|
public R detail() {
|
|
|
SaSession tokenSession = StpUtil.getTokenSession();
|
|
@@ -75,10 +79,10 @@ public class FaceManagementController {
|
|
|
return R.ok(BeanUtil.toBean(faceManagement, FaceManagementVo.class));
|
|
|
}
|
|
|
|
|
|
- @PostMapping
|
|
|
- @ApiOperation(value = "新增人脸")
|
|
|
+ @RequestMapping(method = POST, consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
|
|
|
+ @ApiOperation(value = "新增人脸", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
@SaCheckPermission("facemanager:add")
|
|
|
- public R add(@Valid @RequestBody AddFaceManagementDto dto){
|
|
|
+ public R add(@Valid @RequestBody AddFaceManagementDto dto, @RequestPart MultipartFile file) {
|
|
|
FaceManagement faceManagement = BeanUtil.toBean(dto, FaceManagement.class);
|
|
|
boolean isSuccess = faceManagementService.add(faceManagement);
|
|
|
codeRuleService.useEncode("FACECODE");
|
|
@@ -89,7 +93,7 @@ public class FaceManagementController {
|
|
|
@PutMapping
|
|
|
@ApiOperation(value = "修改人脸")
|
|
|
@SaCheckPermission("facemanager:edit")
|
|
|
- public R update(@Valid @RequestBody UpdateFaceManagementDto dto){
|
|
|
+ public R update(@Valid @RequestBody UpdateFaceManagementDto dto) {
|
|
|
|
|
|
FaceManagement faceManagement = BeanUtil.toBean(dto, FaceManagement.class);
|
|
|
return R.ok(faceManagementService.update(faceManagement));
|
|
@@ -107,7 +111,7 @@ public class FaceManagementController {
|
|
|
@DeleteMapping
|
|
|
@ApiOperation(value = "删除")
|
|
|
@SaCheckPermission("facemanager:delete")
|
|
|
- public R delete(@Valid @RequestBody List<Long> ids){
|
|
|
+ public R delete(@Valid @RequestBody List<Long> ids) {
|
|
|
return R.ok(faceManagementService.delete(ids));
|
|
|
}
|
|
|
}
|