Commit 4494e04e authored by 王飞's avatar 王飞

Merge branch 'wangfei' into 'dev'

Feat

See merge request !17
parents 29e4eee9 33fdd0d5
...@@ -3,12 +3,15 @@ package com.ruoyi.domain; ...@@ -3,12 +3,15 @@ package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* 书籍 * 书籍
* @TableName t_book * @TableName t_book
*/ */
@ApiModel
@TableName(value ="t_book") @TableName(value ="t_book")
@Data @Data
public class Book extends BaseEntity { public class Book extends BaseEntity {
...@@ -17,12 +20,14 @@ public class Book extends BaseEntity { ...@@ -17,12 +20,14 @@ public class Book extends BaseEntity {
/** /**
* 主键 * 主键
*/ */
@ApiModelProperty("主键")
@TableId @TableId
private Long id; private Long id;
/** /**
* 书名 * 书名
*/ */
@ApiModelProperty("书名")
private String name; private String name;
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ import java.util.List; ...@@ -18,7 +18,7 @@ import java.util.List;
*/ */
@Repository @Repository
public interface BookMapper extends BaseMapper<Book> { public interface BookMapper extends BaseMapper<Book> {
List<Book> selectBookList(Book book); List<Book> selectBookList(@Param("name") String name);
} }
......
...@@ -15,8 +15,8 @@ import java.util.List; ...@@ -15,8 +15,8 @@ import java.util.List;
*/ */
public interface BookService extends IService<Book> { public interface BookService extends IService<Book> {
List<Book> selectBookList(Book book); List<Book> selectBookList(String name);
List<Book> selectBookListException(Book book); List<Book> selectBookListException(String name);
} }
...@@ -27,12 +27,12 @@ public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements Bo ...@@ -27,12 +27,12 @@ public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements Bo
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Override @Override
public List<Book> selectBookList(Book book) { public List<Book> selectBookList(String name) {
return bookMapper.selectBookList(book); return bookMapper.selectBookList(name);
} }
@Override @Override
public List<Book> selectBookListException(Book book) { public List<Book> selectBookListException(String name) {
if(1 == 1) { if(1 == 1) {
throw new ServiceException("测试异常处理"); throw new ServiceException("测试异常处理");
} }
......
package com.ruoyi.web; package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.Book; import com.ruoyi.domain.Book;
import com.ruoyi.service.BookService; import com.ruoyi.service.BookService;
import com.ruoyi.web.request.BookDeleteRequest;
import com.ruoyi.web.request.BookListRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag; import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags; import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace; import org.apache.skywalking.apm.toolkit.trace.Trace;
...@@ -16,45 +20,56 @@ import java.util.Arrays; ...@@ -16,45 +20,56 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
@Api("书籍管理")
@RestController @RestController
@RequestMapping("/book") @RequestMapping("/book")
public class BookController extends BaseController { public class BookController extends BaseController {
@Autowired @Autowired
private BookService bookService; private BookService bookService;
@ApiOperation("添加书籍")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/add") @RequestMapping(method = RequestMethod.POST, value = "/add")
public AjaxResult add(@Validated @RequestBody Book book) { public R add(@Validated @RequestBody Book book) {
return toAjax(bookService.save(book)); bookService.save(book);
return R.ok();
} }
@ApiOperation("修改书籍")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/edit") @RequestMapping(method = RequestMethod.POST, value = "/edit")
public AjaxResult edit(@Validated @RequestBody Book book) { public R edit(@Validated @RequestBody Book book) {
return toAjax(bookService.updateById(book)); bookService.updateById(book);
return R.ok();
} }
@ApiOperation("查询书籍列表")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/list") @RequestMapping(method = RequestMethod.POST, value = "/list")
public TableDataInfo list(@Validated @RequestBody Book book) { public TableDataInfo list(@Validated @RequestBody BookListRequest request) {
startPage(); startPage(request);
List<Book> books = bookService.selectBookList(book); List<Book> books = bookService.selectBookList(request.getName());
return getDataTable(books); return getDataTable(books);
} }
@ApiOperation("删除书籍")
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/remove") @RequestMapping(method = RequestMethod.POST, value = "/remove")
public AjaxResult remove(@Validated @RequestBody Long[] userIds) { public R remove(@Validated @RequestBody BookDeleteRequest request) {
return toAjax(bookService.removeBatchByIds(Arrays.asList(userIds))); bookService.removeBatchByIds(Arrays.asList(request.getIds()));
return R.ok();
} }
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/listException") @RequestMapping(method = RequestMethod.POST, value = "/listException")
public TableDataInfo listException(@Validated @RequestBody Book book) { public TableDataInfo listException(@Validated @RequestBody BookListRequest request) {
startPage(); startPage(request);
List<Book> books = bookService.selectBookListException(book); List<Book> books = bookService.selectBookListException(request.getName());
return getDataTable(books); return getDataTable(books);
} }
......
...@@ -8,8 +8,7 @@ import com.ruoyi.common.enums.BusinessType; ...@@ -8,8 +8,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.service.ReviewSceneChangeTaskService; import com.ruoyi.service.ReviewSceneChangeTaskService;
import com.ruoyi.web.request.ReviewSceneChangeTaskCreateRequest; import com.ruoyi.web.request.*;
import com.ruoyi.web.request.ReviewSceneChangeTaskPassRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag; import org.apache.skywalking.apm.toolkit.trace.Tag;
...@@ -74,8 +73,8 @@ public class ReviewSceneChangeTaskController extends BaseController { ...@@ -74,8 +73,8 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findPending") @RequestMapping(method = RequestMethod.POST, value = "/findPending")
public TableDataInfo<ReviewSceneChangeTask> findPending() { public TableDataInfo<ReviewSceneChangeTask> findPending(@Validated @RequestBody ReviewSceneChangeTaskFindPendingRequest request) {
startPage(); startPage(request);
return getDataTable(reviewSceneChangeTaskService.findPendingListByUserId(getUserId())); return getDataTable(reviewSceneChangeTaskService.findPendingListByUserId(getUserId()));
} }
...@@ -87,8 +86,8 @@ public class ReviewSceneChangeTaskController extends BaseController { ...@@ -87,8 +86,8 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findFinish") @RequestMapping(method = RequestMethod.POST, value = "/findFinish")
public TableDataInfo<ReviewSceneChangeTask> findFinish() { public TableDataInfo<ReviewSceneChangeTask> findFinish(ReviewSceneChangeTaskFindFinishRequest request) {
startPage(); startPage(request);
return getDataTable(reviewSceneChangeTaskService.findFinishListByUserId(getUserId())); return getDataTable(reviewSceneChangeTaskService.findFinishListByUserId(getUserId()));
} }
...@@ -100,8 +99,8 @@ public class ReviewSceneChangeTaskController extends BaseController { ...@@ -100,8 +99,8 @@ public class ReviewSceneChangeTaskController extends BaseController {
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findCreate") @RequestMapping(method = RequestMethod.POST, value = "/findCreate")
public TableDataInfo<ReviewSceneChangeTask> findCreate() { public TableDataInfo<ReviewSceneChangeTask> findCreate(ReviewSceneChangeTaskFindCreateRequest request) {
startPage(); startPage(request);
return getDataTable(reviewSceneChangeTaskService.findCreateListByUserId(getUserId())); return getDataTable(reviewSceneChangeTaskService.findCreateListByUserId(getUserId()));
} }
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class BookDeleteRequest {
@ApiModelProperty("书籍id")
private Long[] ids;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel
@Data
public class BookListRequest extends PageDomain {
@ApiModelProperty("数名")
private String name;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class ReviewSceneChangeTaskFindCreateRequest extends PageDomain {
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class ReviewSceneChangeTaskFindFinishRequest extends PageDomain {
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class ReviewSceneChangeTaskFindPendingRequest extends PageDomain {
}
...@@ -55,6 +55,18 @@ public class BaseController ...@@ -55,6 +55,18 @@ public class BaseController
PageUtils.startPage(); PageUtils.startPage();
} }
/**
* 设置请求分页数据
*/
protected void startPage(PageDomain pageDomain)
{
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
Boolean reasonable = pageDomain.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
/** /**
* 设置请求排序数据 * 设置请求排序数据
*/ */
......
package com.ruoyi.common.core.page; package com.ruoyi.common.core.page;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* 分页数据 * 分页数据
* *
* @author ruoyi * @author ruoyi
*/ */
@ApiModel
public class PageDomain public class PageDomain
{ {
/** 当前记录起始索引 */ /** 当前记录起始索引 */
@ApiModelProperty("当前记录起始索引")
private Integer pageNum; private Integer pageNum;
/** 每页显示记录数 */ /** 每页显示记录数 */
@ApiModelProperty("每页显示记录数")
private Integer pageSize; private Integer pageSize;
/** 排序列 */ /** 排序列 */
@ApiModelProperty("排序列")
private String orderByColumn; private String orderByColumn;
/** 排序的方向desc或者asc */ /** 排序的方向desc或者asc */
@ApiModelProperty("排序的方向desc或者asc")
private String isAsc = "asc"; private String isAsc = "asc";
/** 分页参数合理化 */ /** 分页参数合理化 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment