mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-04 08:26:37 +00:00
feat: 后台小说删除
This commit is contained in:
@ -3,219 +3,270 @@ package com.java2nb.common.domain;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
*
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2019-09-29 18:28:07
|
||||
*/
|
||||
public class DictDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//编号
|
||||
private Long id;
|
||||
//标签名
|
||||
private String name;
|
||||
//数据值
|
||||
private String value;
|
||||
//类型
|
||||
private String type;
|
||||
//描述
|
||||
private String description;
|
||||
//排序(升序)
|
||||
private BigDecimal sort;
|
||||
//父级编号
|
||||
private Long parentId;
|
||||
//创建者
|
||||
private Integer createBy;
|
||||
//创建时间
|
||||
private Date createDate;
|
||||
//更新者
|
||||
private Long updateBy;
|
||||
//更新时间
|
||||
private Date updateDate;
|
||||
//备注信息
|
||||
private String remarks;
|
||||
//删除标记
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 设置:编号
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 获取:编号
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 设置:标签名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* 获取:标签名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* 设置:数据值
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* 获取:数据值
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* 设置:类型
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* 获取:类型
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* 设置:描述
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
/**
|
||||
* 获取:描述
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
/**
|
||||
* 设置:排序(升序)
|
||||
*/
|
||||
public void setSort(BigDecimal sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
/**
|
||||
* 获取:排序(升序)
|
||||
*/
|
||||
public BigDecimal getSort() {
|
||||
return sort;
|
||||
}
|
||||
/**
|
||||
* 设置:父级编号
|
||||
*/
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
/**
|
||||
* 获取:父级编号
|
||||
*/
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
/**
|
||||
* 设置:创建者
|
||||
*/
|
||||
public void setCreateBy(Integer createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
/**
|
||||
* 获取:创建者
|
||||
*/
|
||||
public Integer getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
/**
|
||||
* 设置:创建时间
|
||||
*/
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
/**
|
||||
* 获取:创建时间
|
||||
*/
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
/**
|
||||
* 设置:更新者
|
||||
*/
|
||||
public void setUpdateBy(Long updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
/**
|
||||
* 获取:更新者
|
||||
*/
|
||||
public Long getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
/**
|
||||
* 设置:更新时间
|
||||
*/
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
/**
|
||||
* 获取:更新时间
|
||||
*/
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
/**
|
||||
* 设置:备注信息
|
||||
*/
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
/**
|
||||
* 获取:备注信息
|
||||
*/
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
/**
|
||||
* 设置:删除标记
|
||||
*/
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
/**
|
||||
* 获取:删除标记
|
||||
*/
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DictDO{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", sort=" + sort +
|
||||
", parentId=" + parentId +
|
||||
", createBy=" + createBy +
|
||||
", createDate=" + createDate +
|
||||
", updateBy=" + updateBy +
|
||||
", updateDate=" + updateDate +
|
||||
", remarks='" + remarks + '\'' +
|
||||
", delFlag='" + delFlag + '\'' +
|
||||
'}';
|
||||
}
|
||||
//编号
|
||||
private Long id;
|
||||
//标签名
|
||||
private String name;
|
||||
//数据值
|
||||
private String value;
|
||||
//类型
|
||||
private String type;
|
||||
//描述
|
||||
private String description;
|
||||
//排序(升序)
|
||||
private BigDecimal sort;
|
||||
//父级编号
|
||||
private Long parentId;
|
||||
//创建者
|
||||
private Integer createBy;
|
||||
//创建时间
|
||||
private Date createDate;
|
||||
//更新者
|
||||
private Long updateBy;
|
||||
//更新时间
|
||||
private Date updateDate;
|
||||
//备注信息
|
||||
private String remarks;
|
||||
//删除标记
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 设置:编号
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:编号
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:标签名
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:标签名
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:数据值
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:数据值
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:类型
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:类型
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:描述
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:描述
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:排序(升序)
|
||||
*/
|
||||
public void setSort(BigDecimal sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:排序(升序)
|
||||
*/
|
||||
public BigDecimal getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:父级编号
|
||||
*/
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:父级编号
|
||||
*/
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:创建者
|
||||
*/
|
||||
public void setCreateBy(Integer createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:创建者
|
||||
*/
|
||||
public Integer getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:创建时间
|
||||
*/
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:创建时间
|
||||
*/
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:更新者
|
||||
*/
|
||||
public void setUpdateBy(Long updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:更新者
|
||||
*/
|
||||
public Long getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:更新时间
|
||||
*/
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:更新时间
|
||||
*/
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:备注信息
|
||||
*/
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:备注信息
|
||||
*/
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置:删除标记
|
||||
*/
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取:删除标记
|
||||
*/
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DictDO{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", sort=" + sort +
|
||||
", parentId=" + parentId +
|
||||
", createBy=" + createBy +
|
||||
", createDate=" + createDate +
|
||||
", updateBy=" + updateBy +
|
||||
", updateDate=" + updateDate +
|
||||
", remarks='" + remarks + '\'' +
|
||||
", delFlag='" + delFlag + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DictDO dictDO = (DictDO) o;
|
||||
return Objects.equals(id, dictDO.id) && Objects.equals(name, dictDO.name)
|
||||
&& Objects.equals(value, dictDO.value) && Objects.equals(type, dictDO.type)
|
||||
&& Objects.equals(description, dictDO.description) && Objects.equals(sort, dictDO.sort)
|
||||
&& Objects.equals(parentId, dictDO.parentId) && Objects.equals(createBy, dictDO.createBy)
|
||||
&& Objects.equals(createDate, dictDO.createDate) && Objects.equals(updateBy,
|
||||
dictDO.updateBy) && Objects.equals(updateDate, dictDO.updateDate) && Objects.equals(remarks,
|
||||
dictDO.remarks) && Objects.equals(delFlag, dictDO.delFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, value, type, description, sort, parentId, createBy, createDate, updateBy,
|
||||
updateDate,
|
||||
remarks, delFlag);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.java2nb.common.service.impl;
|
||||
|
||||
import com.java2nb.common.dao.DictDao;
|
||||
import com.java2nb.common.domain.DictDO;
|
||||
import com.java2nb.common.service.DictService;
|
||||
import com.java2nb.common.utils.StringUtils;
|
||||
import com.java2nb.system.domain.UserDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -9,14 +12,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.java2nb.common.dao.DictDao;
|
||||
import com.java2nb.common.domain.DictDO;
|
||||
import com.java2nb.common.service.DictService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
public class DictServiceImpl implements DictService {
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@ -58,7 +59,7 @@ public class DictServiceImpl implements DictService {
|
||||
@Override
|
||||
|
||||
public List<DictDO> listType() {
|
||||
return dictDao.listType();
|
||||
return dictDao.listType().stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,135 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
import com.java2nb.novel.domain.BookContentDO;
|
||||
import com.java2nb.novel.service.BookContentService;
|
||||
import com.java2nb.common.utils.PageBean;
|
||||
import com.java2nb.common.utils.Query;
|
||||
import com.java2nb.common.utils.R;
|
||||
|
||||
/**
|
||||
* 小说内容表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:52:06
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/novel/bookContent")
|
||||
public class BookContentController {
|
||||
@Autowired
|
||||
private BookContentService bookContentService;
|
||||
|
||||
@GetMapping()
|
||||
@RequiresPermissions("novel:bookContent:bookContent")
|
||||
String BookContent() {
|
||||
return "novel/bookContent/bookContent";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取小说内容表列表", notes = "获取小说内容表列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("novel:bookContent:bookContent")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
List<BookContentDO> bookContentList = bookContentService.list(query);
|
||||
int total = bookContentService.count(query);
|
||||
PageBean pageBean = new PageBean(bookContentList, total);
|
||||
return R.ok().put("data", pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增小说内容表页面", notes = "新增小说内容表页面")
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("novel:bookContent:add")
|
||||
String add() {
|
||||
return "novel/bookContent/add";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改小说内容表页面", notes = "修改小说内容表页面")
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("novel:bookContent:edit")
|
||||
String edit(@PathVariable("id") Long id, Model model) {
|
||||
BookContentDO bookContent = bookContentService.get(id);
|
||||
model.addAttribute("bookContent", bookContent);
|
||||
return "novel/bookContent/edit";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看小说内容表页面", notes = "查看小说内容表页面")
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("novel:bookContent:detail")
|
||||
String detail(@PathVariable("id") Long id, Model model) {
|
||||
BookContentDO bookContent = bookContentService.get(id);
|
||||
model.addAttribute("bookContent", bookContent);
|
||||
return "novel/bookContent/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation(value = "新增小说内容表", notes = "新增小说内容表")
|
||||
@ResponseBody
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("novel:bookContent:add")
|
||||
public R save( BookContentDO bookContent) {
|
||||
if (bookContentService.save(bookContent) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation(value = "修改小说内容表", notes = "修改小说内容表")
|
||||
@ResponseBody
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("novel:bookContent:edit")
|
||||
public R update( BookContentDO bookContent) {
|
||||
bookContentService.update(bookContent);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "删除小说内容表", notes = "删除小说内容表")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:bookContent:remove")
|
||||
public R remove( Long id) {
|
||||
if (bookContentService.remove(id) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "批量删除小说内容表", notes = "批量删除小说内容表")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:bookContent:batchRemove")
|
||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||
bookContentService.batchRemove(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
import com.java2nb.novel.domain.BookIndexDO;
|
||||
import com.java2nb.novel.service.BookIndexService;
|
||||
import com.java2nb.common.utils.PageBean;
|
||||
import com.java2nb.common.utils.Query;
|
||||
import com.java2nb.common.utils.R;
|
||||
|
||||
/**
|
||||
* 小说目录表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:51:54
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/novel/bookIndex")
|
||||
public class BookIndexController {
|
||||
@Autowired
|
||||
private BookIndexService bookIndexService;
|
||||
|
||||
@GetMapping()
|
||||
@RequiresPermissions("novel:bookIndex:bookIndex")
|
||||
String BookIndex() {
|
||||
return "novel/bookIndex/bookIndex";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取小说目录表列表", notes = "获取小说目录表列表")
|
||||
@ResponseBody
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("novel:bookIndex:bookIndex")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
//查询列表数据
|
||||
Query query = new Query(params);
|
||||
List<BookIndexDO> bookIndexList = bookIndexService.list(query);
|
||||
int total = bookIndexService.count(query);
|
||||
PageBean pageBean = new PageBean(bookIndexList, total);
|
||||
return R.ok().put("data", pageBean);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增小说目录表页面", notes = "新增小说目录表页面")
|
||||
@GetMapping("/add")
|
||||
@RequiresPermissions("novel:bookIndex:add")
|
||||
String add() {
|
||||
return "novel/bookIndex/add";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改小说目录表页面", notes = "修改小说目录表页面")
|
||||
@GetMapping("/edit/{id}")
|
||||
@RequiresPermissions("novel:bookIndex:edit")
|
||||
String edit(@PathVariable("id") Long id, Model model) {
|
||||
BookIndexDO bookIndex = bookIndexService.get(id);
|
||||
model.addAttribute("bookIndex", bookIndex);
|
||||
return "novel/bookIndex/edit";
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看小说目录表页面", notes = "查看小说目录表页面")
|
||||
@GetMapping("/detail/{id}")
|
||||
@RequiresPermissions("novel:bookIndex:detail")
|
||||
String detail(@PathVariable("id") Long id, Model model) {
|
||||
BookIndexDO bookIndex = bookIndexService.get(id);
|
||||
model.addAttribute("bookIndex", bookIndex);
|
||||
return "novel/bookIndex/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation(value = "新增小说目录表", notes = "新增小说目录表")
|
||||
@ResponseBody
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("novel:bookIndex:add")
|
||||
public R save( BookIndexDO bookIndex) {
|
||||
if (bookIndexService.save(bookIndex) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation(value = "修改小说目录表", notes = "修改小说目录表")
|
||||
@ResponseBody
|
||||
@RequestMapping("/update")
|
||||
@RequiresPermissions("novel:bookIndex:edit")
|
||||
public R update( BookIndexDO bookIndex) {
|
||||
bookIndexService.update(bookIndex);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "删除小说目录表", notes = "删除小说目录表")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:bookIndex:remove")
|
||||
public R remove( Long id) {
|
||||
if (bookIndexService.remove(id) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "批量删除小说目录表", notes = "批量删除小说目录表")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("novel:bookIndex:batchRemove")
|
||||
public R remove(@RequestParam("ids[]") Long[] ids) {
|
||||
bookIndexService.batchRemove(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.java2nb.novel.dao;
|
||||
|
||||
import com.java2nb.novel.domain.BookContentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 小说内容表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:52:06
|
||||
*/
|
||||
@Mapper
|
||||
public interface BookContentDao {
|
||||
|
||||
BookContentDO get(Long id);
|
||||
|
||||
List<BookContentDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(BookContentDO bookContent);
|
||||
|
||||
int update(BookContentDO bookContent);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
|
||||
int removeByIndexIds(Long[] indexIds);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.java2nb.novel.dao;
|
||||
|
||||
import com.java2nb.novel.domain.BookIndexDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 小说目录表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:51:54
|
||||
*/
|
||||
@Mapper
|
||||
public interface BookIndexDao {
|
||||
|
||||
BookIndexDO get(Long id);
|
||||
|
||||
List<BookIndexDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(BookIndexDO bookIndex);
|
||||
|
||||
int update(BookIndexDO bookIndex);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
|
||||
List<Long> getIdsByBookId(Long bookId);
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.java2nb.novel.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.java2nb.common.jsonserializer.LongToStringSerializer;
|
||||
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小说内容表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:52:06
|
||||
*/
|
||||
public class BookContentDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
//主键
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long id;
|
||||
//目录ID
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long indexId;
|
||||
//小说章节内容
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 设置:主键
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 获取:主键
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 设置:目录ID
|
||||
*/
|
||||
public void setIndexId(Long indexId) {
|
||||
this.indexId = indexId;
|
||||
}
|
||||
/**
|
||||
* 获取:目录ID
|
||||
*/
|
||||
public Long getIndexId() {
|
||||
return indexId;
|
||||
}
|
||||
/**
|
||||
* 设置:小说章节内容
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
/**
|
||||
* 获取:小说章节内容
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
package com.java2nb.novel.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.java2nb.common.jsonserializer.LongToStringSerializer;
|
||||
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小说目录表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:51:54
|
||||
*/
|
||||
public class BookIndexDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
//主键
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long id;
|
||||
//小说ID
|
||||
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
|
||||
//所以通过序列化成字符串来解决
|
||||
@JsonSerialize(using = LongToStringSerializer.class)
|
||||
private Long bookId;
|
||||
//目录号
|
||||
private Integer indexNum;
|
||||
//目录名
|
||||
private String indexName;
|
||||
//字数
|
||||
private Integer wordCount;
|
||||
//是否收费,1:收费,0:免费
|
||||
private Integer isVip;
|
||||
//章节费用(屋币)
|
||||
private Integer bookPrice;
|
||||
//存储方式
|
||||
private String storageType;
|
||||
//
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
//
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 设置:主键
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* 获取:主键
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* 设置:小说ID
|
||||
*/
|
||||
public void setBookId(Long bookId) {
|
||||
this.bookId = bookId;
|
||||
}
|
||||
/**
|
||||
* 获取:小说ID
|
||||
*/
|
||||
public Long getBookId() {
|
||||
return bookId;
|
||||
}
|
||||
/**
|
||||
* 设置:目录号
|
||||
*/
|
||||
public void setIndexNum(Integer indexNum) {
|
||||
this.indexNum = indexNum;
|
||||
}
|
||||
/**
|
||||
* 获取:目录号
|
||||
*/
|
||||
public Integer getIndexNum() {
|
||||
return indexNum;
|
||||
}
|
||||
/**
|
||||
* 设置:目录名
|
||||
*/
|
||||
public void setIndexName(String indexName) {
|
||||
this.indexName = indexName;
|
||||
}
|
||||
/**
|
||||
* 获取:目录名
|
||||
*/
|
||||
public String getIndexName() {
|
||||
return indexName;
|
||||
}
|
||||
/**
|
||||
* 设置:字数
|
||||
*/
|
||||
public void setWordCount(Integer wordCount) {
|
||||
this.wordCount = wordCount;
|
||||
}
|
||||
/**
|
||||
* 获取:字数
|
||||
*/
|
||||
public Integer getWordCount() {
|
||||
return wordCount;
|
||||
}
|
||||
/**
|
||||
* 设置:是否收费,1:收费,0:免费
|
||||
*/
|
||||
public void setIsVip(Integer isVip) {
|
||||
this.isVip = isVip;
|
||||
}
|
||||
/**
|
||||
* 获取:是否收费,1:收费,0:免费
|
||||
*/
|
||||
public Integer getIsVip() {
|
||||
return isVip;
|
||||
}
|
||||
/**
|
||||
* 设置:章节费用(屋币)
|
||||
*/
|
||||
public void setBookPrice(Integer bookPrice) {
|
||||
this.bookPrice = bookPrice;
|
||||
}
|
||||
/**
|
||||
* 获取:章节费用(屋币)
|
||||
*/
|
||||
public Integer getBookPrice() {
|
||||
return bookPrice;
|
||||
}
|
||||
/**
|
||||
* 设置:存储方式
|
||||
*/
|
||||
public void setStorageType(String storageType) {
|
||||
this.storageType = storageType;
|
||||
}
|
||||
/**
|
||||
* 获取:存储方式
|
||||
*/
|
||||
public String getStorageType() {
|
||||
return storageType;
|
||||
}
|
||||
/**
|
||||
* 设置:
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
/**
|
||||
* 获取:
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 设置:
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
/**
|
||||
* 获取:
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
import com.java2nb.novel.domain.BookContentDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 小说内容表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:52:06
|
||||
*/
|
||||
public interface BookContentService {
|
||||
|
||||
BookContentDO get(Long id);
|
||||
|
||||
List<BookContentDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(BookContentDO bookContent);
|
||||
|
||||
int update(BookContentDO bookContent);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
import com.java2nb.novel.domain.BookIndexDO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 小说目录表
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2023-04-14 19:51:54
|
||||
*/
|
||||
public interface BookIndexService {
|
||||
|
||||
BookIndexDO get(Long id);
|
||||
|
||||
List<BookIndexDO> list(Map<String, Object> map);
|
||||
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(BookIndexDO bookIndex);
|
||||
|
||||
int update(BookIndexDO bookIndex);
|
||||
|
||||
int remove(Long id);
|
||||
|
||||
int batchRemove(Long[] ids);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.java2nb.novel.dao.BookContentDao;
|
||||
import com.java2nb.novel.domain.BookContentDO;
|
||||
import com.java2nb.novel.service.BookContentService;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class BookContentServiceImpl implements BookContentService {
|
||||
@Autowired
|
||||
private BookContentDao bookContentDao;
|
||||
|
||||
@Override
|
||||
public BookContentDO get(Long id){
|
||||
return bookContentDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookContentDO> list(Map<String, Object> map){
|
||||
return bookContentDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map){
|
||||
return bookContentDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(BookContentDO bookContent){
|
||||
return bookContentDao.save(bookContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(BookContentDO bookContent){
|
||||
return bookContentDao.update(bookContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(Long id){
|
||||
return bookContentDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids){
|
||||
return bookContentDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.java2nb.novel.dao.BookIndexDao;
|
||||
import com.java2nb.novel.domain.BookIndexDO;
|
||||
import com.java2nb.novel.service.BookIndexService;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class BookIndexServiceImpl implements BookIndexService {
|
||||
@Autowired
|
||||
private BookIndexDao bookIndexDao;
|
||||
|
||||
@Override
|
||||
public BookIndexDO get(Long id){
|
||||
return bookIndexDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookIndexDO> list(Map<String, Object> map){
|
||||
return bookIndexDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map){
|
||||
return bookIndexDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(BookIndexDO bookIndex){
|
||||
return bookIndexDao.save(bookIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(BookIndexDO bookIndex){
|
||||
return bookIndexDao.update(bookIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(Long id){
|
||||
return bookIndexDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids){
|
||||
return bookIndexDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +1,79 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.java2nb.novel.dao.BookContentDao;
|
||||
import com.java2nb.novel.dao.BookDao;
|
||||
import com.java2nb.novel.dao.BookIndexDao;
|
||||
import com.java2nb.novel.domain.BookDO;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.java2nb.novel.dao.BookDao;
|
||||
import com.java2nb.novel.domain.BookDO;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class BookServiceImpl implements BookService {
|
||||
@Autowired
|
||||
private BookDao bookDao;
|
||||
|
||||
@Override
|
||||
public BookDO get(Long id){
|
||||
return bookDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookDO> list(Map<String, Object> map){
|
||||
return bookDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map){
|
||||
return bookDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(BookDO book){
|
||||
return bookDao.save(book);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(BookDO book){
|
||||
return bookDao.update(book);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remove(Long id){
|
||||
return bookDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids){
|
||||
return bookDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Object, Object> tableSta(Date minDate) {
|
||||
List<Map<Object, Object>> maps = bookDao.tableSta(minDate);
|
||||
@Autowired
|
||||
private BookDao bookDao;
|
||||
@Autowired
|
||||
private BookIndexDao bookIndexDao;
|
||||
@Autowired
|
||||
private BookContentDao bookContentDao;
|
||||
|
||||
return maps.stream().collect(Collectors.toMap(x -> x.get("staDate"), x -> x.get("bookCount")));
|
||||
@Override
|
||||
public BookDO get(Long id) {
|
||||
return bookDao.get(id);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<BookDO> list(Map<String, Object> map) {
|
||||
return bookDao.list(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(Map<String, Object> map) {
|
||||
return bookDao.count(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(BookDO book) {
|
||||
return bookDao.save(book);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(BookDO book) {
|
||||
return bookDao.update(book);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int remove(Long id) {
|
||||
List<Long> indexIds = bookIndexDao.getIdsByBookId(id);
|
||||
if (!CollectionUtils.isEmpty(indexIds)) {
|
||||
Long[] indexIdArray = indexIds.toArray(new Long[0]);
|
||||
bookIndexDao.batchRemove(indexIdArray);
|
||||
bookContentDao.removeByIndexIds(indexIdArray);
|
||||
}
|
||||
return bookDao.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchRemove(Long[] ids) {
|
||||
return bookDao.batchRemove(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Object, Object> tableSta(Date minDate) {
|
||||
List<Map<Object, Object>> maps = bookDao.tableSta(minDate);
|
||||
|
||||
return maps.stream().collect(Collectors.toMap(x -> x.get("staDate"), x -> x.get("bookCount")));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user