diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java new file mode 100644 index 00000000..8a9abd1a --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsArticleController.java @@ -0,0 +1,194 @@ +package org.jeecg.modules.demo.cms.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.demo.cms.entity.CmsArticle; +import org.jeecg.modules.demo.cms.entity.CmsColumn; +import org.jeecg.modules.demo.cms.service.ICmsArticleService; +import org.jeecg.modules.demo.cms.service.ICmsColumnService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.Date; + +/** + * @Description: 文章 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Api(tags = "文章") +@RestController +@RequestMapping("/cms/cmsArticle") +@Slf4j +public class CmsArticleController extends JeecgController { + @Autowired + private ICmsArticleService cmsArticleService; + @Autowired + private ICmsColumnService cmsColumnService; + + /** + * 分页列表查询 + * + * @param cmsArticle + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "文章-分页列表查询") + @ApiOperation(value = "文章-分页列表查询", notes = "文章-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CmsArticle cmsArticle, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(cmsArticle, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = cmsArticleService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param cmsArticle + * @return + */ + @AutoLog(value = "文章-添加") + @ApiOperation(value = "文章-添加", notes = "文章-添加") +// @RequiresPermissions("cms:cms_article:add") + @PostMapping(value = "/add") + public Result add(@RequestBody CmsArticle cmsArticle) { + LoginUser principal = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + cmsArticle.setCreateBy(principal.getUsername()); + CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); + cmsArticle.setColumnName(cmsColumn.getName()); +// if (StringUtils.equals("1", cmsArticle.getStatus())) { + cmsArticle.setPublishTime(new Date()); + cmsArticle.setStatus("1"); +// } + cmsArticleService.save(cmsArticle); + return Result.OK("添加成功!"); + } + + @ApiOperation(value = "文章管理-发布/取消发布", notes = "文章管理-发布/取消发布") + @PostMapping(value = "/operationStatus") + public Result operationStatus(@RequestBody CmsArticle cmsArticle) { + if (StringUtils.equals("1", cmsArticle.getStatus())) { + cmsArticle.setPublishTime(new Date()); + } + + cmsArticleService.updateById(cmsArticle); + return Result.OK("操作成功!"); + } + + /** + * 编辑 + * + * @param cmsArticle + * @return + */ + @AutoLog(value = "文章-编辑") + @ApiOperation(value = "文章-编辑", notes = "文章-编辑") +// @RequiresPermissions("cms:cms_article:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody CmsArticle cmsArticle) { + CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); + if (!ObjectUtils.isEmpty(cmsColumn)) { + cmsArticle.setColumnName(cmsColumn.getName()); + } + cmsArticleService.updateById(cmsArticle); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "文章-通过id删除") + @ApiOperation(value = "文章-通过id删除", notes = "文章-通过id删除") +// @RequiresPermissions("cms:cms_article:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + cmsArticleService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "文章-批量删除") + @ApiOperation(value = "文章-批量删除", notes = "文章-批量删除") +// @RequiresPermissions("cms:cms_article:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.cmsArticleService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "文章-通过id查询") + @ApiOperation(value = "文章-通过id查询", notes = "文章-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + CmsArticle cmsArticle = cmsArticleService.getById(id); + if (cmsArticle == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cmsArticle); + } + + /** + * 导出excel + * + * @param request + * @param cmsArticle + */ +// @RequiresPermissions("cms:cms_article:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CmsArticle cmsArticle) { + return super.exportXls(request, cmsArticle, CmsArticle.class, "文章"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ +// @RequiresPermissions("cms:cms_article:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CmsArticle.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java new file mode 100644 index 00000000..c0e183ea --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/controller/CmsColumnController.java @@ -0,0 +1,334 @@ +package org.jeecg.modules.demo.cms.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.cms.entity.CmsColumn; +import org.jeecg.modules.demo.cms.service.ICmsColumnService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + +/** + * @Description: cms栏目 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Api(tags = "cms栏目") +@RestController +@RequestMapping("/cms/cmsColumn") +@Slf4j +public class CmsColumnController extends JeecgController { + + @Autowired + private ICmsColumnService cmsColumnService; + + /** + * 分页列表查询 + * + * @param cmsColumn + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "cms栏目-分页列表查询") + @ApiOperation(value = "cms栏目-分页列表查询", notes = "cms栏目-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CmsColumn cmsColumn, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(cmsColumn, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = cmsColumnService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 分页列表查询 + * + * @param CmsColumn + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @GetMapping(value = "/rootList") + public Result> rootList(CmsColumn CmsColumn, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { +// String hasQuery = req.getParameter("hasQuery"); +// if (hasQuery != null && "true".equals(hasQuery)) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); +// List list = cmsColumnService.queryTreeListNoPage(queryWrapper); +// IPage pageList = new Page<>(1, 10, list.size()); +// pageList.setRecords(list); +// return Result.OK(pageList); +// } else { +// String parentId = CmsColumn.getPid(); +// if (oConvertUtils.isEmpty(parentId)) { +// parentId = "0"; +// } +// CmsColumn.setPid(null); +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); +// // 使用 eq 防止模糊查询 +// queryWrapper.eq("pid", parentId); +// Page page = new Page(pageNo, pageSize); +// IPage pageList = cmsColumnService.page(page, queryWrapper); +// for (CmsColumn CmsColumn1 : pageList.getRecords()) { +// if (CmsColumn1.getPid().equals("0")) +// CmsColumn1.setPid("无上级"); +// } +// +// return Result.OK(pageList); +// } + + if (oConvertUtils.isEmpty(CmsColumn.getPid())) { + CmsColumn.setPid("0"); + } + Result> result = new Result<>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); + String name = CmsColumn.getName(); + if (StringUtils.isBlank(name)) { + queryWrapper.eq("pid", CmsColumn.getPid()); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = cmsColumnService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 【vue3专用】加载节点的子数据 + * + * @param pid + * @return + */ + @RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET) + public Result> loadTreeChildren(@RequestParam(name = "pid") String pid) { + Result> result = new Result<>(); + try { + List ls = cmsColumnService.queryListByPid(pid); + result.setResult(ls); + result.setSuccess(true); + } catch (Exception e) { + e.printStackTrace(); + result.setMessage(e.getMessage()); + result.setSuccess(false); + } + return result; + } + + /** + * 【vue3专用】加载一级节点/如果是同步 则所有数据 + * + * @param async + * @param pcode + * @return + */ + @RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET) + public Result> loadTreeRoot(@RequestParam(name = "async") Boolean async, + @RequestParam(name = "pcode") String pcode) { + Result> result = new Result<>(); + try { + List ls = cmsColumnService.queryListByCode(pcode); + if (!async) { + loadAllChildren(ls); + } + result.setResult(ls); + result.setSuccess(true); + } catch (Exception e) { + e.printStackTrace(); + result.setMessage(e.getMessage()); + result.setSuccess(false); + } + return result; + } + + /** + * 【vue3专用】递归求子节点 同步加载用到 + * + * @param ls + */ + private void loadAllChildren(List ls) { + for (SelectTreeModel tsm : ls) { + List temp = cmsColumnService.queryListByPid(tsm.getKey()); + if (temp != null && temp.size() > 0) { + tsm.setChildren(temp); + loadAllChildren(temp); + } + } + } + + /** + * 获取子数据 + * + * @param CmsColumn + * @param req + * @return + */ + //@AutoLog(value = "基础能力设置-获取子数据") + @ApiOperation(value = "基础能力设置-获取子数据", notes = "基础能力设置-获取子数据") + @GetMapping(value = "/childList") + public Result> queryPageList(CmsColumn CmsColumn, HttpServletRequest req) { + Result> result = new Result(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(CmsColumn, req.getParameterMap()); + List list = cmsColumnService.list(queryWrapper); + result.setSuccess(true); + result.setResult(list); + return result; + } + + /** + * 批量查询子节点 + * + * @param parentIds 父ID(多个采用半角逗号分割) + * @param parentIds + * @return + */ + //@AutoLog(value = "基础能力设置-批量获取子数据") + @ApiOperation(value = "基础能力设置-批量获取子数据", notes = "基础能力设置-批量获取子数据") + @GetMapping("/getChildListBatch") + public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { + try { + QueryWrapper queryWrapper = new QueryWrapper<>(); + List parentIdList = Arrays.asList(parentIds.split(",")); + queryWrapper.in("pid", parentIdList); + List list = cmsColumnService.list(queryWrapper); + IPage pageList = new Page<>(1, 10, list.size()); + pageList.setRecords(list); + return Result.OK(pageList); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("批量查询子节点失败:" + e.getMessage()); + } + } + + /** + * 添加 + * + * @param cmsColumn + * @return + */ + @AutoLog(value = "cms栏目-添加") + @ApiOperation(value = "cms栏目-添加", notes = "cms栏目-添加") +// @RequiresPermissions("cms:cms_column:add") + @PostMapping(value = "/add") + public Result add(@RequestBody CmsColumn cmsColumn) { + cmsColumnService.save(cmsColumn); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param cmsColumn + * @return + */ + @AutoLog(value = "cms栏目-编辑") + @ApiOperation(value = "cms栏目-编辑", notes = "cms栏目-编辑") +// @RequiresPermissions("cms:cms_column:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result edit(@RequestBody CmsColumn cmsColumn) { + cmsColumnService.updateById(cmsColumn); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "cms栏目-通过id删除") + @ApiOperation(value = "cms栏目-通过id删除", notes = "cms栏目-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + CmsColumn sysCategory = cmsColumnService.getById(id); + if (sysCategory == null) { + result.error500("未找到对应实体"); + } else { + this.cmsColumnService.delete(id); + result.success("删除成功!"); + } + return result; + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "cms栏目-批量删除") + @ApiOperation(value = "cms栏目-批量删除", notes = "cms栏目-批量删除") +// @RequiresPermissions("cms:cms_column:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.cmsColumnService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "cms栏目-通过id查询") + @ApiOperation(value = "cms栏目-通过id查询", notes = "cms栏目-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + CmsColumn cmsColumn = cmsColumnService.getById(id); + if (cmsColumn == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cmsColumn); + } + + /** + * 导出excel + * + * @param request + * @param cmsColumn + */ +// @RequiresPermissions("cms:cms_column:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CmsColumn cmsColumn) { + return super.exportXls(request, cmsColumn, CmsColumn.class, "cms栏目"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ +// @RequiresPermissions("cms:cms_column:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CmsColumn.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsArticle.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsArticle.java new file mode 100644 index 00000000..80877bee --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsArticle.java @@ -0,0 +1,113 @@ +package org.jeecg.modules.demo.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 文章 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Data +@TableName("cms_article") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "cms_article对象", description = "文章") +public class CmsArticle implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String createBy; + /** + * 创建日期 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + /** + * 更新人 + */ + @ApiModelProperty(value = "更新人") + private String updateBy; + /** + * 更新日期 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 文章标题 + */ + @Excel(name = "文章标题", width = 15) + @ApiModelProperty(value = "文章标题") + private String title; + + @Excel(name = "状态", width = 15) + @ApiModelProperty(value = "状态") + @Dict(dicCode = "captain_code") + private String status; + /** + * 文章内容 + */ + @Excel(name = "文章内容", width = 15) + @ApiModelProperty(value = "文章内容") + private String content; + /** + * 所属栏目 + */ + @Excel(name = "所属栏目", width = 15) + @ApiModelProperty(value = "所属栏目") + private String columnId; + /** + * 所属栏目名称 + */ + @Excel(name = "所属栏目名称", width = 15) + @ApiModelProperty(value = "所属栏目名称") + private String columnName; + /** + * 来源 + */ + @Excel(name = "来源", width = 15) + @ApiModelProperty(value = "来源") + private String source; + /** + * 发布时间 + */ + @Excel(name = "发布时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "发布时间") + private Date publishTime; + /** + * 源url + */ + @Excel(name = "源url", width = 15) + @ApiModelProperty(value = "源url") + private String originUrl; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java new file mode 100644 index 00000000..29858f6b --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/entity/CmsColumn.java @@ -0,0 +1,89 @@ +package org.jeecg.modules.demo.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: cms栏目 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Data +@TableName("cms_column") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "cms_column对象", description = "cms栏目") +public class CmsColumn implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String createBy; + /** + * 创建日期 + */ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /** + * 更新人 + */ + @ApiModelProperty(value = "更新人") + private String updateBy; + /** + * 更新日期 + */ + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /** + * 排序 + */ + @Excel(name = "排序", width = 15) + @ApiModelProperty(value = "排序") + private Integer sort; + /** + * 显示 + */ + @Excel(name = "显示", width = 15) + @ApiModelProperty(value = "显示") + @Dict(dicCode = "captain_code") + private String isShow; + /** + * 名称 + */ + @Excel(name = "名称", width = 15) + @ApiModelProperty(value = "名称") + private String name; + /** + * 父级节点 + */ + @Excel(name = "父级节点", width = 15) + @ApiModelProperty(value = "父级节点") + private String pid; + /** + * 是否有子节点 + */ + @Excel(name = "是否有子节点", width = 15) + @ApiModelProperty(value = "是否有子节点") + @Dict(dicCode = "captain_code") + private String hasChild; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsArticleMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsArticleMapper.java new file mode 100644 index 00000000..46e40794 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsArticleMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.cms.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.cms.entity.CmsArticle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 文章 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface CmsArticleMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java new file mode 100644 index 00000000..49df0740 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/CmsColumnMapper.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.demo.cms.mapper; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.modules.demo.cms.entity.CmsColumn; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: cms栏目 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface CmsColumnMapper extends BaseMapper { + + + /** + * @param pid + * @param query + * @return + */ + List queryListByPid(@Param("pid") String pid, @Param("query") Map query); + + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml new file mode 100644 index 00000000..44166449 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/mapper/xml/CmsColumnMapper.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsArticleService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsArticleService.java new file mode 100644 index 00000000..235e3316 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsArticleService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.cms.service; + +import org.jeecg.modules.demo.cms.entity.CmsArticle; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 文章 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface ICmsArticleService extends IService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java new file mode 100644 index 00000000..6ca389bb --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/ICmsColumnService.java @@ -0,0 +1,52 @@ +package org.jeecg.modules.demo.cms.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.modules.demo.cms.entity.CmsColumn; + +import java.util.List; + +/** + * @Description: cms栏目 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +public interface ICmsColumnService extends IService { + + /**根节点父ID的值*/ + public static final String ROOT_PID_VALUE = "0"; + + /**树节点有子节点状态值*/ + public static final String HASCHILD = "1"; + + /**树节点无子节点状态值*/ + public static final String NOCHILD = "0"; + + /** + * 查询所有数据,无分页 + * + * @param queryWrapper + * @return List + */ + List queryTreeListNoPage(QueryWrapper queryWrapper); + + /** + * 【vue3专用】根据父级编码加载分类字典的数据 + * + * @param parentCode + * @return + */ + List queryListByCode(String parentCode); + + /** + * 【vue3专用】根据pid查询子节点集合 + * + * @param pid + * @return + */ + List queryListByPid(String pid); + + void delete(String id); +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsArticleServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsArticleServiceImpl.java new file mode 100644 index 00000000..9d369c3c --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsArticleServiceImpl.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.demo.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.demo.cms.entity.CmsArticle; +import org.jeecg.modules.demo.cms.mapper.CmsArticleMapper; +import org.jeecg.modules.demo.cms.service.ICmsArticleService; +import org.springframework.stereotype.Service; + +/** + * @Description: 文章 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Service +public class CmsArticleServiceImpl extends ServiceImpl implements ICmsArticleService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java new file mode 100644 index 00000000..c465a70f --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/cms/service/impl/CmsColumnServiceImpl.java @@ -0,0 +1,188 @@ +package org.jeecg.modules.demo.cms.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.constant.SymbolConstant; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.system.vo.SelectTreeModel; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.cms.entity.CmsColumn; +import org.jeecg.modules.demo.cms.mapper.CmsColumnMapper; +import org.jeecg.modules.demo.cms.service.ICmsColumnService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @Description: cms栏目 + * @Author: jeecg-boot + * @Date: 2023-10-11 + * @Version: V1.0 + */ +@Service +public class CmsColumnServiceImpl extends ServiceImpl implements ICmsColumnService { + + @Override + public List queryTreeListNoPage(QueryWrapper queryWrapper) { + List dataList = baseMapper.selectList(queryWrapper); + List mapList = new ArrayList<>(); + for (CmsColumn data : dataList) { + String pidVal = data.getPid(); + //递归查询子节点的根节点 + if (pidVal != null && !ICmsColumnService.NOCHILD.equals(pidVal)) { + CmsColumn rootVal = this.getTreeRoot(pidVal); + if (rootVal != null && !mapList.contains(rootVal)) { + mapList.add(rootVal); + } + } else { + if (!mapList.contains(data)) { + mapList.add(data); + } + } + } + return mapList; + } + + @Override + public List queryListByCode(String parentCode) { + String pid = ROOT_PID_VALUE; + if (oConvertUtils.isNotEmpty(parentCode)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CmsColumn::getPid, parentCode); + List list = baseMapper.selectList(queryWrapper); + if (list == null || list.size() == 0) { + throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!"); + } + if (list.size() > 1) { + throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!"); + } + pid = list.get(0).getId(); + } + return baseMapper.queryListByPid(pid, null); + + } + + @Override + public List queryListByPid(String pid) { + if (oConvertUtils.isEmpty(pid)) { + pid = ROOT_PID_VALUE; + } + return baseMapper.queryListByPid(pid, null); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String ids) { + String allIds = this.queryTreeChildIds(ids); + String pids = this.queryTreePids(ids); + //1.删除时将节点下所有子节点一并删除 + this.baseMapper.deleteBatchIds(Arrays.asList(allIds.split(","))); + //2.将父节点中已经没有下级的节点,修改为没有子节点 + if (oConvertUtils.isNotEmpty(pids)) { + LambdaUpdateWrapper updateWrapper = new UpdateWrapper() + .lambda() + .in(CmsColumn::getId, Arrays.asList(pids.split(","))) + .set(CmsColumn::getHasChild, "0"); + this.update(updateWrapper); + } + } + + /** + * 查询需修改标识的父节点ids + * + * @param ids + * @return + */ + private String queryTreePids(String ids) { + StringBuffer sb = new StringBuffer(); + //获取id数组 + String[] idArr = ids.split(","); + for (String id : idArr) { + if (id != null) { + CmsColumn category = this.baseMapper.selectById(id); + //根据id查询pid值 + String metaPid = category.getPid(); + //查询此节点上一级是否还有其他子节点 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CmsColumn::getPid, metaPid); + queryWrapper.notIn(CmsColumn::getId, Arrays.asList(idArr)); + List dataList = this.baseMapper.selectList(queryWrapper); + boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(metaPid) + && !sb.toString().contains(metaPid); + if (flag) { + //如果当前节点原本有子节点 现在木有了,更新状态 + sb.append(metaPid).append(","); + } + } + } + if (sb.toString().endsWith(SymbolConstant.COMMA)) { + sb = sb.deleteCharAt(sb.length() - 1); + } + return sb.toString(); + } + + /** + * 递归查询节点的根节点 + * + * @param pidVal + * @return + */ + private CmsColumn getTreeRoot(String pidVal) { + CmsColumn data = baseMapper.selectById(pidVal); + if (data != null && !ICmsColumnService.ROOT_PID_VALUE.equals(data.getPid())) { + return this.getTreeRoot(data.getPid()); + } else { + return data; + } + } + + /** + * 根据id查询所有子节点id + * + * @param ids + * @return + */ + private String queryTreeChildIds(String ids) { + //获取id数组 + String[] idArr = ids.split(","); + StringBuffer sb = new StringBuffer(); + for (String pidVal : idArr) { + if (pidVal != null) { + if (!sb.toString().contains(pidVal)) { + if (sb.toString().length() > 0) { + sb.append(","); + } + sb.append(pidVal); + this.getTreeChildIds(pidVal, sb); + } + } + } + return sb.toString(); + } + + /** + * 递归查询所有子节点 + * + * @param pidVal + * @param sb + * @return + */ + private StringBuffer getTreeChildIds(String pidVal, StringBuffer sb) { + List dataList = baseMapper.selectList(new QueryWrapper().eq("pid", pidVal)); + if (dataList != null && dataList.size() > 0) { + for (CmsColumn tree : dataList) { + if (!sb.toString().contains(tree.getId())) { + sb.append(",").append(tree.getId()); + } + this.getTreeChildIds(tree.getId(), sb); + } + } + return sb; + } +} diff --git a/jeecg-boot-master/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-boot-master/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index 608c539f..3b8786a6 100644 --- a/jeecg-boot-master/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-boot-master/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -131,9 +131,9 @@ spring: connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: - url: jdbc:mysql://localhost:3306/comp?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai + url: jdbc:mysql://182.92.169.222:3306/comp?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root - password: 123456 + password: ycwl2022. driver-class-name: com.mysql.cj.jdbc.Driver # 多数据源配置 #multi-datasource1: @@ -143,10 +143,10 @@ spring: #driver-class-name: com.mysql.cj.jdbc.Driver #redis 配置 redis: - database: 0 - host: 127.0.0.1 + database: 2 + host: 182.92.169.222 port: 6379 - password: '' + password: 'redis@ycwl2022.' #mybatis plus 设置 mybatis-plus: mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.api.ts b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.api.ts new file mode 100644 index 00000000..2ea07967 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.api.ts @@ -0,0 +1,68 @@ +import {defHttp} from '/@/utils/http/axios'; +import { useMessage } from "/@/hooks/web/useMessage"; + +const { createConfirm } = useMessage(); + +enum Api { + list = '/cms/cmsArticle/list', + save='/cms/cmsArticle/add', + edit='/cms/cmsArticle/edit', + deleteOne = '/cms/cmsArticle/delete', + deleteBatch = '/cms/cmsArticle/deleteBatch', + importExcel = '/cms/cmsArticle/importExcel', + exportXls = '/cms/cmsArticle/exportXls', + operationStatus = '/cms/cmsArticle/operationStatus', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; + +export const updateStatus = (params) => defHttp.post({url: Api.operationStatus, params}); + +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + createConfirm({ + iconType: 'warning', + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.data.ts b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.data.ts new file mode 100644 index 00000000..6d891f67 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle.data.ts @@ -0,0 +1,143 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +// import { rules} from '/@/utils/helper/validator'; +// import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '所属栏目', + align: "center", + dataIndex: 'columnName' + }, + { + title: '文章标题', + align: "center", + dataIndex: 'title', + // slots: {customRender: 'htmlSlot'}, + }, + { + title: '作者', + align: "center", + dataIndex: 'createBy_dictText' + }, + { + title: '来源', + align: "center", + dataIndex: 'source' + }, + { + title: '状态', + align: "center", + dataIndex: 'status_dictText' + }, + { + title: '发布时间', + align: "center", + dataIndex: 'publishTime' + }, + // { + // title: '源url', + // align: "center", + // dataIndex: 'originUrl' + // }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ + { + label: "所属栏目", + field: 'columnId', + component: 'JDictSelectTag', + componentProps: { + dictCode: "cms_column,name,id" + }, + colProps: {span: 6}, + }, + { + label: "文章标题", + field: 'title', + component: 'Input', + colProps: {span: 6}, + }, + { + label: "是否发布", + field: 'status', + component: 'JDictSelectTag', + componentProps: { + dictCode: "captain_code" + }, + colProps: {span: 3}, + }, +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '文章标题', + field: 'title', + component: 'Input', + dynamicRules: ({model, schema}) => { + return [ + {required: true, message: '请输入文章标题!'}, + ]; + }, + }, + { + label: '所属栏目', + field: 'columnId', + component: 'JDictSelectTag', + componentProps: { + dictCode: "cms_column,name,id" + + }, + dynamicRules: ({model, schema}) => { + return [ + {required: true, message: '请输入所属栏目!'}, + ]; + }, + }, + { + label: '文章内容', + field: 'content', + component: 'JEditor', + }, + // { + // label: '所属栏目名称', + // field: 'columnName', + // component: 'Input', + // }, + { + label: '发布时间', + field: 'publishTime', + component: 'DatePicker', + componentProps: { + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss' + }, + }, + { + label: '来源', + field: 'source', + component: 'Input', + }, + { + label: '源url', + field: 'originUrl', + component: 'Input', + }, + // TODO 主键隐藏字段,目前写死为ID + { + label: '', + field: 'id', + component: 'Input', + show: false + }, +]; + + +/** + * 流程表单调用这个方法获取formSchema + * @param param + */ +export function getBpmFormSchema(_formData): FormSchema[] { + // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema + return formSchema; +} diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue new file mode 100644 index 00000000..986a66ab --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticleList.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle_menu_insert.sql b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle_menu_insert.sql new file mode 100644 index 00000000..0e34975e --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/CmsArticle_menu_insert.sql @@ -0,0 +1,26 @@ +-- 注意:该页面对应的前台目录为views/cms文件夹下 +-- 如果你想更改到其他目录,请修改sql中component字段对应的值 + + +INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) +VALUES ('2023101212013790550', NULL, '文章', '/cms/cmsArticleList', 'cms/CmsArticleList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0); + +-- 权限控制sql +-- 新增 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790551', '2023101212013790550', '添加文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); +-- 编辑 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790552', '2023101212013790550', '编辑文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); +-- 删除 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790553', '2023101212013790550', '删除文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); +-- 批量删除 +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790554', '2023101212013790550', '批量删除文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); +-- 导出excel +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790555', '2023101212013790550', '导出excel_文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); +-- 导入excel +INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +VALUES ('2023101212013790556', '2023101212013790550', '导入excel_文章', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_article:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 12:01:55', NULL, NULL, 0, 0, '1', 0); diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleForm.vue b/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleForm.vue new file mode 100644 index 00000000..aeab99d9 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleForm.vue @@ -0,0 +1,70 @@ + + + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleModal.vue b/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleModal.vue new file mode 100644 index 00000000..d338f6ec --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/articel/components/CmsArticleModal.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts new file mode 100644 index 00000000..be0f65bd --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.api.ts @@ -0,0 +1,92 @@ +import {defHttp} from '/@/utils/http/axios'; +import { useMessage } from "/@/hooks/web/useMessage"; + +const { createConfirm } = useMessage(); + +enum Api { + list = '/cms/cmsColumn/rootList', + save='/cms/cmsColumn/add', + edit='/cms/cmsColumn/edit', + deleteOne = '/cms/cmsColumn/delete', + deleteBatch = '/cms/cmsColumn/deleteBatch', + importExcel = '/cms/cmsColumn/importExcel', + exportXls = '/cms/cmsColumn/exportXls', + loadTreeData = '/cms/cmsColumn/loadTreeRoot', + getChildList = '/cms/cmsColumn/childList', + getChildListBatch = '/cms/cmsColumn/getChildListBatch', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + createConfirm({ + iconType: 'warning', + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +// export const saveOrUpdate = (params, isUpdate) => { +// let url = isUpdate ? Api.edit : Api.save; +// return defHttp.post({url: url, params}); +// } + +export const saveOrUpdateDict = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} + +/** + * 查询全部树形节点数据 + * @param params + */ +export const loadTreeData = (params) => + defHttp.get({url: Api.loadTreeData,params}); +/** + * 查询子节点数据 + * @param params + */ +export const getChildList = (params) => + defHttp.get({url: Api.getChildList, params}); +/** + * 批量查询子节点数据 + * @param params + */ +export const getChildListBatch = (params) => + defHttp.get({url: Api.getChildListBatch, params},{isTransformResponse:false}); + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts new file mode 100644 index 00000000..cff4b5c0 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn.data.ts @@ -0,0 +1,109 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + // { + // title: '父级节点', + // align:"center", + // dataIndex: 'pid' + // }, + { + title: '栏目名称', + align:"left", + dataIndex: 'name', + width: 350, + }, + { + title: '显示', + align:"center", + dataIndex: 'isShow_dictText' + }, + { + title: '排序', + align:"center", + dataIndex: 'sort' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ + { + label: "栏目名称", + field: 'name', + component: 'Input', + colProps: {span: 6}, + }, +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '父级节点', + field: 'pid', + component: 'JTreeSelect', + componentProps: { + dict: 'cms_column,name,id', + pidField: 'pid', + pidValue: '0', + hasChildField: 'has_child', + }, + dynamicDisabled: true, + }, + { + label: '栏目名称', + field: 'name', + component: 'Input', + dynamicRules: ({model,schema}) => { + return [ + { required: true, message: '请输入栏目名称!'}, + ]; + }, + }, + // { + // label: '是否有子节点', + // field: 'hasChild', + // component: 'Input', + // }, + + { + label: '显示', + field: 'isShow', + component: 'RadioGroup', + componentProps: { + //options里面由一个一个的radio组成,支持disabled + options: [ + { label: '是', value: 1, }, + { label: '否', value: 0 }, + ], + defaultValue:1, + }, + }, + { + label: '排序', + field: 'sort', + component: 'InputNumber', + dynamicRules: ({model,schema}) => { + return [ + { required: true, message: '请输入排序!'}, + ]; + }, + }, + // TODO 主键隐藏字段,目前写死为ID + { + label: '', + field: 'id', + component: 'Input', + show: false + }, +]; + + + +/** +* 流程表单调用这个方法获取formSchema +* @param param +*/ +export function getBpmFormSchema(_formData): FormSchema[]{ + // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema + return formSchema; +} diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue new file mode 100644 index 00000000..6013f3c7 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumnList.vue @@ -0,0 +1,315 @@ + + + + + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn_menu_insert.sql b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn_menu_insert.sql new file mode 100644 index 00000000..23ffe5f8 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/CmsColumn_menu_insert.sql @@ -0,0 +1,26 @@ +-- -- 注意:该页面对应的前台目录为views/cms文件夹下 +-- -- 如果你想更改到其他目录,请修改sql中component字段对应的值 +-- +-- +-- INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) +-- VALUES ('2023101208468620390', NULL, 'cms栏目', '/cms/cmsColumnList', 'cms/CmsColumnList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0); +-- +-- -- 权限控制sql +-- -- 新增 +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620391', '2023101208468620390', '添加cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); +-- -- 编辑 +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620392', '2023101208468620390', '编辑cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); +-- -- 删除 +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620393', '2023101208468620390', '删除cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); +-- -- 批量删除 +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620394', '2023101208468620390', '批量删除cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); +-- -- 导出excel +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620395', '2023101208468620390', '导出excel_cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); +-- -- 导入excel +-- INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) +-- VALUES ('2023101208468620396', '2023101208468620390', '导入excel_cms栏目', NULL, NULL, 0, NULL, NULL, 2, 'cms:cms_column:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2023-10-12 08:46:39', NULL, NULL, 0, 0, '1', 0); diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnForm.vue b/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnForm.vue new file mode 100644 index 00000000..cf339b73 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnForm.vue @@ -0,0 +1,70 @@ + + + diff --git a/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnModal.vue b/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnModal.vue new file mode 100644 index 00000000..e9d29d03 --- /dev/null +++ b/jeecgboot-vue3-master/src/views/cms/admin/column/components/CmsColumnModal.vue @@ -0,0 +1,112 @@ + + + + +