✨Feat: 图书管理模块
This commit is contained in:
@@ -16,5 +16,11 @@
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.manage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.manage.domain.Book;
|
||||
import com.ruoyi.manage.service.IBookService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 书籍Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/book")
|
||||
public class BookController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBookService bookService;
|
||||
|
||||
/**
|
||||
* 查询书籍列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Book book)
|
||||
{
|
||||
startPage();
|
||||
List<Book> list = bookService.selectBookList(book);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出书籍列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:export')")
|
||||
@Log(title = "书籍", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Book book)
|
||||
{
|
||||
List<Book> list = bookService.selectBookList(book);
|
||||
ExcelUtil<Book> util = new ExcelUtil<Book>(Book.class);
|
||||
util.exportExcel(response, list, "书籍数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取书籍详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(bookService.selectBookById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增书籍
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:add')")
|
||||
@Log(title = "书籍", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Book book)
|
||||
{
|
||||
return toAjax(bookService.insertBook(book));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改书籍
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:edit')")
|
||||
@Log(title = "书籍", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Book book)
|
||||
{
|
||||
return toAjax(bookService.updateBook(book));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除书籍
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:book:remove')")
|
||||
@Log(title = "书籍", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(bookService.deleteBookByIds(ids));
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.manage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.manage.domain.Category;
|
||||
import com.ruoyi.manage.service.ICategoryService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 类别Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/category")
|
||||
public class CategoryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 查询类别列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Category category)
|
||||
{
|
||||
startPage();
|
||||
List<Category> list = categoryService.selectCategoryList(category);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出类别列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:export')")
|
||||
@Log(title = "类别", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Category category)
|
||||
{
|
||||
List<Category> list = categoryService.selectCategoryList(category);
|
||||
ExcelUtil<Category> util = new ExcelUtil<Category>(Category.class);
|
||||
util.exportExcel(response, list, "类别数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类别详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(categoryService.selectCategoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增类别
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:add')")
|
||||
@Log(title = "类别", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Category category)
|
||||
{
|
||||
return toAjax(categoryService.insertCategory(category));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改类别
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:edit')")
|
||||
@Log(title = "类别", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Category category)
|
||||
{
|
||||
return toAjax(categoryService.updateCategory(category));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除类别
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:category:remove')")
|
||||
@Log(title = "类别", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(categoryService.deleteCategoryByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.manage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.manage.domain.Region;
|
||||
import com.ruoyi.manage.service.IRegionService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 区域Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/region")
|
||||
public class RegionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRegionService regionService;
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Region region)
|
||||
{
|
||||
startPage();
|
||||
List<Region> list = regionService.selectRegionList(region);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出区域列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:export')")
|
||||
@Log(title = "区域", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Region region)
|
||||
{
|
||||
List<Region> list = regionService.selectRegionList(region);
|
||||
ExcelUtil<Region> util = new ExcelUtil<Region>(Region.class);
|
||||
util.exportExcel(response, list, "区域数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(regionService.selectRegionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:add')")
|
||||
@Log(title = "区域", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Region region)
|
||||
{
|
||||
return toAjax(regionService.insertRegion(region));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:edit')")
|
||||
@Log(title = "区域", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Region region)
|
||||
{
|
||||
return toAjax(regionService.updateRegion(region));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区域
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:region:remove')")
|
||||
@Log(title = "区域", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(regionService.deleteRegionByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.ruoyi.manage.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 书籍对象 lb_book
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public class Book extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 书籍ID */
|
||||
private Long id;
|
||||
|
||||
/** 书籍名称 */
|
||||
@Excel(name = "书籍名称")
|
||||
private String bookName;
|
||||
|
||||
/** 封面 */
|
||||
@Excel(name = "封面")
|
||||
private String cover;
|
||||
|
||||
/** 作者 */
|
||||
@Excel(name = "作者")
|
||||
private String author;
|
||||
|
||||
/** 出版社 */
|
||||
@Excel(name = "出版社")
|
||||
private String publisher;
|
||||
|
||||
/** 出版日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "出版日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date publishDate;
|
||||
|
||||
/** 价格 */
|
||||
@Excel(name = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
/** 数量 */
|
||||
@Excel(name = "数量")
|
||||
private Long quantity;
|
||||
|
||||
/** 区域ID */
|
||||
@Excel(name = "区域ID")
|
||||
private Long regionId;
|
||||
|
||||
/** 类别ID */
|
||||
@Excel(name = "类别ID")
|
||||
private Long categoryId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setBookName(String bookName)
|
||||
{
|
||||
this.bookName = bookName;
|
||||
}
|
||||
|
||||
public String getBookName()
|
||||
{
|
||||
return bookName;
|
||||
}
|
||||
|
||||
public void setCover(String cover)
|
||||
{
|
||||
this.cover = cover;
|
||||
}
|
||||
|
||||
public String getCover()
|
||||
{
|
||||
return cover;
|
||||
}
|
||||
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setPublisher(String publisher)
|
||||
{
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public String getPublisher()
|
||||
{
|
||||
return publisher;
|
||||
}
|
||||
|
||||
public void setPublishDate(Date publishDate)
|
||||
{
|
||||
this.publishDate = publishDate;
|
||||
}
|
||||
|
||||
public Date getPublishDate()
|
||||
{
|
||||
return publishDate;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setQuantity(Long quantity)
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Long getQuantity()
|
||||
{
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setRegionId(Long regionId)
|
||||
{
|
||||
this.regionId = regionId;
|
||||
}
|
||||
|
||||
public Long getRegionId()
|
||||
{
|
||||
return regionId;
|
||||
}
|
||||
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("bookName", getBookName())
|
||||
.append("cover", getCover())
|
||||
.append("author", getAuthor())
|
||||
.append("publisher", getPublisher())
|
||||
.append("publishDate", getPublishDate())
|
||||
.append("price", getPrice())
|
||||
.append("quantity", getQuantity())
|
||||
.append("regionId", getRegionId())
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.manage.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 类别对象 lb_category
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public class Category extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 类别ID */
|
||||
private Long id;
|
||||
|
||||
/** 类别名称 */
|
||||
@Excel(name = "类别名称")
|
||||
private String categoryName;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.manage.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 区域对象 lb_region
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public class Region extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 区域ID */
|
||||
private Long id;
|
||||
|
||||
/** 区域名称 */
|
||||
@Excel(name = "区域名称")
|
||||
private String regionName;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setRegionName(String regionName)
|
||||
{
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
public String getRegionName()
|
||||
{
|
||||
return regionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("regionName", getRegionName())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Book;
|
||||
|
||||
/**
|
||||
* 书籍Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface BookMapper
|
||||
{
|
||||
/**
|
||||
* 查询书籍
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 书籍
|
||||
*/
|
||||
public Book selectBookById(Long id);
|
||||
|
||||
/**
|
||||
* 查询书籍列表
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 书籍集合
|
||||
*/
|
||||
public List<Book> selectBookList(Book book);
|
||||
|
||||
/**
|
||||
* 新增书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBook(Book book);
|
||||
|
||||
/**
|
||||
* 修改书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBook(Book book);
|
||||
|
||||
/**
|
||||
* 删除书籍
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBookById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除书籍
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBookByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Category;
|
||||
|
||||
/**
|
||||
* 类别Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface CategoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询类别
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 类别
|
||||
*/
|
||||
public Category selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询类别列表
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 类别集合
|
||||
*/
|
||||
public List<Category> selectCategoryList(Category category);
|
||||
|
||||
/**
|
||||
* 新增类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(Category category);
|
||||
|
||||
/**
|
||||
* 修改类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(Category category);
|
||||
|
||||
/**
|
||||
* 删除类别
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除类别
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Region;
|
||||
|
||||
/**
|
||||
* 区域Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface RegionMapper
|
||||
{
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 区域
|
||||
*/
|
||||
public Region selectRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 区域集合
|
||||
*/
|
||||
public List<Region> selectRegionList(Region region);
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRegion(Region region);
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRegion(Region region);
|
||||
|
||||
/**
|
||||
* 删除区域
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除区域
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRegionByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Book;
|
||||
|
||||
/**
|
||||
* 书籍Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface IBookService
|
||||
{
|
||||
/**
|
||||
* 查询书籍
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 书籍
|
||||
*/
|
||||
public Book selectBookById(Long id);
|
||||
|
||||
/**
|
||||
* 查询书籍列表
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 书籍集合
|
||||
*/
|
||||
public List<Book> selectBookList(Book book);
|
||||
|
||||
/**
|
||||
* 新增书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBook(Book book);
|
||||
|
||||
/**
|
||||
* 修改书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBook(Book book);
|
||||
|
||||
/**
|
||||
* 批量删除书籍
|
||||
*
|
||||
* @param ids 需要删除的书籍主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBookByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除书籍信息
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBookById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Category;
|
||||
|
||||
/**
|
||||
* 类别Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface ICategoryService
|
||||
{
|
||||
/**
|
||||
* 查询类别
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 类别
|
||||
*/
|
||||
public Category selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询类别列表
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 类别集合
|
||||
*/
|
||||
public List<Category> selectCategoryList(Category category);
|
||||
|
||||
/**
|
||||
* 新增类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(Category category);
|
||||
|
||||
/**
|
||||
* 修改类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(Category category);
|
||||
|
||||
/**
|
||||
* 批量删除类别
|
||||
*
|
||||
* @param ids 需要删除的类别主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除类别信息
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.manage.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.manage.domain.Region;
|
||||
|
||||
/**
|
||||
* 区域Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
public interface IRegionService
|
||||
{
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 区域
|
||||
*/
|
||||
public Region selectRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 区域集合
|
||||
*/
|
||||
public List<Region> selectRegionList(Region region);
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRegion(Region region);
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRegion(Region region);
|
||||
|
||||
/**
|
||||
* 批量删除区域
|
||||
*
|
||||
* @param ids 需要删除的区域主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRegionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除区域信息
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRegionById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.manage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.manage.mapper.BookMapper;
|
||||
import com.ruoyi.manage.domain.Book;
|
||||
import com.ruoyi.manage.service.IBookService;
|
||||
|
||||
/**
|
||||
* 书籍Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@Service
|
||||
public class BookServiceImpl implements IBookService
|
||||
{
|
||||
@Autowired
|
||||
private BookMapper bookMapper;
|
||||
|
||||
/**
|
||||
* 查询书籍
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 书籍
|
||||
*/
|
||||
@Override
|
||||
public Book selectBookById(Long id)
|
||||
{
|
||||
return bookMapper.selectBookById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询书籍列表
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 书籍
|
||||
*/
|
||||
@Override
|
||||
public List<Book> selectBookList(Book book)
|
||||
{
|
||||
return bookMapper.selectBookList(book);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBook(Book book)
|
||||
{
|
||||
book.setCreateTime(DateUtils.getNowDate());
|
||||
return bookMapper.insertBook(book);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改书籍
|
||||
*
|
||||
* @param book 书籍
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBook(Book book)
|
||||
{
|
||||
book.setUpdateTime(DateUtils.getNowDate());
|
||||
return bookMapper.updateBook(book);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除书籍
|
||||
*
|
||||
* @param ids 需要删除的书籍主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBookByIds(Long[] ids)
|
||||
{
|
||||
return bookMapper.deleteBookByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除书籍信息
|
||||
*
|
||||
* @param id 书籍主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBookById(Long id)
|
||||
{
|
||||
return bookMapper.deleteBookById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.manage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.manage.mapper.CategoryMapper;
|
||||
import com.ruoyi.manage.domain.Category;
|
||||
import com.ruoyi.manage.service.ICategoryService;
|
||||
|
||||
/**
|
||||
* 类别Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@Service
|
||||
public class CategoryServiceImpl implements ICategoryService
|
||||
{
|
||||
@Autowired
|
||||
private CategoryMapper categoryMapper;
|
||||
|
||||
/**
|
||||
* 查询类别
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 类别
|
||||
*/
|
||||
@Override
|
||||
public Category selectCategoryById(Long id)
|
||||
{
|
||||
return categoryMapper.selectCategoryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询类别列表
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 类别
|
||||
*/
|
||||
@Override
|
||||
public List<Category> selectCategoryList(Category category)
|
||||
{
|
||||
return categoryMapper.selectCategoryList(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCategory(Category category)
|
||||
{
|
||||
category.setCreateTime(DateUtils.getNowDate());
|
||||
return categoryMapper.insertCategory(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改类别
|
||||
*
|
||||
* @param category 类别
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCategory(Category category)
|
||||
{
|
||||
category.setUpdateTime(DateUtils.getNowDate());
|
||||
return categoryMapper.updateCategory(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除类别
|
||||
*
|
||||
* @param ids 需要删除的类别主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCategoryByIds(Long[] ids)
|
||||
{
|
||||
return categoryMapper.deleteCategoryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除类别信息
|
||||
*
|
||||
* @param id 类别主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCategoryById(Long id)
|
||||
{
|
||||
return categoryMapper.deleteCategoryById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.manage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.manage.mapper.RegionMapper;
|
||||
import com.ruoyi.manage.domain.Region;
|
||||
import com.ruoyi.manage.service.IRegionService;
|
||||
|
||||
/**
|
||||
* 区域Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-17
|
||||
*/
|
||||
@Service
|
||||
public class RegionServiceImpl implements IRegionService
|
||||
{
|
||||
@Autowired
|
||||
private RegionMapper regionMapper;
|
||||
|
||||
/**
|
||||
* 查询区域
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 区域
|
||||
*/
|
||||
@Override
|
||||
public Region selectRegionById(Long id)
|
||||
{
|
||||
return regionMapper.selectRegionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询区域列表
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 区域
|
||||
*/
|
||||
@Override
|
||||
public List<Region> selectRegionList(Region region)
|
||||
{
|
||||
return regionMapper.selectRegionList(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRegion(Region region)
|
||||
{
|
||||
region.setCreateTime(DateUtils.getNowDate());
|
||||
return regionMapper.insertRegion(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改区域
|
||||
*
|
||||
* @param region 区域
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRegion(Region region)
|
||||
{
|
||||
region.setUpdateTime(DateUtils.getNowDate());
|
||||
return regionMapper.updateRegion(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除区域
|
||||
*
|
||||
* @param ids 需要删除的区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRegionByIds(Long[] ids)
|
||||
{
|
||||
return regionMapper.deleteRegionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区域信息
|
||||
*
|
||||
* @param id 区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRegionById(Long id)
|
||||
{
|
||||
return regionMapper.deleteRegionById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.manage.mapper.BookMapper">
|
||||
|
||||
<resultMap type="Book" id="BookResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="bookName" column="book_name" />
|
||||
<result property="cover" column="cover" />
|
||||
<result property="author" column="author" />
|
||||
<result property="publisher" column="publisher" />
|
||||
<result property="publishDate" column="publish_date" />
|
||||
<result property="price" column="price" />
|
||||
<result property="quantity" column="quantity" />
|
||||
<result property="regionId" column="region_id" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBookVo">
|
||||
select id, book_name, cover, author, publisher, publish_date, price, quantity, region_id, category_id, create_time, update_time, create_by, update_by, remark from lb_book
|
||||
</sql>
|
||||
|
||||
<select id="selectBookList" parameterType="Book" resultMap="BookResult">
|
||||
<include refid="selectBookVo"/>
|
||||
<where>
|
||||
<if test="bookName != null and bookName != ''"> and book_name like concat('%', #{bookName}, '%')</if>
|
||||
<if test="author != null and author != ''"> and author like concat('%', #{author}, '%')</if>
|
||||
<if test="regionId != null "> and region_id = #{regionId}</if>
|
||||
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBookById" parameterType="Long" resultMap="BookResult">
|
||||
<include refid="selectBookVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBook" parameterType="Book" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into lb_book
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="bookName != null and bookName != ''">book_name,</if>
|
||||
<if test="cover != null">cover,</if>
|
||||
<if test="author != null and author != ''">author,</if>
|
||||
<if test="publisher != null and publisher != ''">publisher,</if>
|
||||
<if test="publishDate != null">publish_date,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="quantity != null">quantity,</if>
|
||||
<if test="regionId != null">region_id,</if>
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bookName != null and bookName != ''">#{bookName},</if>
|
||||
<if test="cover != null">#{cover},</if>
|
||||
<if test="author != null and author != ''">#{author},</if>
|
||||
<if test="publisher != null and publisher != ''">#{publisher},</if>
|
||||
<if test="publishDate != null">#{publishDate},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="quantity != null">#{quantity},</if>
|
||||
<if test="regionId != null">#{regionId},</if>
|
||||
<if test="categoryId != null">#{categoryId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBook" parameterType="Book">
|
||||
update lb_book
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bookName != null and bookName != ''">book_name = #{bookName},</if>
|
||||
<if test="cover != null">cover = #{cover},</if>
|
||||
<if test="author != null and author != ''">author = #{author},</if>
|
||||
<if test="publisher != null and publisher != ''">publisher = #{publisher},</if>
|
||||
<if test="publishDate != null">publish_date = #{publishDate},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="quantity != null">quantity = #{quantity},</if>
|
||||
<if test="regionId != null">region_id = #{regionId},</if>
|
||||
<if test="categoryId != null">category_id = #{categoryId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBookById" parameterType="Long">
|
||||
delete from lb_book where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBookByIds" parameterType="String">
|
||||
delete from lb_book where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.manage.mapper.CategoryMapper">
|
||||
|
||||
<resultMap type="Category" id="CategoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="categoryName" column="category_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCategoryVo">
|
||||
select id, category_name, create_time, update_time, create_by, update_by, remark from lb_category
|
||||
</sql>
|
||||
|
||||
<select id="selectCategoryList" parameterType="Category" resultMap="CategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
<where>
|
||||
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCategoryById" parameterType="Long" resultMap="CategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCategory" parameterType="Category" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into lb_category
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryName != null and categoryName != ''">category_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCategory" parameterType="Category">
|
||||
update lb_category
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCategoryById" parameterType="Long">
|
||||
delete from lb_category where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCategoryByIds" parameterType="String">
|
||||
delete from lb_category where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.manage.mapper.RegionMapper">
|
||||
|
||||
<resultMap type="Region" id="RegionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="regionName" column="region_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRegionVo">
|
||||
select id, region_name, create_time, update_time, create_by, update_by, remark from lb_region
|
||||
</sql>
|
||||
|
||||
<select id="selectRegionList" parameterType="Region" resultMap="RegionResult">
|
||||
<include refid="selectRegionVo"/>
|
||||
<where>
|
||||
<if test="regionName != null and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRegionById" parameterType="Long" resultMap="RegionResult">
|
||||
<include refid="selectRegionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRegion" parameterType="Region" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into lb_region
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="regionName != null and regionName != ''">region_name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="regionName != null and regionName != ''">#{regionName},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRegion" parameterType="Region">
|
||||
update lb_region
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="regionName != null and regionName != ''">region_name = #{regionName},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRegionById" parameterType="Long">
|
||||
delete from lb_region where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRegionByIds" parameterType="String">
|
||||
delete from lb_region where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍', '2000', '1', 'book', 'manage/book/index', 1, 0, 'C', '0', '0', 'manage:book:list', '#', 'admin', sysdate(), '', null, '书籍菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'manage:book:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'manage:book:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'manage:book:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'manage:book:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('书籍导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'manage:book:export', '#', 'admin', sysdate(), '', null, '');
|
||||
@@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别', '2000', '1', 'category', 'manage/category/index', 1, 0, 'C', '0', '0', 'manage:category:list', '#', 'admin', sysdate(), '', null, '类别菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'manage:category:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'manage:category:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'manage:category:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'manage:category:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('类别导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'manage:category:export', '#', 'admin', sysdate(), '', null, '');
|
||||
@@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域', '2000', '1', 'region', 'manage/region/index', 1, 0, 'C', '0', '0', 'manage:region:list', '#', 'admin', sysdate(), '', null, '区域菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'manage:region:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'manage:region:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'manage:region:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'manage:region:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('区域导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'manage:region:export', '#', 'admin', sysdate(), '', null, '');
|
||||
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询书籍列表
|
||||
export function listBook(query) {
|
||||
return request({
|
||||
url: '/manage/book/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询书籍详细
|
||||
export function getBook(id) {
|
||||
return request({
|
||||
url: '/manage/book/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增书籍
|
||||
export function addBook(data) {
|
||||
return request({
|
||||
url: '/manage/book',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改书籍
|
||||
export function updateBook(data) {
|
||||
return request({
|
||||
url: '/manage/book',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除书籍
|
||||
export function delBook(id) {
|
||||
return request({
|
||||
url: '/manage/book/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询类别列表
|
||||
export function listCategory(query) {
|
||||
return request({
|
||||
url: '/manage/category/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询类别详细
|
||||
export function getCategory(id) {
|
||||
return request({
|
||||
url: '/manage/category/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增类别
|
||||
export function addCategory(data) {
|
||||
return request({
|
||||
url: '/manage/category',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改类别
|
||||
export function updateCategory(data) {
|
||||
return request({
|
||||
url: '/manage/category',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除类别
|
||||
export function delCategory(id) {
|
||||
return request({
|
||||
url: '/manage/category/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询区域列表
|
||||
export function listRegion(query) {
|
||||
return request({
|
||||
url: '/manage/region/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询区域详细
|
||||
export function getRegion(id) {
|
||||
return request({
|
||||
url: '/manage/region/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增区域
|
||||
export function addRegion(data) {
|
||||
return request({
|
||||
url: '/manage/region',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改区域
|
||||
export function updateRegion(data) {
|
||||
return request({
|
||||
url: '/manage/region',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除区域
|
||||
export function delRegion(id) {
|
||||
return request({
|
||||
url: '/manage/region/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="书籍名称" prop="bookName">
|
||||
<el-input
|
||||
v-model="queryParams.bookName"
|
||||
placeholder="请输入书籍名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input
|
||||
v-model="queryParams.author"
|
||||
placeholder="请输入作者"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="区域ID" prop="regionId">
|
||||
<el-input
|
||||
v-model="queryParams.regionId"
|
||||
placeholder="请输入区域ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类别ID" prop="categoryId">
|
||||
<el-input
|
||||
v-model="queryParams.categoryId"
|
||||
placeholder="请输入类别ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['manage:book:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['manage:book:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['manage:book:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['manage:book:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="bookList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="书籍ID" align="center" prop="id" />
|
||||
<el-table-column label="书籍名称" align="center" prop="bookName" />
|
||||
<el-table-column label="封面" align="center" prop="cover" width="100">
|
||||
<template #default="scope">
|
||||
<image-preview :src="scope.row.cover" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作者" align="center" prop="author" />
|
||||
<el-table-column label="出版社" align="center" prop="publisher" />
|
||||
<el-table-column label="出版日期" align="center" prop="publishDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.publishDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="价格" align="center" prop="price" />
|
||||
<el-table-column label="数量" align="center" prop="quantity" />
|
||||
<el-table-column label="区域ID" align="center" prop="regionId" />
|
||||
<el-table-column label="类别ID" align="center" prop="categoryId" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:book:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:book:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改书籍对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="bookRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="书籍名称" prop="bookName">
|
||||
<el-input v-model="form.bookName" placeholder="请输入书籍名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="封面" prop="cover">
|
||||
<image-upload v-model="form.cover"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input v-model="form.author" placeholder="请输入作者" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出版社" prop="publisher">
|
||||
<el-input v-model="form.publisher" placeholder="请输入出版社" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出版日期" prop="publishDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.publishDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择出版日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="区域ID" prop="regionId">
|
||||
<el-input v-model="form.regionId" placeholder="请输入区域ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类别ID" prop="categoryId">
|
||||
<el-input v-model="form.categoryId" placeholder="请输入类别ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Book">
|
||||
import { listBook, getBook, delBook, addBook, updateBook } from "@/api/manage/book"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const bookList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
bookName: null,
|
||||
author: null,
|
||||
regionId: null,
|
||||
categoryId: null,
|
||||
},
|
||||
rules: {
|
||||
bookName: [
|
||||
{ required: true, message: "书籍名称不能为空", trigger: "blur" }
|
||||
],
|
||||
author: [
|
||||
{ required: true, message: "作者不能为空", trigger: "blur" }
|
||||
],
|
||||
publisher: [
|
||||
{ required: true, message: "出版社不能为空", trigger: "blur" }
|
||||
],
|
||||
publishDate: [
|
||||
{ required: true, message: "出版日期不能为空", trigger: "blur" }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: "数量不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询书籍列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listBook(queryParams.value).then(response => {
|
||||
bookList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
bookName: null,
|
||||
cover: null,
|
||||
author: null,
|
||||
publisher: null,
|
||||
publishDate: null,
|
||||
price: null,
|
||||
quantity: null,
|
||||
regionId: null,
|
||||
categoryId: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("bookRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加书籍"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getBook(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改书籍"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["bookRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateBook(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addBook(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除书籍编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delBook(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('manage/book/export', {
|
||||
...queryParams.value
|
||||
}, `book_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="类别名称" prop="categoryName">
|
||||
<el-input
|
||||
v-model="queryParams.categoryName"
|
||||
placeholder="请输入类别名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['manage:category:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['manage:category:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['manage:category:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['manage:category:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="类别ID" align="center" prop="id" />
|
||||
<el-table-column label="类别名称" align="center" prop="categoryName" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:category:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:category:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改类别对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="categoryRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="类别名称" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" placeholder="请输入类别名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Category">
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/manage/category"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const categoryList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
categoryName: null,
|
||||
},
|
||||
rules: {
|
||||
categoryName: [
|
||||
{ required: true, message: "类别名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询类别列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listCategory(queryParams.value).then(response => {
|
||||
categoryList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
categoryName: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("categoryRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加类别"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getCategory(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改类别"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["categoryRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateCategory(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addCategory(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除类别编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delCategory(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('manage/category/export', {
|
||||
...queryParams.value
|
||||
}, `category_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="区域名称" prop="regionName">
|
||||
<el-input
|
||||
v-model="queryParams.regionName"
|
||||
placeholder="请输入区域名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['manage:region:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['manage:region:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['manage:region:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['manage:region:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="regionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="区域ID" align="center" prop="id" />
|
||||
<el-table-column label="区域名称" align="center" prop="regionName" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:region:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:region:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改区域对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="regionRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="区域名称" prop="regionName">
|
||||
<el-input v-model="form.regionName" placeholder="请输入区域名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Region">
|
||||
import { listRegion, getRegion, delRegion, addRegion, updateRegion } from "@/api/manage/region"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const regionList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
regionName: null,
|
||||
},
|
||||
rules: {
|
||||
regionName: [
|
||||
{ required: true, message: "区域名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询区域列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listRegion(queryParams.value).then(response => {
|
||||
regionList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
regionName: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm("regionRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加区域"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getRegion(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改区域"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["regionRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateRegion(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addRegion(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除区域编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delRegion(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('manage/region/export', {
|
||||
...queryParams.value
|
||||
}, `region_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
Reference in New Issue
Block a user