refactor project

This commit is contained in:
Cauchy
2023-10-19 15:04:31 +08:00
parent 19a2ef58a9
commit 1994ba60ae
35 changed files with 274 additions and 226 deletions

View File

@@ -3,7 +3,7 @@ package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.PublisherEntity;
import com.peanut.modules.book.entity.Publisher;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.PublisherService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,9 +40,9 @@ public class PublisherController {
*/
@RequestMapping("/publisherList")
public R publisherList(){
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>());
List<Publisher> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<Publisher>());
ArrayList<Object> list = new ArrayList<>();
for (PublisherEntity publisherEntitie : publisherEntities) {
for (Publisher publisherEntitie : publisherEntities) {
HashMap<Object, Object> map = new HashMap<>();
map.put("id",publisherEntitie.getId());
map.put("value",publisherEntitie.getPublisherName());
@@ -56,7 +56,7 @@ public class PublisherController {
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Integer id){
PublisherEntity publisher = publisherService.getById(id);
Publisher publisher = publisherService.getById(id);
return R.ok().put("publisher", publisher);
}
@@ -68,13 +68,13 @@ public class PublisherController {
public R appGetInfo(@PathVariable("id") Integer id,
@PathVariable("limit") String limit,
@PathVariable("page") String page){
PublisherEntity publisherEntity = publisherService.getById(id);
Publisher publisher = publisherService.getById(id);
HashMap<String, Object> map = new HashMap<>();
map.put("publisherName",publisherEntity.getPublisherName());
map.put("publisherName", publisher.getPublisherName());
map.put("limit",limit);
map.put("page",page);
PageUtils pageUtils = bookService.queryPage(map);
return R.ok().put("publisherInfo", publisherEntity).put("publisherBooks",pageUtils);
return R.ok().put("publisherInfo", publisher).put("publisherBooks",pageUtils);
}
@@ -84,7 +84,7 @@ public class PublisherController {
*/
@RequestMapping("/save")
// @RequiresPermissions("book:publisher:save")
public R save(@RequestBody PublisherEntity publisher){
public R save(@RequestBody Publisher publisher){
publisher.setDelFlag(0);
publisherService.save(publisher);
return R.ok();
@@ -94,7 +94,7 @@ public class PublisherController {
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody PublisherEntity publisher){
public R update(@RequestBody Publisher publisher){
publisherService.updateById(publisher);
return R.ok();
}