diff --git a/README.md b/README.md index e8db25b..2690404 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ novel-plus -- 父工程 ![img](https://oscimg.oschina.net/oscnet/up-0552343538674a22a64819834100558f39b.png) -![img](https://s3.ax1x.com/2020/12/01/DWgLNT.png) +![img](https://youdoc.gitee.io/resource/images/docs/novel-plus/admin.png) ![img](https://s3.ax1x.com/2020/12/01/DfmRCd.png) diff --git a/doc/sql/20230413.sql b/doc/sql/20230413.sql index b192788..c139cb4 100644 --- a/doc/sql/20230413.sql +++ b/doc/sql/20230413.sql @@ -102,4 +102,9 @@ VALUES (601, 600, '小说列表', 'novel/book', 'novel:book:book', '1', 'fa', '6 INSERT INTO sys_role_menu (role_id, menu_id) VALUES (1, 600); INSERT INTO sys_role_menu (role_id, menu_id) -VALUES (1, 601); \ No newline at end of file +VALUES (1, 601); + +INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) +VALUES (602, 601, '删除', null, 'novel:book:remove', '2', null, '6'); +INSERT INTO sys_role_menu (role_id, menu_id) +VALUES (1, 602); \ No newline at end of file diff --git a/doc/sql/novel_plus.sql b/doc/sql/novel_plus.sql index 24d0112..16ba03e 100644 --- a/doc/sql/novel_plus.sql +++ b/doc/sql/novel_plus.sql @@ -2931,4 +2931,9 @@ VALUES (601, 600, '小说列表', 'novel/book', 'novel:book:book', '1', 'fa', '6 INSERT INTO sys_role_menu (role_id, menu_id) VALUES (1, 600); INSERT INTO sys_role_menu (role_id, menu_id) -VALUES (1, 601); \ No newline at end of file +VALUES (1, 601); + +INSERT INTO `sys_menu` (menu_id, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) +VALUES (602, 601, '删除', null, 'novel:book:remove', '2', null, '6'); +INSERT INTO sys_role_menu (role_id, menu_id) +VALUES (1, 602); \ No newline at end of file diff --git a/novel-admin/pom.xml b/novel-admin/pom.xml index 5a7bcaf..d480df9 100644 --- a/novel-admin/pom.xml +++ b/novel-admin/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.1.RELEASE + 2.1.8.RELEASE @@ -24,6 +24,7 @@ 1.8 1.7 5.22.0 + 3.0.0 @@ -195,10 +196,16 @@ 1.4 - - org.springframework.boot - spring-boot-starter-cache + io.shardingsphere + sharding-jdbc-spring-boot-starter + ${sharding.jdbc.version} + + + + io.shardingsphere + sharding-jdbc-spring-namespace + ${sharding.jdbc.version} @@ -289,16 +296,28 @@ - + + + + ali-plugin + https://maven.aliyun.com/repository/public + + true + + + false + + + diff --git a/novel-admin/src/main/java/com/java2nb/common/domain/DictDO.java b/novel-admin/src/main/java/com/java2nb/common/domain/DictDO.java index 547bd23..805adaa 100644 --- a/novel-admin/src/main/java/com/java2nb/common/domain/DictDO.java +++ b/novel-admin/src/main/java/com/java2nb/common/domain/DictDO.java @@ -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); + } } diff --git a/novel-admin/src/main/java/com/java2nb/common/service/impl/DictServiceImpl.java b/novel-admin/src/main/java/com/java2nb/common/service/impl/DictServiceImpl.java index 79b55b1..10a9479 100644 --- a/novel-admin/src/main/java/com/java2nb/common/service/impl/DictServiceImpl.java +++ b/novel-admin/src/main/java/com/java2nb/common/service/impl/DictServiceImpl.java @@ -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 listType() { - return dictDao.listType(); + return dictDao.listType().stream().distinct().collect(Collectors.toList()); } @Override diff --git a/novel-admin/src/main/java/com/java2nb/novel/controller/BookContentController.java b/novel-admin/src/main/java/com/java2nb/novel/controller/BookContentController.java new file mode 100644 index 0000000..beb50af --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/controller/BookContentController.java @@ -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 params) { + //查询列表数据 + Query query = new Query(params); + List 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(); + } + +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/controller/BookIndexController.java b/novel-admin/src/main/java/com/java2nb/novel/controller/BookIndexController.java new file mode 100644 index 0000000..9851b00 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/controller/BookIndexController.java @@ -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 params) { + //查询列表数据 + Query query = new Query(params); + List 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(); + } + +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/dao/BookContentDao.java b/novel-admin/src/main/java/com/java2nb/novel/dao/BookContentDao.java new file mode 100644 index 0000000..fcdcdfa --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/dao/BookContentDao.java @@ -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 list(Map map); + + int count(Map map); + + int save(BookContentDO bookContent); + + int update(BookContentDO bookContent); + + int remove(Long id); + + int batchRemove(Long[] ids); + + int removeByIndexIds(Long[] indexIds); +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/dao/BookIndexDao.java b/novel-admin/src/main/java/com/java2nb/novel/dao/BookIndexDao.java new file mode 100644 index 0000000..2536d92 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/dao/BookIndexDao.java @@ -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 list(Map map); + + int count(Map map); + + int save(BookIndexDO bookIndex); + + int update(BookIndexDO bookIndex); + + int remove(Long id); + + int batchRemove(Long[] ids); + + List getIdsByBookId(Long bookId); +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/domain/BookContentDO.java b/novel-admin/src/main/java/com/java2nb/novel/domain/BookContentDO.java new file mode 100644 index 0000000..68d71a9 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/domain/BookContentDO.java @@ -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; + } +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/domain/BookIndexDO.java b/novel-admin/src/main/java/com/java2nb/novel/domain/BookIndexDO.java new file mode 100644 index 0000000..a3bc6a9 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/domain/BookIndexDO.java @@ -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; + } +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/service/BookContentService.java b/novel-admin/src/main/java/com/java2nb/novel/service/BookContentService.java new file mode 100644 index 0000000..83e7353 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/service/BookContentService.java @@ -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 list(Map map); + + int count(Map map); + + int save(BookContentDO bookContent); + + int update(BookContentDO bookContent); + + int remove(Long id); + + int batchRemove(Long[] ids); +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/service/BookIndexService.java b/novel-admin/src/main/java/com/java2nb/novel/service/BookIndexService.java new file mode 100644 index 0000000..262a641 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/service/BookIndexService.java @@ -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 list(Map map); + + int count(Map map); + + int save(BookIndexDO bookIndex); + + int update(BookIndexDO bookIndex); + + int remove(Long id); + + int batchRemove(Long[] ids); +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookContentServiceImpl.java b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookContentServiceImpl.java new file mode 100644 index 0000000..8c6bbd4 --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookContentServiceImpl.java @@ -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 list(Map map){ + return bookContentDao.list(map); + } + + @Override + public int count(Map 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); + } + +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookIndexServiceImpl.java b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookIndexServiceImpl.java new file mode 100644 index 0000000..a6b5c1d --- /dev/null +++ b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookIndexServiceImpl.java @@ -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 list(Map map){ + return bookIndexDao.list(map); + } + + @Override + public int count(Map 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); + } + +} diff --git a/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java index ae2d028..b0adb68 100644 --- a/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java +++ b/novel-admin/src/main/java/com/java2nb/novel/service/impl/BookServiceImpl.java @@ -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 list(Map map){ - return bookDao.list(map); - } - - @Override - public int count(Map 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 tableSta(Date minDate) { - List> 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 list(Map map) { + return bookDao.list(map); + } + + @Override + public int count(Map 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 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 tableSta(Date minDate) { + List> maps = bookDao.tableSta(minDate); + + return maps.stream().collect(Collectors.toMap(x -> x.get("staDate"), x -> x.get("bookCount"))); + + } } diff --git a/novel-admin/src/main/resources/application-dev.yml b/novel-admin/src/main/resources/application-dev.yml index c63a852..08eb963 100644 --- a/novel-admin/src/main/resources/application-dev.yml +++ b/novel-admin/src/main/resources/application-dev.yml @@ -51,4 +51,43 @@ spring: # 连接池最大连接数(使用负值表示没有限制) max-active: 100 # 连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1 \ No newline at end of file + max-wait: -1 + + + +####使用shardingJdbc时, +####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误 +##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR + +sharding: + jdbc: + datasource: + names: ds0 #,ds1 + ds0: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: test123456 + # ds1: + # type: com.alibaba.druid.pool.DruidDataSource + # driver-class-name: com.mysql.jdbc.Driver + # url: jdbc:mysql://localhost:3306/novel_plus2 + # username: root + # password: test123456 + config: + sharding: + props: + sql.show: true + tables: + book_content: #book_content表 + key-generator-column-name: id #主键 + actual-data-nodes: ds${0}.book_content${0..9} #数据节点 + # database-strategy: #分库策略 + # inline: + # sharding-column: book_id + # algorithm-expression: ds${book_id % 10} + table-strategy: #分表策略 + inline: + shardingColumn: index_id + algorithm-expression: book_content${index_id % 10} diff --git a/novel-admin/src/main/resources/application-prod.yml b/novel-admin/src/main/resources/application-prod.yml index 5d8c090..bb63df2 100644 --- a/novel-admin/src/main/resources/application-prod.yml +++ b/novel-admin/src/main/resources/application-prod.yml @@ -51,4 +51,42 @@ spring: # 连接池最大连接数(使用负值表示没有限制) max-active: 100 # 连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1 \ No newline at end of file + max-wait: -1 + + +####使用shardingJdbc时, +####所有的jdbcType都不能是LONGVARCHAR,否则会导致java.io.NotSerializableException: java.io.StringReader错误 +##### 应该替换所有的 LONGVARCHAR 类型为VARCHAR + +sharding: + jdbc: + datasource: + names: ds0 #,ds1 + ds0: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: test123456 + # ds1: + # type: com.alibaba.druid.pool.DruidDataSource + # driver-class-name: com.mysql.jdbc.Driver + # url: jdbc:mysql://localhost:3306/novel_plus2 + # username: root + # password: test123456 + config: + sharding: + props: + sql.show: true + tables: + book_content: #book_content表 + key-generator-column-name: id #主键 + actual-data-nodes: ds${0}.book_content${0..9} #数据节点 + # database-strategy: #分库策略 + # inline: + # sharding-column: book_id + # algorithm-expression: ds${book_id % 10} + table-strategy: #分表策略 + inline: + shardingColumn: index_id + algorithm-expression: book_content${index_id % 10} diff --git a/novel-admin/src/main/resources/application.yml b/novel-admin/src/main/resources/application.yml index 7c8e35f..d4f6f89 100644 --- a/novel-admin/src/main/resources/application.yml +++ b/novel-admin/src/main/resources/application.yml @@ -17,13 +17,17 @@ spring: date-format: yyyy-MM-dd HH:mm:ss profiles: active: dev + + #上传文件的最大值(10M) servlet: multipart: - max-file-size: 30Mb - max-request-size: 30Mb + max-file-size: 10485760 + devtools: restart: enabled: true + main: + allow-bean-definition-overriding: true mybatis: configuration: diff --git a/novel-admin/src/main/resources/mybatis/common/DictMapper.xml b/novel-admin/src/main/resources/mybatis/common/DictMapper.xml index dcb2157..95ba707 100644 --- a/novel-admin/src/main/resources/mybatis/common/DictMapper.xml +++ b/novel-admin/src/main/resources/mybatis/common/DictMapper.xml @@ -3,130 +3,140 @@ - + - + - + - - insert into sys_dict - ( - `name`, - `value`, - `type`, - `description`, - `sort`, - `parent_id`, - `create_by`, - `create_date`, - `update_by`, - `update_date`, - `remarks`, - `del_flag` - ) - values - ( - #{name}, - #{value}, - #{type}, - #{description}, - #{sort}, - #{parentId}, - #{createBy}, - #{createDate}, - #{updateBy}, - #{updateDate}, - #{remarks}, - #{delFlag} - ) - + + insert into sys_dict + (`name`, + `value`, + `type`, + `description`, + `sort`, + `parent_id`, + `create_by`, + `create_date`, + `update_by`, + `update_date`, + `remarks`, + `del_flag`) + values (#{name}, + #{value}, + #{type}, + #{description}, + #{sort}, + #{parentId}, + #{createBy}, + #{createDate}, + #{updateBy}, + #{updateDate}, + #{remarks}, + #{delFlag}) + - - update sys_dict - - `name` = #{name}, - `value` = #{value}, - `type` = #{type}, - `description` = #{description}, - `sort` = #{sort}, - `parent_id` = #{parentId}, - `create_by` = #{createBy}, - `create_date` = #{createDate}, - `update_by` = #{updateBy}, - `update_date` = #{updateDate}, - `remarks` = #{remarks}, - `del_flag` = #{delFlag} - - where id = #{id} - + + update sys_dict + + `name` = #{name}, + `value` = #{value}, + `type` = #{type}, + `description` = #{description}, + `sort` = #{sort}, + `parent_id` = #{parentId}, + `create_by` = #{createBy}, + `create_date` = #{createDate}, + `update_by` = #{updateBy}, + `update_date` = #{updateDate}, + `remarks` = #{remarks}, + `del_flag` = #{delFlag} + + where id = #{id} + - - delete from sys_dict where id = #{value} - + + delete + from sys_dict + where id = #{value} + - - delete from sys_dict where id in - - #{id} - - + + delete from sys_dict where id in + + #{id} + + - + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/novel/BookContentMapper.xml b/novel-admin/src/main/resources/mybatis/novel/BookContentMapper.xml new file mode 100644 index 0000000..c6de681 --- /dev/null +++ b/novel-admin/src/main/resources/mybatis/novel/BookContentMapper.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + insert into book_content + (`id`, + `index_id`, + `content`) + values (#{id}, + #{indexId}, + #{content}) + + + + insert into book_content + ( + `id`, + `index_id`, + `content` + ) + values + ( + #{id}, + #{indexId}, + #{content} + ) + + + + update book_content + + `index_id` = #{indexId}, + `content` = #{content} + + where id = #{id} + + + + delete + from book_content + where id = #{value} + + + + delete from book_content where id in + + #{id} + + + + delete from book_content where index_id in + + #{id} + + + + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/novel/BookIndexMapper.xml b/novel-admin/src/main/resources/mybatis/novel/BookIndexMapper.xml new file mode 100644 index 0000000..d139a86 --- /dev/null +++ b/novel-admin/src/main/resources/mybatis/novel/BookIndexMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + insert into book_index + (`id`, + `book_id`, + `index_num`, + `index_name`, + `word_count`, + `is_vip`, + `book_price`, + `storage_type`, + `create_time`, + `update_time`) + values (#{id}, + #{bookId}, + #{indexNum}, + #{indexName}, + #{wordCount}, + #{isVip}, + #{bookPrice}, + #{storageType}, + #{createTime}, + #{updateTime}) + + + + insert into book_index + ( + `id`, + `book_id`, + `index_num`, + `index_name`, + `word_count`, + `is_vip`, + `book_price`, + `storage_type`, + `create_time`, + `update_time` + ) + values + ( + #{id}, + #{bookId}, + #{indexNum}, + #{indexName}, + #{wordCount}, + #{isVip}, + #{bookPrice}, + #{storageType}, + #{createTime}, + #{updateTime} + ) + + + + update book_index + + `book_id` = #{bookId}, + `index_num` = #{indexNum}, + `index_name` = #{indexName}, + `word_count` = #{wordCount}, + `is_vip` = #{isVip}, + `book_price` = #{bookPrice}, + `storage_type` = #{storageType}, + `create_time` = #{createTime}, + `update_time` = #{updateTime} + + where id = #{id} + + + + delete + from book_index + where id = #{value} + + + + delete from book_index where id in + + #{id} + + + + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml b/novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml index 181975c..5c3c44b 100644 --- a/novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml +++ b/novel-admin/src/main/resources/mybatis/system/DataPermMapper.xml @@ -3,149 +3,161 @@ - + - + select + `id`,`name`,`table_name`,`module_name`,`crl_attr_name`,`crl_column_name`,`perm_code`,`order_num`,`gmt_create`,`gmt_modified` + from sys_data_perm + + and id = #{id} + and name = #{name} + and table_name = #{tableName} + and module_name = #{moduleName} + and crl_attr_name = #{crlAttrName} + and crl_column_name = #{crlColumnName} + and perm_code = #{permCode} + and order_num = #{orderNum} + and gmt_create = #{gmtCreate} + and gmt_modified = #{gmtModified} + order by ${sort} ${order} - + order by id desc - + - - limit #{offset}, #{limit} - - - - - - - insert into sys_data_perm - ( - `name`, - `table_name`, - `module_name`, - `crl_attr_name`, - `crl_column_name`, - `perm_code`, - `order_num`, - `gmt_create`, - `gmt_modified` - ) - values - ( - #{name}, - #{tableName}, - #{moduleName}, - #{crlAttrName}, - #{crlColumnName}, - #{permCode}, - #{orderNum}, - #{gmtCreate}, - #{gmtModified} - ) - + + limit #{offset}, #{limit} + + - - insert into sys_data_perm - ( - `id`, - `name`, - `table_name`, - `module_name`, - `crl_attr_name`, - `crl_column_name`, - `perm_code`, - `order_num`, - `gmt_create`, - `gmt_modified` - ) - values - ( - #{id}, - #{name}, - #{tableName}, - #{moduleName}, - #{crlAttrName}, - #{crlColumnName}, - #{permCode}, - #{orderNum}, - #{gmtCreate}, - #{gmtModified} - ) - - - - update sys_data_perm - - `name` = #{name}, - `table_name` = #{tableName}, - `module_name` = #{moduleName}, - `crl_attr_name` = #{crlAttrName}, - `crl_column_name` = #{crlColumnName}, - `perm_code` = #{permCode}, - `order_num` = #{orderNum}, - `gmt_create` = #{gmtCreate}, - `gmt_modified` = #{gmtModified} - - where id = #{id} - - - - delete from sys_data_perm where id = #{value} - - - - delete from sys_data_perm where id in - - #{id} - - + + + + insert into sys_data_perm + (`name`, + `table_name`, + `module_name`, + `crl_attr_name`, + `crl_column_name`, + `perm_code`, + `order_num`, + `gmt_create`, + `gmt_modified`) + values (#{name}, + #{tableName}, + #{moduleName}, + #{crlAttrName}, + #{crlColumnName}, + #{permCode}, + #{orderNum}, + #{gmtCreate}, + #{gmtModified}) + + + + insert into sys_data_perm + ( + `id`, + `name`, + `table_name`, + `module_name`, + `crl_attr_name`, + `crl_column_name`, + `perm_code`, + `order_num`, + `gmt_create`, + `gmt_modified` + ) + values + ( + #{id}, + #{name}, + #{tableName}, + #{moduleName}, + #{crlAttrName}, + #{crlColumnName}, + #{permCode}, + #{orderNum}, + #{gmtCreate}, + #{gmtModified} + ) + + + + update sys_data_perm + + `name` = #{name}, + `table_name` = #{tableName}, + `module_name` = #{moduleName}, + `crl_attr_name` = #{crlAttrName}, + `crl_column_name` = #{crlColumnName}, + `perm_code` = #{permCode}, + `order_num` = #{orderNum}, + `gmt_create` = #{gmtCreate}, + `gmt_modified` = #{gmtModified} + + where id = #{id} + + + + delete + from sys_data_perm + where id = #{value} + + + + delete from sys_data_perm where id in + + #{id} + + - + select `module_name` + from sys_data_perm; - + - - select distinct t1.`table_name`,t1.`module_name`,t1.`crl_attr_name`,t1.`crl_column_name`,t1.`perm_code` - from sys_data_perm t1 - inner join sys_role_data_perm t2 on t1.id = t2.perm_id - inner join sys_user_role t3 on t2.role_id = t3.role_id - and t3.user_id = #{userId} - + select t1.`table_name`, t1.`module_name`, t1.`crl_attr_name`, t1.`crl_column_name`, t1.`perm_code` + from sys_data_perm t1 + inner join sys_role_data_perm t2 on t1.id = t2.perm_id + inner join sys_user_role t3 on t2.role_id = t3.role_id + and t3.user_id = #{userId} + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/system/DeptMapper.xml b/novel-admin/src/main/resources/mybatis/system/DeptMapper.xml index 347e920..33460d5 100644 --- a/novel-admin/src/main/resources/mybatis/system/DeptMapper.xml +++ b/novel-admin/src/main/resources/mybatis/system/DeptMapper.xml @@ -3,96 +3,102 @@ - + - + - + - - insert into sys_dept - ( - `parent_id`, - `name`, - `order_num`, - `del_flag` - ) - values - ( - #{parentId}, - #{name}, - #{orderNum}, - #{delFlag} - ) - + + insert into sys_dept + (`parent_id`, + `name`, + `order_num`, + `del_flag`) + values (#{parentId}, + #{name}, + #{orderNum}, + #{delFlag}) + - - update sys_dept - - `parent_id` = #{parentId}, - `name` = #{name}, - `order_num` = #{orderNum}, - `del_flag` = #{delFlag} - - where dept_id = #{deptId} - + + update sys_dept + + `parent_id` = #{parentId}, + `name` = #{name}, + `order_num` = #{orderNum}, + `del_flag` = #{delFlag} + + where dept_id = #{deptId} + - - delete from sys_dept where dept_id = #{value} - + + delete + from sys_dept + where dept_id = #{value} + - - delete from sys_dept where dept_id in - - #{deptId} - - - - + + delete from sys_dept where dept_id in + + #{deptId} + + + + + select count(*) + from sys_user + where dept_id = #{value} + - + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/system/MenuMapper.xml b/novel-admin/src/main/resources/mybatis/system/MenuMapper.xml index e1ff564..c8bacf4 100644 --- a/novel-admin/src/main/resources/mybatis/system/MenuMapper.xml +++ b/novel-admin/src/main/resources/mybatis/system/MenuMapper.xml @@ -3,134 +3,148 @@ - + - + - + - - insert into sys_menu - ( - `parent_id`, - `name`, - `url`, - `perms`, - `type`, - `icon`, - `order_num`, - `gmt_create`, - `gmt_modified` - ) - values - ( - #{parentId}, - #{name}, - #{url}, - #{perms}, - #{type}, - #{icon}, - #{orderNum}, - #{gmtCreate}, - #{gmtModified} - ) - + + insert into sys_menu + (`parent_id`, + `name`, + `url`, + `perms`, + `type`, + `icon`, + `order_num`, + `gmt_create`, + `gmt_modified`) + values (#{parentId}, + #{name}, + #{url}, + #{perms}, + #{type}, + #{icon}, + #{orderNum}, + #{gmtCreate}, + #{gmtModified}) + - - update sys_menu - - `parent_id` = #{parentId}, - `name` = #{name}, - `url` = #{url}, - `perms` = #{perms}, - `type` = #{type}, - `icon` = #{icon}, - `order_num` = #{orderNum}, - `gmt_create` = #{gmtCreate}, - `gmt_modified` = #{gmtModified} - - where menu_id = #{menuId} - + + update sys_menu + + `parent_id` = #{parentId}, + `name` = #{name}, + `url` = #{url}, + `perms` = #{perms}, + `type` = #{type}, + `icon` = #{icon}, + `order_num` = #{orderNum}, + `gmt_create` = #{gmtCreate}, + `gmt_modified` = #{gmtModified} + + where menu_id = #{menuId} + - - delete from sys_menu where menu_id = #{value} - + + delete + from sys_menu + where menu_id = #{value} + - - delete from sys_menu where menu_id in - - #{menuId} - - + + delete from sys_menu where menu_id in + + #{menuId} + + - + - + \ No newline at end of file diff --git a/novel-admin/src/main/resources/mybatis/system/UserMapper.xml b/novel-admin/src/main/resources/mybatis/system/UserMapper.xml index 2160fa6..64da0cd 100644 --- a/novel-admin/src/main/resources/mybatis/system/UserMapper.xml +++ b/novel-admin/src/main/resources/mybatis/system/UserMapper.xml @@ -4,8 +4,28 @@ + select `user_id`, + `username`, + `name`, + `password`, + `dept_id`, + `email`, + `mobile`, + `status`, + `user_id_create`, + `gmt_create`, + `gmt_modified`, + `sex`, + `birth`, + `pic_id`, + `live_address`, + `hobby`, + `province`, + `city`, + `district` + from sys_user + where user_id = #{value} + - insert into sys_user - ( - `username`, - `name`, - `password`, - `dept_id`, - `email`, - `mobile`, - `status`, - `user_id_create`, - `gmt_create`, - `gmt_modified`, - `sex`, - `birth`, - `pic_id`, - `live_address`, - `hobby`, - `province`, - `city`, - `district` - ) - values - ( - #{username}, - #{name}, - #{password}, - #{deptId}, - #{email}, - #{mobile}, - #{status}, - #{userIdCreate}, - #{gmtCreate}, - #{gmtModified}, - #{sex}, - #{birth}, - #{picId}, - #{liveAddress}, - #{hobby}, - #{province}, - #{city}, - #{district} - ) - + insert into sys_user + (`username`, + `name`, + `password`, + `dept_id`, + `email`, + `mobile`, + `status`, + `user_id_create`, + `gmt_create`, + `gmt_modified`, + `sex`, + `birth`, + `pic_id`, + `live_address`, + `hobby`, + `province`, + `city`, + `district`) + values (#{username}, + #{name}, + #{password}, + #{deptId}, + #{email}, + #{mobile}, + #{status}, + #{userIdCreate}, + #{gmtCreate}, + #{gmtModified}, + #{sex}, + #{birth}, + #{picId}, + #{liveAddress}, + #{hobby}, + #{province}, + #{city}, + #{district}) + update sys_user @@ -219,8 +236,10 @@ - delete from sys_user where user_id = #{value} - + delete + from sys_user + where user_id = #{value} + delete from sys_user where user_id in @@ -230,7 +249,8 @@ + select dept_id + from sys_user + \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/book/book.js b/novel-admin/src/main/resources/static/js/appjs/novel/book/book.js index 7ae039f..96d01b2 100644 --- a/novel-admin/src/main/resources/static/js/appjs/novel/book/book.js +++ b/novel-admin/src/main/resources/static/js/appjs/novel/book/book.js @@ -134,6 +134,18 @@ function load() { { field: 'createTime', title: '入库时间' + }, + + { + title: '操作', + field: 'id', + align: 'center', + formatter: function (value, row, index) { + var r = ' '; + return r; + } } ] diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/add.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/add.js new file mode 100644 index 0000000..cef9c41 --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/add.js @@ -0,0 +1,107 @@ +var E = window.wangEditor; +$("[id^='contentEditor']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(13); + var editor = new E('#contentEditor' + relName); +// 自定义菜单配置 + editor.customConfig.menus = [ + 'head', // 标题 + 'bold', // 粗体 + 'fontSize', // 字号 + 'fontName', // 字体 + 'italic', // 斜体 + 'underline', // 下划线 + 'strikeThrough', // 删除线 + 'foreColor', // 文字颜色 + //'backColor', // 背景颜色 + //'link', // 插入链接 + 'list', // 列表 + 'justify', // 对齐方式 + 'quote', // 引用 + 'emoticon', // 表情 + 'image', // 插入图片 + //'table', // 表格 + //'video', // 插入视频 + //'code', // 插入代码 + 'undo', // 撤销 + 'redo' // 重复 + ]; + editor.customConfig.onchange = function (html) { + // html 即变化之后的内容 + $("#" + relName).val(html); + } + editor.customConfig.uploadImgShowBase64 = true; + editor.create(); + +}) + +$("[id^='picImage']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(8); + layui.use('upload', function () { + var upload = layui.upload; + //执行实例 + var uploadInst = upload.render({ + elem: '#picImage' + relName, //绑定元素 + url: '/common/sysFile/upload', //上传接口 + size: 1000, + accept: 'file', + done: function (r) { + $("#picImage" + relName).attr("src", r.fileName); + $("#" + relName).val(r.fileName); + }, + error: function (r) { + layer.msg(r.msg); + } + }); + }); + +}); + + + + + + +$().ready(function () { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler: function () { + save(); + } +}); +function save() { + $.ajax({ + cache: true, + type: "POST", + url: "/novel/bookContent/save", + data: $('#signupForm').serialize(),// 你的formid + async: false, + error: function (request) { + parent.layer.alert("Connection error"); + }, + success: function (data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + ignore: "", + rules: { + }, + messages: { + } +}) +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/bookContent.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/bookContent.js new file mode 100644 index 0000000..ee9dc89 --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/bookContent.js @@ -0,0 +1,189 @@ +var prefix = "/novel/bookContent" +$(function () { + load(); +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method: 'get', // 服务器数据的请求方式 get or post + url: prefix + "/list", // 服务器数据的加载地址 + // showRefresh : true, + // showToggle : true, + // showColumns : true, + iconSize: 'outline', + toolbar: '#exampleToolbar', + striped: true, // 设置为true会有隔行变色效果 + dataType: "json", // 服务器返回的数据类型 + pagination: true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect: false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize: 10, // 如果设置了分页,每页数据条数 + pageNumber: 1, // 如果设置了分布,首页页码 + //search : true, // 是否显示搜索框 + showColumns: false, // 是否显示内容下拉框(选择显示的列) + sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server" + queryParams: function (params) { + //说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 + var queryParams = getFormJson("searchForm"); + queryParams.limit = params.limit; + queryParams.offset = params.offset; + return queryParams; + }, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + responseHandler: function (rs) { + + if (rs.code == 0) { + return rs.data; + } else { + parent.layer.alert(rs.msg) + return {total: 0, rows: []}; + } + }, + columns: [ + { + checkbox: true + }, + { + title: '序号', + formatter: function () { + return arguments[2] + 1; + } + }, + { + field: 'id', + title: '主键' + }, + + + { + field: 'indexId', + title: '目录ID' + }, + + + { + field: 'content', + title: '小说章节内容' + }, + + + { + title: '操作', + field: 'id', + align: 'center', + formatter: function (value, row, index) { + var d = ' '; + var e = ' '; + var r = ' '; + return d + e + r; + } + }] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function add() { + layer.open({ + type: 2, + title: '增加', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/add' // iframe的url + }); +} +function detail(id) { + layer.open({ + type: 2, + title: '详情', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/detail/' + id // iframe的url + }); +} +function edit(id) { + layer.open({ + type: 2, + title: '编辑', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/edit/' + id // iframe的url + }); +} +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn: ['确定', '取消'] + }, function () { + $.ajax({ + url: prefix + "/remove", + type: "post", + data: { + 'id': id + }, + success: function (r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) +} + +function resetPwd(id) { +} +function batchRemove() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn: ['确定', '取消'] + // 按钮 + }, function () { + var ids = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function (i, row) { + ids[i] = row['id']; + }); + $.ajax({ + type: 'POST', + data: { + "ids": ids + }, + url: prefix + '/batchRemove', + success: function (r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function () { + + }); +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/edit.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/edit.js new file mode 100644 index 0000000..0f8a4e4 --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookContent/edit.js @@ -0,0 +1,103 @@ +var E = window.wangEditor; +$("[id^='contentEditor']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(13); + var editor = new E('#contentEditor' + relName); +// 自定义菜单配置 + editor.customConfig.menus = [ + 'head', // 标题 + 'bold', // 粗体 + 'fontSize', // 字号 + 'fontName', // 字体 + 'italic', // 斜体 + 'underline', // 下划线 + 'strikeThrough', // 删除线 + 'foreColor', // 文字颜色 + //'backColor', // 背景颜色 + //'link', // 插入链接 + 'list', // 列表 + 'justify', // 对齐方式 + 'quote', // 引用 + 'emoticon', // 表情 + 'image', // 插入图片 + //'table', // 表格 + //'video', // 插入视频 + //'code', // 插入代码 + 'undo', // 撤销 + 'redo' // 重复 + ]; + editor.customConfig.onchange = function (html) { + // html 即变化之后的内容 + $("#" + relName).val(html); + } + editor.customConfig.uploadImgShowBase64 = true; + editor.create(); + editor.txt.html($("#" + relName).val()); + +}) + +$("[id^='picImage']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(8); + layui.use('upload', function () { + var upload = layui.upload; + //执行实例 + var uploadInst = upload.render({ + elem: '#picImage' + relName, //绑定元素 + url: '/common/sysFile/upload', //上传接口 + size: 1000, + accept: 'file', + done: function (r) { + $("#picImage" + relName).attr("src", r.fileName); + $("#" + relName).val(r.fileName); + }, + error: function (r) { + layer.msg(r.msg); + } + }); + }); + +}); + +$().ready(function () { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler: function () { + update(); + } +}); +function update() { + $.ajax({ + cache: true, + type: "POST", + url: "/novel/bookContent/update", + data: $('#signupForm').serialize(),// 你的formid + async: false, + error: function (request) { + parent.layer.alert("Connection error"); + }, + success: function (data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + ignore: "", + rules: { + }, + messages: { + } +}) +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/add.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/add.js new file mode 100644 index 0000000..fc8bec0 --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/add.js @@ -0,0 +1,107 @@ +var E = window.wangEditor; +$("[id^='contentEditor']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(13); + var editor = new E('#contentEditor' + relName); +// 自定义菜单配置 + editor.customConfig.menus = [ + 'head', // 标题 + 'bold', // 粗体 + 'fontSize', // 字号 + 'fontName', // 字体 + 'italic', // 斜体 + 'underline', // 下划线 + 'strikeThrough', // 删除线 + 'foreColor', // 文字颜色 + //'backColor', // 背景颜色 + //'link', // 插入链接 + 'list', // 列表 + 'justify', // 对齐方式 + 'quote', // 引用 + 'emoticon', // 表情 + 'image', // 插入图片 + //'table', // 表格 + //'video', // 插入视频 + //'code', // 插入代码 + 'undo', // 撤销 + 'redo' // 重复 + ]; + editor.customConfig.onchange = function (html) { + // html 即变化之后的内容 + $("#" + relName).val(html); + } + editor.customConfig.uploadImgShowBase64 = true; + editor.create(); + +}) + +$("[id^='picImage']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(8); + layui.use('upload', function () { + var upload = layui.upload; + //执行实例 + var uploadInst = upload.render({ + elem: '#picImage' + relName, //绑定元素 + url: '/common/sysFile/upload', //上传接口 + size: 1000, + accept: 'file', + done: function (r) { + $("#picImage" + relName).attr("src", r.fileName); + $("#" + relName).val(r.fileName); + }, + error: function (r) { + layer.msg(r.msg); + } + }); + }); + +}); + + + + + + +$().ready(function () { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler: function () { + save(); + } +}); +function save() { + $.ajax({ + cache: true, + type: "POST", + url: "/novel/bookIndex/save", + data: $('#signupForm').serialize(),// 你的formid + async: false, + error: function (request) { + parent.layer.alert("Connection error"); + }, + success: function (data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + ignore: "", + rules: { + }, + messages: { + } +}) +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/bookIndex.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/bookIndex.js new file mode 100644 index 0000000..7a50846 --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/bookIndex.js @@ -0,0 +1,231 @@ +var prefix = "/novel/bookIndex" +$(function () { + load(); +}); + +function load() { + $('#exampleTable') + .bootstrapTable( + { + method: 'get', // 服务器数据的请求方式 get or post + url: prefix + "/list", // 服务器数据的加载地址 + // showRefresh : true, + // showToggle : true, + // showColumns : true, + iconSize: 'outline', + toolbar: '#exampleToolbar', + striped: true, // 设置为true会有隔行变色效果 + dataType: "json", // 服务器返回的数据类型 + pagination: true, // 设置为true会在底部显示分页条 + // queryParamsType : "limit", + // //设置为limit则会发送符合RESTFull格式的参数 + singleSelect: false, // 设置为true将禁止多选 + // contentType : "application/x-www-form-urlencoded", + // //发送到服务器的数据编码类型 + pageSize: 10, // 如果设置了分页,每页数据条数 + pageNumber: 1, // 如果设置了分布,首页页码 + //search : true, // 是否显示搜索框 + showColumns: false, // 是否显示内容下拉框(选择显示的列) + sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server" + queryParams: function (params) { + //说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对 + var queryParams = getFormJson("searchForm"); + queryParams.limit = params.limit; + queryParams.offset = params.offset; + return queryParams; + }, + // //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 + // queryParamsType = 'limit' ,返回参数必须包含 + // limit, offset, search, sort, order 否则, 需要包含: + // pageSize, pageNumber, searchText, sortName, + // sortOrder. + // 返回false将会终止请求 + responseHandler: function (rs) { + + if (rs.code == 0) { + return rs.data; + } else { + parent.layer.alert(rs.msg) + return {total: 0, rows: []}; + } + }, + columns: [ + { + checkbox: true + }, + { + title: '序号', + formatter: function () { + return arguments[2] + 1; + } + }, + { + field: 'id', + title: '主键' + }, + + + { + field: 'bookId', + title: '小说ID' + }, + + + { + field: 'indexNum', + title: '目录号' + }, + + + { + field: 'indexName', + title: '目录名' + }, + + + { + field: 'wordCount', + title: '字数' + }, + + + { + field: 'isVip', + title: '是否收费,1:收费,0:免费' + }, + + + { + field: 'bookPrice', + title: '章节费用(屋币)' + }, + + + { + field: 'storageType', + title: '存储方式' + }, + + + { + field: 'createTime', + title: '' + }, + + + { + field: 'updateTime', + title: '' + }, + + + { + title: '操作', + field: 'id', + align: 'center', + formatter: function (value, row, index) { + var d = ' '; + var e = ' '; + var r = ' '; + return d + e + r; + } + }] + }); +} +function reLoad() { + $('#exampleTable').bootstrapTable('refresh'); +} +function add() { + layer.open({ + type: 2, + title: '增加', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/add' // iframe的url + }); +} +function detail(id) { + layer.open({ + type: 2, + title: '详情', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/detail/' + id // iframe的url + }); +} +function edit(id) { + layer.open({ + type: 2, + title: '编辑', + maxmin: true, + shadeClose: false, // 点击遮罩关闭层 + area: ['800px', '520px'], + content: prefix + '/edit/' + id // iframe的url + }); +} +function remove(id) { + layer.confirm('确定要删除选中的记录?', { + btn: ['确定', '取消'] + }, function () { + $.ajax({ + url: prefix + "/remove", + type: "post", + data: { + 'id': id + }, + success: function (r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }) +} + +function resetPwd(id) { +} +function batchRemove() { + var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组 + if (rows.length == 0) { + layer.msg("请选择要删除的数据"); + return; + } + layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", { + btn: ['确定', '取消'] + // 按钮 + }, function () { + var ids = new Array(); + // 遍历所有选择的行数据,取每条数据对应的ID + $.each(rows, function (i, row) { + ids[i] = row['id']; + }); + $.ajax({ + type: 'POST', + data: { + "ids": ids + }, + url: prefix + '/batchRemove', + success: function (r) { + if (r.code == 0) { + layer.msg(r.msg); + reLoad(); + } else { + layer.msg(r.msg); + } + } + }); + }, function () { + + }); +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/edit.js b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/edit.js new file mode 100644 index 0000000..63250ab --- /dev/null +++ b/novel-admin/src/main/resources/static/js/appjs/novel/bookIndex/edit.js @@ -0,0 +1,103 @@ +var E = window.wangEditor; +$("[id^='contentEditor']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(13); + var editor = new E('#contentEditor' + relName); +// 自定义菜单配置 + editor.customConfig.menus = [ + 'head', // 标题 + 'bold', // 粗体 + 'fontSize', // 字号 + 'fontName', // 字体 + 'italic', // 斜体 + 'underline', // 下划线 + 'strikeThrough', // 删除线 + 'foreColor', // 文字颜色 + //'backColor', // 背景颜色 + //'link', // 插入链接 + 'list', // 列表 + 'justify', // 对齐方式 + 'quote', // 引用 + 'emoticon', // 表情 + 'image', // 插入图片 + //'table', // 表格 + //'video', // 插入视频 + //'code', // 插入代码 + 'undo', // 撤销 + 'redo' // 重复 + ]; + editor.customConfig.onchange = function (html) { + // html 即变化之后的内容 + $("#" + relName).val(html); + } + editor.customConfig.uploadImgShowBase64 = true; + editor.create(); + editor.txt.html($("#" + relName).val()); + +}) + +$("[id^='picImage']").each(function (index, ele) { + var relName = $(ele).attr("id").substring(8); + layui.use('upload', function () { + var upload = layui.upload; + //执行实例 + var uploadInst = upload.render({ + elem: '#picImage' + relName, //绑定元素 + url: '/common/sysFile/upload', //上传接口 + size: 1000, + accept: 'file', + done: function (r) { + $("#picImage" + relName).attr("src", r.fileName); + $("#" + relName).val(r.fileName); + }, + error: function (r) { + layer.msg(r.msg); + } + }); + }); + +}); + +$().ready(function () { + validateRule(); +}); + +$.validator.setDefaults({ + submitHandler: function () { + update(); + } +}); +function update() { + $.ajax({ + cache: true, + type: "POST", + url: "/novel/bookIndex/update", + data: $('#signupForm').serialize(),// 你的formid + async: false, + error: function (request) { + parent.layer.alert("Connection error"); + }, + success: function (data) { + if (data.code == 0) { + parent.layer.msg("操作成功"); + parent.reLoad(); + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引 + parent.layer.close(index); + + } else { + parent.layer.alert(data.msg) + } + + } + }); + +} +function validateRule() { + var icon = " "; + $("#signupForm").validate({ + ignore: "", + rules: { + }, + messages: { + } +}) +} \ No newline at end of file diff --git a/novel-admin/src/main/resources/static/sql/novel/bookContent/menu.js b/novel-admin/src/main/resources/static/sql/novel/bookContent/menu.js new file mode 100644 index 0000000..30bb9d8 --- /dev/null +++ b/novel-admin/src/main/resources/static/sql/novel/bookContent/menu.js @@ -0,0 +1,18 @@ +-- 菜单SQL +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + VALUES ('1', '小说内容表', 'novel/bookContent', 'novel:bookContent:bookContent', '1', 'fa', '6'); + +-- 按钮父菜单ID +set @parentId = @@identity; + +-- 菜单对应按钮SQL +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '查看', null, 'novel:bookContent:detail', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '新增', null, 'novel:bookContent:add', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '修改', null, 'novel:bookContent:edit', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '删除', null, 'novel:bookContent:remove', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '批量删除', null, 'novel:bookContent:batchRemove', '2', null, '6'; diff --git a/novel-admin/src/main/resources/static/sql/novel/bookIndex/menu.js b/novel-admin/src/main/resources/static/sql/novel/bookIndex/menu.js new file mode 100644 index 0000000..d10edef --- /dev/null +++ b/novel-admin/src/main/resources/static/sql/novel/bookIndex/menu.js @@ -0,0 +1,18 @@ +-- 菜单SQL +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + VALUES ('1', '小说目录表', 'novel/bookIndex', 'novel:bookIndex:bookIndex', '1', 'fa', '6'); + +-- 按钮父菜单ID +set @parentId = @@identity; + +-- 菜单对应按钮SQL +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '查看', null, 'novel:bookIndex:detail', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '新增', null, 'novel:bookIndex:add', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '修改', null, 'novel:bookIndex:edit', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '删除', null, 'novel:bookIndex:remove', '2', null, '6'; +INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`) + SELECT @parentId, '批量删除', null, 'novel:bookIndex:batchRemove', '2', null, '6'; diff --git a/novel-admin/src/main/resources/templates/novel/bookContent/add.html b/novel-admin/src/main/resources/templates/novel/bookContent/add.html new file mode 100644 index 0000000..8b9ebd4 --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookContent/add.html @@ -0,0 +1,46 @@ + + + + + +
+
+
+
+
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + diff --git a/novel-admin/src/main/resources/templates/novel/bookContent/bookContent.html b/novel-admin/src/main/resources/templates/novel/bookContent/bookContent.html new file mode 100644 index 0000000..6ee92ad --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookContent/bookContent.html @@ -0,0 +1,66 @@ + + + + + +
+
+
+
+
+
+ + +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + + \ No newline at end of file diff --git a/novel-admin/src/main/resources/templates/novel/bookContent/detail.html b/novel-admin/src/main/resources/templates/novel/bookContent/detail.html new file mode 100644 index 0000000..f481d78 --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookContent/detail.html @@ -0,0 +1,42 @@ + + + + + +
+
+
+
+
+
+ +
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+
+
+
+
+
+
+ + diff --git a/novel-admin/src/main/resources/templates/novel/bookContent/edit.html b/novel-admin/src/main/resources/templates/novel/bookContent/edit.html new file mode 100644 index 0000000..466813e --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookContent/edit.html @@ -0,0 +1,48 @@ + + + + + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + diff --git a/novel-admin/src/main/resources/templates/novel/bookIndex/add.html b/novel-admin/src/main/resources/templates/novel/bookIndex/add.html new file mode 100644 index 0000000..f53c83b --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookIndex/add.html @@ -0,0 +1,113 @@ + + + + + +
+
+
+
+
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + diff --git a/novel-admin/src/main/resources/templates/novel/bookIndex/bookIndex.html b/novel-admin/src/main/resources/templates/novel/bookIndex/bookIndex.html new file mode 100644 index 0000000..342af27 --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookIndex/bookIndex.html @@ -0,0 +1,66 @@ + + + + + +
+
+
+
+
+
+ + +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + + \ No newline at end of file diff --git a/novel-admin/src/main/resources/templates/novel/bookIndex/detail.html b/novel-admin/src/main/resources/templates/novel/bookIndex/detail.html new file mode 100644 index 0000000..527627f --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookIndex/detail.html @@ -0,0 +1,110 @@ + + + + + +
+
+
+
+
+
+ +
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + diff --git a/novel-admin/src/main/resources/templates/novel/bookIndex/edit.html b/novel-admin/src/main/resources/templates/novel/bookIndex/edit.html new file mode 100644 index 0000000..5d988f5 --- /dev/null +++ b/novel-admin/src/main/resources/templates/novel/bookIndex/edit.html @@ -0,0 +1,115 @@ + + + + + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + + +