Search in sources :

Example 6 with BookDTO

use of com.github.lybgeek.swagger.dto.BookDTO in project springboot-learning by lyb-geek.

the class BookController method getBookById.

@PostMapping(value = "/get/{id}")
@ApiOperation(value = "查找书籍", notes = "根据书籍编号查找书籍")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "书籍编号", dataType = "Long", required = true) })
public Result<BookDTO> getBookById(@PathVariable("id") Long id) {
    Result<BookDTO> result = new Result<>();
    BookDTO book = bookService.getBookById(id);
    result.setData(book);
    return result;
}
Also used : BookDTO(com.github.lybgeek.swagger.dto.BookDTO) Result(com.github.lybgeek.common.model.Result) PageResult(com.github.lybgeek.common.model.PageResult) BindingResult(org.springframework.validation.BindingResult) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 7 with BookDTO

use of com.github.lybgeek.swagger.dto.BookDTO in project springboot-learning by lyb-geek.

the class BookServiceImpl method getBookById.

@Override
public BookDTO getBookById(Long id) {
    Book dbBook = baseMapper.selectById(id);
    BookDTO bookDTO = dozerMapper.map(dbBook, BookDTO.class);
    return bookDTO;
}
Also used : BookDTO(com.github.lybgeek.swagger.dto.BookDTO) Book(com.github.lybgeek.swagger.model.Book)

Aggregations

BookDTO (com.github.lybgeek.swagger.dto.BookDTO)7 PageResult (com.github.lybgeek.common.model.PageResult)3 Result (com.github.lybgeek.common.model.Result)3 Book (com.github.lybgeek.swagger.model.Book)3 BindingResult (org.springframework.validation.BindingResult)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 IPage (com.baomidou.mybatisplus.core.metadata.IPage)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 BizException (com.github.lybgeek.common.exception.BizException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 Transactional (org.springframework.transaction.annotation.Transactional)1