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

k.e.book.ddh.controller.CcIntegralTransferController 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.CcIntegralTransferAddDTO;
import k.e.book.ddh.entity.CcIntegralTransferDO;
import k.e.book.ddh.entity.CcIntegralTransferQueryDTO;
import k.e.book.ddh.entity.CcIntegralTransferVO;
import k.e.book.ddh.service.CcIntegralTransferService;
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 = "CcIntegralTransfer相关文档")
@RestController
@RequestMapping("/ccIntegralTransfer")
public class CcIntegralTransferController {
    @Resource
    private CcIntegralTransferService ccIntegralTransferService;

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

    @ApiOperation("根据 id 查询CcIntegralTransfer信息")
    @GetMapping(value = "/get")
    public Result getCcIntegralTransferById(@RequestParam("id") @ApiParam(value = "ccIntegralTransferD") Long id) {
        return Result.success(CcIntegralTransferDO.toVO(ccIntegralTransferService.getById(id)));
    }

    @ApiOperation("新增CcIntegralTransfer")
    @PostMapping("/add")
    public Result addCcIntegralTransfer(@RequestBody @Valid CcIntegralTransferAddDTO dto) {
        CcIntegralTransferDO entity = CcIntegralTransferDO.toDO(dto);
        ccIntegralTransferService.save(entity);
        return getCcIntegralTransferById(entity.getId());
    }

    @ApiOperation("删除CcIntegralTransfer")
    @DeleteMapping("/delete")
    public Result deleteCcIntegralTransferById(@RequestParam("id") @ApiParam(value = "ccIntegralTransferID") Long id) {
        ccIntegralTransferService.removeById(id);
        return Result.success();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy