All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.ddh.controller.CcFaceidController Maven / Gradle / Ivy


package k.e.book.ddh.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import k.e.book.common.model.Result;
import k.e.book.ddh.entity.CcFaceidAddDTO;
import k.e.book.ddh.entity.CcFaceidDO;
import k.e.book.ddh.entity.CcFaceidQueryDTO;
import k.e.book.ddh.entity.CcFaceidVO;
import k.e.book.ddh.service.CcFaceidService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author kk
 * @date 2023-05-21 11:13
 */

@Api(tags = "CcFaceid相关文档")
@RestController
@RequestMapping("/ccFaceid")
public class CcFaceidController {
    @Resource
    private CcFaceidService ccFaceidService;

    @ApiOperation("分页查询CcFaceid信息")
    @PostMapping(value = "/page")
    public Result> queryPage(@RequestBody @Valid  CcFaceidQueryDTO dto) {
        IPage page = ccFaceidService.selectProductPage(dto);
        List records = page.getRecords();
        return Result.success(records.stream().map(CcFaceidDO::toVO).filter(Objects::nonNull).collect(Collectors.toList()), page.getTotal());
    }

    @ApiOperation("根据 id 查询CcFaceid信息")
    @GetMapping(value = "/get")
    public Result getCcFaceidById(@RequestParam("id") @ApiParam(value = "ccFaceidD") Long id) {
        return Result.success(CcFaceidDO.toVO(ccFaceidService.getById(id)));
    }

    @ApiOperation("新增CcFaceid")
    @PostMapping("/add")
    public Result addCcFaceid(@RequestBody @Valid CcFaceidAddDTO dto) {
        CcFaceidDO entity = CcFaceidDO.toDO(dto);
        ccFaceidService.save(entity);
        return getCcFaceidById(entity.getId());
    }

    @ApiOperation("删除CcFaceid")
    @DeleteMapping("/delete")
    public Result deleteCcFaceidById(@RequestParam("id") @ApiParam(value = "ccFaceidID") Long id) {
        ccFaceidService.removeById(id);
        return Result.success();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy