文章CRUD
This commit is contained in:
parent
dca36af934
commit
7508ebf5e0
29
ruoyi-admin/src/main/java/com/ruoyi/cms/api/BaseInfoApi.java
Normal file
29
ruoyi-admin/src/main/java/com/ruoyi/cms/api/BaseInfoApi.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.ruoyi.cms.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.cms.domain.BaseInfo;
|
||||
import com.ruoyi.cms.service.IBaseInfoService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/api/baseInfo")
|
||||
public class BaseInfoApi extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBaseInfoService baseInfoService;
|
||||
|
||||
/**
|
||||
* 查询信息
|
||||
*/
|
||||
@GetMapping()
|
||||
public AjaxResult getBaseInfo(){
|
||||
return success(baseInfoService.list(new QueryWrapper<BaseInfo>().last("limit 1")));
|
||||
}
|
||||
}
|
@ -1,15 +1,14 @@
|
||||
package com.ruoyi.cms.api;
|
||||
|
||||
import com.ruoyi.cms.domain.CmsCategory;
|
||||
import com.ruoyi.cms.query.CmsCategoryQuery;
|
||||
import com.ruoyi.cms.query.CmsContentQuery;
|
||||
import com.ruoyi.cms.service.ICmsCategoryService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Anonymous
|
||||
@RequestMapping("/api/category")
|
||||
@ -20,7 +19,7 @@ public class CMSCategoryAPI extends BaseController {
|
||||
private ICmsCategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 获取栏目了栏目
|
||||
* 获取栏目子栏目
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult getCategory(CmsCategory category){
|
||||
@ -29,18 +28,17 @@ public class CMSCategoryAPI extends BaseController {
|
||||
|
||||
/**
|
||||
* 获取栏目下的子栏目及内容
|
||||
* @param id 顶层栏目ID
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getContents(@PathVariable Long id){
|
||||
return success(categoryService.selectCmsCategoryAndContentTreeList(id));
|
||||
@PostMapping()
|
||||
public AjaxResult getContents(@RequestBody CmsCategoryQuery categoryQuery){
|
||||
return success(categoryService.selectCmsCategoryAndContentTreeList(categoryQuery));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个子栏目的内容
|
||||
*/
|
||||
@GetMapping("/content/{id}")
|
||||
public AjaxResult getContentById(@PathVariable Long id){
|
||||
return success(categoryService.getContentById(id));
|
||||
@PostMapping("/content")
|
||||
public AjaxResult getContentById(@RequestBody CmsContentQuery contentQuery){
|
||||
return success(categoryService.getContentById(contentQuery));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.cms.domain.BaseInfo;
|
||||
import com.ruoyi.cms.service.IBaseInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 基础信息Controller
|
||||
*
|
||||
* @author 点亮信息
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/baseInfo")
|
||||
public class BaseInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBaseInfoService baseInfoService;
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BaseInfo baseInfo)
|
||||
{
|
||||
startPage();
|
||||
List<BaseInfo> list = baseInfoService.selectBaseInfoList(baseInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出基础信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:export')")
|
||||
@Log(title = "基础信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseInfo baseInfo)
|
||||
{
|
||||
List<BaseInfo> list = baseInfoService.selectBaseInfoList(baseInfo);
|
||||
ExcelUtil<BaseInfo> util = new ExcelUtil<BaseInfo>(BaseInfo.class);
|
||||
util.exportExcel(response, list, "基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(baseInfoService.selectBaseInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:add')")
|
||||
@Log(title = "基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseInfo baseInfo)
|
||||
{
|
||||
return toAjax(baseInfoService.insertBaseInfo(baseInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:edit')")
|
||||
@Log(title = "基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseInfo baseInfo)
|
||||
{
|
||||
return toAjax(baseInfoService.updateBaseInfo(baseInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除基础信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cms:baseInfo:remove')")
|
||||
@Log(title = "基础信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(baseInfoService.deleteBaseInfoByIds(ids));
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.ruoyi.cms.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.cms.query.CmsContentQuery;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -131,8 +132,8 @@ public class CmsCategoryController extends BaseController
|
||||
/**
|
||||
* 根据栏目ID查其所有的文章
|
||||
*/
|
||||
@GetMapping("/content/{id}")
|
||||
public AjaxResult getContentByCategoryId(@PathVariable Long id){
|
||||
return success(cmsCategoryService.getContentById(id));
|
||||
@GetMapping("/content")
|
||||
public AjaxResult getContentByCategoryId(CmsContentQuery contentQuery){
|
||||
return success(cmsCategoryService.getContentById(contentQuery));
|
||||
}
|
||||
}
|
||||
|
50
ruoyi-admin/src/main/java/com/ruoyi/cms/domain/BaseInfo.java
Normal file
50
ruoyi-admin/src/main/java/com/ruoyi/cms/domain/BaseInfo.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 基础信息对象 base_info
|
||||
*
|
||||
* @author 点亮信息
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
@Data
|
||||
public class BaseInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 记录ID */
|
||||
private Long id;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String webName;
|
||||
|
||||
/** 联系电话 */
|
||||
@Excel(name = "联系电话")
|
||||
private String contactNumber;
|
||||
|
||||
/** 联系邮箱 */
|
||||
@Excel(name = "联系邮箱")
|
||||
private String contactEmail;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
private String address;
|
||||
|
||||
/** logo */
|
||||
@Excel(name = "logo")
|
||||
private String webImg;
|
||||
|
||||
/** 备案信息 */
|
||||
@Excel(name = "备案信息")
|
||||
private String recordInfo;
|
||||
|
||||
/** 版权信息 */
|
||||
@Excel(name = "版权信息")
|
||||
private String copyrightInfo;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.BaseInfo;
|
||||
|
||||
/**
|
||||
* 基础信息Mapper接口
|
||||
*
|
||||
* @author 点亮信息
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
public interface BaseInfoMapper extends BaseMapper<BaseInfo>
|
||||
{
|
||||
/**
|
||||
* 查询基础信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 基础信息
|
||||
*/
|
||||
public BaseInfo selectBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 基础信息集合
|
||||
*/
|
||||
public List<BaseInfo> selectBaseInfoList(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseInfo(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseInfo(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 删除基础信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除基础信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseInfoByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.ruoyi.cms.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CmsCategoryQuery {
|
||||
|
||||
private Long categoryId;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.ruoyi.cms.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CmsContentQuery {
|
||||
|
||||
private Long categoryId;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cms.domain.BaseInfo;
|
||||
|
||||
/**
|
||||
* 基础信息Service接口
|
||||
*
|
||||
* @author 点亮信息
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
public interface IBaseInfoService extends IService<BaseInfo>
|
||||
{
|
||||
/**
|
||||
* 查询基础信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 基础信息
|
||||
*/
|
||||
public BaseInfo selectBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 基础信息集合
|
||||
*/
|
||||
public List<BaseInfo> selectBaseInfoList(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseInfo(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseInfo(BaseInfo baseInfo);
|
||||
|
||||
/**
|
||||
* 批量删除基础信息
|
||||
*
|
||||
* @param ids 需要删除的基础信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除基础信息信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseInfoById(Long id);
|
||||
}
|
@ -7,6 +7,8 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.cms.domain.CmsCategory;
|
||||
import com.ruoyi.cms.domain.CmsContent;
|
||||
import com.ruoyi.cms.domain.vo.CMSCategoryVo;
|
||||
import com.ruoyi.cms.query.CmsCategoryQuery;
|
||||
import com.ruoyi.cms.query.CmsContentQuery;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
@ -101,16 +103,14 @@ public interface ICmsCategoryService extends IService<CmsCategory>
|
||||
|
||||
/**
|
||||
* 获取栏目下的子栏目及文章
|
||||
* @param id 顶层栏目ID
|
||||
*/
|
||||
List<CMSCategoryVo> selectCmsCategoryAndContentTreeList(Long id);
|
||||
List<CMSCategoryVo> selectCmsCategoryAndContentTreeList(CmsCategoryQuery categoryQuery);
|
||||
|
||||
/**
|
||||
* 按ID查文章
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<CmsContent> getContentById(Long id);
|
||||
public PageInfo<CmsContent> getContentById(CmsContentQuery contentQuery);
|
||||
|
||||
/**
|
||||
* 获取所有的叶子节点
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.BaseInfoMapper;
|
||||
import com.ruoyi.cms.domain.BaseInfo;
|
||||
import com.ruoyi.cms.service.IBaseInfoService;
|
||||
|
||||
/**
|
||||
* 基础信息Service业务层处理
|
||||
*
|
||||
* @author 点亮信息
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
@Service
|
||||
public class BaseInfoServiceImpl extends ServiceImpl<BaseInfoMapper, BaseInfo> implements IBaseInfoService
|
||||
{
|
||||
@Autowired
|
||||
private Snowflake snowflake;
|
||||
|
||||
/**
|
||||
* 查询基础信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 基础信息
|
||||
*/
|
||||
@Override
|
||||
public BaseInfo selectBaseInfoById(Long id)
|
||||
{
|
||||
return baseMapper.selectBaseInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询基础信息列表
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 基础信息
|
||||
*/
|
||||
@Override
|
||||
public List<BaseInfo> selectBaseInfoList(BaseInfo baseInfo)
|
||||
{
|
||||
return baseMapper.selectBaseInfoList(baseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseInfo(BaseInfo baseInfo)
|
||||
{
|
||||
baseInfo.setId(snowflake.nextId());
|
||||
return baseMapper.insertBaseInfo(baseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改基础信息
|
||||
*
|
||||
* @param baseInfo 基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseInfo(BaseInfo baseInfo)
|
||||
{
|
||||
return baseMapper.updateBaseInfo(baseInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除基础信息
|
||||
*
|
||||
* @param ids 需要删除的基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseInfoByIds(Long[] ids)
|
||||
{
|
||||
return baseMapper.deleteBaseInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除基础信息信息
|
||||
*
|
||||
* @param id 基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseInfoById(Long id)
|
||||
{
|
||||
return baseMapper.deleteBaseInfoById(id);
|
||||
}
|
||||
}
|
@ -15,6 +15,8 @@ import com.ruoyi.cms.core.NewTreeSelect;
|
||||
import com.ruoyi.cms.domain.CmsContent;
|
||||
import com.ruoyi.cms.domain.vo.CMSCategoryVo;
|
||||
import com.ruoyi.cms.mapper.CmsContentMapper;
|
||||
import com.ruoyi.cms.query.CmsCategoryQuery;
|
||||
import com.ruoyi.cms.query.CmsContentQuery;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
@ -212,15 +214,18 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa
|
||||
/**
|
||||
* 获取栏目下的子栏目及文章
|
||||
*
|
||||
* @param id 顶层栏目ID
|
||||
*/
|
||||
@Override
|
||||
public List<CMSCategoryVo> selectCmsCategoryAndContentTreeList(Long id) {
|
||||
List<CmsCategory> categories = baseMapper.selectList(new QueryWrapper<CmsCategory>().eq("parent_id", id));
|
||||
public List<CMSCategoryVo> selectCmsCategoryAndContentTreeList(CmsCategoryQuery categoryQuery) {
|
||||
List<CmsCategory> categories = baseMapper.selectList(new QueryWrapper<CmsCategory>().eq("parent_id", categoryQuery.getCategoryId()));
|
||||
List<CMSCategoryVo> categoryVoList = categories.stream().map(category -> {
|
||||
CMSCategoryVo categoryVo = new CMSCategoryVo();
|
||||
BeanUtil.copyProperties(category, categoryVo);
|
||||
categoryVo.setChildren(getContentById(category.getId()));
|
||||
CmsContentQuery contentQuery = new CmsContentQuery();
|
||||
contentQuery.setCategoryId(category.getId());
|
||||
contentQuery.setPageNum(categoryQuery.getPageNum());
|
||||
contentQuery.setPageSize(categoryQuery.getPageSize());
|
||||
categoryVo.setChildren(getContentById(contentQuery));
|
||||
return categoryVo;
|
||||
}).collect(Collectors.toList());
|
||||
return categoryVoList;
|
||||
@ -229,14 +234,13 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa
|
||||
/**
|
||||
* 按ID查文章
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<CmsContent> getContentById(Long id) {
|
||||
PageHelper.startPage(1, 10);
|
||||
public PageInfo<CmsContent> getContentById(CmsContentQuery contentQuery) {
|
||||
PageHelper.startPage(contentQuery.getPageNum(), contentQuery.getPageSize());
|
||||
CmsContent content = new CmsContent();
|
||||
content.setCategoryId(id);
|
||||
content.setCategoryId(contentQuery.getCategoryId());
|
||||
content.setStatus("1");
|
||||
content.setDelFlag(0);
|
||||
List<CmsContent> contents = contentMapper.selectCmsContentList(content);
|
||||
|
88
ruoyi-admin/src/main/resources/mapper/cms/BaseInfoMapper.xml
Normal file
88
ruoyi-admin/src/main/resources/mapper/cms/BaseInfoMapper.xml
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.BaseInfoMapper">
|
||||
|
||||
<resultMap type="BaseInfo" id="BaseInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="webName" column="web_name" />
|
||||
<result property="contactNumber" column="contact_number" />
|
||||
<result property="contactEmail" column="contact_email" />
|
||||
<result property="address" column="address" />
|
||||
<result property="webImg" column="web_img" />
|
||||
<result property="recordInfo" column="record_info" />
|
||||
<result property="copyrightInfo" column="copyright_info" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseInfoVo">
|
||||
select id, web_name, contact_number, contact_email, address, web_img, record_info, copyright_info from base_info
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseInfoList" parameterType="BaseInfo" resultMap="BaseInfoResult">
|
||||
<include refid="selectBaseInfoVo"/>
|
||||
<where>
|
||||
<if test="webName != null and webName != ''"> and web_name like concat('%', #{webName}, '%')</if>
|
||||
<if test="contactNumber != null and contactNumber != ''"> and contact_number = #{contactNumber}</if>
|
||||
<if test="contactEmail != null and contactEmail != ''"> and contact_email = #{contactEmail}</if>
|
||||
<if test="address != null and address != ''"> and address = #{address}</if>
|
||||
<if test="webImg != null and webImg != ''"> and web_img = #{webImg}</if>
|
||||
<if test="recordInfo != null and recordInfo != ''"> and record_info = #{recordInfo}</if>
|
||||
<if test="copyrightInfo != null and copyrightInfo != ''"> and copyright_info = #{copyrightInfo}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseInfoById" parameterType="Long" resultMap="BaseInfoResult">
|
||||
<include refid="selectBaseInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseInfo" parameterType="BaseInfo">
|
||||
insert into base_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="webName != null and webName != ''">web_name,</if>
|
||||
<if test="contactNumber != null">contact_number,</if>
|
||||
<if test="contactEmail != null">contact_email,</if>
|
||||
<if test="address != null">address,</if>
|
||||
<if test="webImg != null">web_img,</if>
|
||||
<if test="recordInfo != null">record_info,</if>
|
||||
<if test="copyrightInfo != null">copyright_info,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="webName != null and webName != ''">#{webName},</if>
|
||||
<if test="contactNumber != null">#{contactNumber},</if>
|
||||
<if test="contactEmail != null">#{contactEmail},</if>
|
||||
<if test="address != null">#{address},</if>
|
||||
<if test="webImg != null">#{webImg},</if>
|
||||
<if test="recordInfo != null">#{recordInfo},</if>
|
||||
<if test="copyrightInfo != null">#{copyrightInfo},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseInfo" parameterType="BaseInfo">
|
||||
update base_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="webName != null and webName != ''">web_name = #{webName},</if>
|
||||
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
|
||||
<if test="contactEmail != null">contact_email = #{contactEmail},</if>
|
||||
<if test="address != null">address = #{address},</if>
|
||||
<if test="webImg != null">web_img = #{webImg},</if>
|
||||
<if test="recordInfo != null">record_info = #{recordInfo},</if>
|
||||
<if test="copyrightInfo != null">copyright_info = #{copyrightInfo},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseInfoById" parameterType="Long">
|
||||
delete from base_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseInfoByIds" parameterType="String">
|
||||
delete from base_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
ruoyi-ui/src/api/cms/baseInfo.js
Normal file
44
ruoyi-ui/src/api/cms/baseInfo.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询基础信息列表
|
||||
export function listBaseInfo(query) {
|
||||
return request({
|
||||
url: '/cms/baseInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询基础信息详细
|
||||
export function getBaseInfo(id) {
|
||||
return request({
|
||||
url: '/cms/baseInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增基础信息
|
||||
export function addBaseInfo(data) {
|
||||
return request({
|
||||
url: '/cms/baseInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改基础信息
|
||||
export function updateBaseInfo(data) {
|
||||
return request({
|
||||
url: '/cms/baseInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除基础信息
|
||||
export function delBaseInfo(id) {
|
||||
return request({
|
||||
url: '/cms/baseInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -9,9 +9,10 @@ export function getTab(query) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getbanner(id) {
|
||||
export function getbanner(data) {
|
||||
return request({
|
||||
url: '/api/category/'+id,
|
||||
method: 'get',
|
||||
url: '/api/category',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
99
ruoyi-ui/src/views/cms/baseInfo/index.vue
Normal file
99
ruoyi-ui/src/views/cms/baseInfo/index.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="baseInfo">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="名称" prop="webName">
|
||||
<el-input v-model="form.webName" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="contactNumber">
|
||||
<el-input v-model="form.contactNumber" placeholder="请输入联系电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系邮箱" prop="contactEmail">
|
||||
<el-input v-model="form.contactEmail" placeholder="请输入联系邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="logo" prop="webImg">
|
||||
<image-upload :limit="1" v-model="form.webImg" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备案信息" prop="recordInfo">
|
||||
<el-input v-model="form.recordInfo" placeholder="请输入备案信息" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版权信息" prop="copyrightInfo">
|
||||
<el-input v-model="form.copyrightInfo" placeholder="请输入版权信息" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "BaseInfo",
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
rules: {
|
||||
webName: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateBaseInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addBaseInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
webName: null,
|
||||
contactNumber: null,
|
||||
contactEmail: null,
|
||||
address: null,
|
||||
webImg: null,
|
||||
recordInfo: null,
|
||||
copyrightInfo: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-container{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.baseInfo{
|
||||
width: 40%;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
.dialog-footer{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
@ -24,7 +24,7 @@
|
||||
<div style="overflow: hidden;position: relative;" class="mySwiper">
|
||||
<swiper ref="mySwiper" :options="swiperOptions" style="width: 100%">
|
||||
<swiper-slide v-for="(item,index) in bannerlist" :key="index">
|
||||
<img ref="swiperImg" style="width: 100%; height: 1000px" :src="item" />
|
||||
<img ref="swiperImg" style="width: 100%; height: 1000px" :src="item"/>
|
||||
</swiper-slide>
|
||||
|
||||
</swiper>
|
||||
@ -45,7 +45,7 @@
|
||||
<!-- new -->
|
||||
<div class="new-box">
|
||||
<div class="new-title">
|
||||
{{indexList[0].categoryName}}
|
||||
{{ indexList[0].categoryName }}
|
||||
</div>
|
||||
<div class="new-gang"></div>
|
||||
<div class="new-container">
|
||||
@ -53,7 +53,7 @@
|
||||
<div class="list-box" v-for="(item, index) in this.newList[0]" :key="index">
|
||||
<div class="list-bs">
|
||||
<img :src="item.contentImg" style=" ">
|
||||
<div class="new-wb">{{item.contentTitle}}</div>
|
||||
<div class="new-wb">{{ item.contentTitle }}</div>
|
||||
</div>
|
||||
<div class="list-bs" style="margin-top: 15px;">
|
||||
<div class="icon-title">{{ indexList[0].categoryName }}</div>
|
||||
@ -67,9 +67,9 @@
|
||||
<div>
|
||||
<img :src="item.contentImg" style="">
|
||||
<div class="list-bs">
|
||||
<div class="banner-title">{{item.contentTitle}}</div>
|
||||
<div class="banner-title">{{ item.contentTitle }}</div>
|
||||
<div class="banner-size">
|
||||
<div style="font-weight: 600;font-size: 40px;">{{parseTime(item.createTime, "{d}") }}</div>
|
||||
<div style="font-weight: 600;font-size: 40px;">{{ parseTime(item.createTime, "{d}") }}</div>
|
||||
<div>{{ parseTime(item.createTime, "{y}-{m}") }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,7 +86,7 @@
|
||||
<div class="list-box" v-for="(item, index) in this.newList[1]" :key="index">
|
||||
<div class="list-bs">
|
||||
<img :src="item.contentImg" style="width: 125px; height: 70px ">
|
||||
<div class="new-wb">{{item.contentTitle}}</div>
|
||||
<div class="new-wb">{{ item.contentTitle }}</div>
|
||||
</div>
|
||||
<div class="list-bs" style="margin-top: 15px;">
|
||||
<div class="icon-title">{{ indexList[0].categoryName }}</div>
|
||||
@ -98,24 +98,24 @@
|
||||
</div>
|
||||
<div class="gongao">
|
||||
<div class="new-title">
|
||||
{{indexList[1].categoryName}}
|
||||
{{ indexList[1].categoryName }}
|
||||
</div>
|
||||
<div class="new-gang"></div>
|
||||
<div class="list">
|
||||
<swiper ref="mySwiper" :options="swiperOptions1" style="width: 100%">
|
||||
<swiper-slide class="gongao-item" v-for="item in this.noticeList">
|
||||
<div class="bj">
|
||||
<div class="tt">{{item.contentTitle}}</div>
|
||||
<div class="tt">{{ item.contentTitle }}</div>
|
||||
<div class="p">
|
||||
<div class="tags">
|
||||
{{indexList[1].categoryName}}
|
||||
{{ indexList[1].categoryName }}
|
||||
</div>
|
||||
<div class="time">
|
||||
{{ parseTime(item.createTime, "{y}-{m}-{d}") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{item.summary}}
|
||||
{{ item.summary }}
|
||||
</div>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
@ -130,7 +130,7 @@
|
||||
</div>
|
||||
<div class="news11">
|
||||
<div class="new-title">
|
||||
{{indexList[2].categoryName}}
|
||||
{{ indexList[2].categoryName }}
|
||||
</div>
|
||||
<div class="new-gang"></div>
|
||||
<div class="news11-list">
|
||||
@ -139,11 +139,11 @@
|
||||
<img :src="item.contentImg" class="imgWO" alt="">
|
||||
</div>
|
||||
<div class="tt">
|
||||
{{item.contentTitle}}
|
||||
{{ item.contentTitle }}
|
||||
</div>
|
||||
<div class="tags">
|
||||
<div class="p">{{indexList[2].categoryName}}</div>
|
||||
<div class="icon"> <i class="el-icon-user"></i>
|
||||
<div class="p">{{ indexList[2].categoryName }}</div>
|
||||
<div class="icon"><i class="el-icon-user"></i>
|
||||
3750
|
||||
</div>
|
||||
</div>
|
||||
@ -209,9 +209,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
|
||||
import {Swiper, SwiperSlide} from "vue-awesome-swiper";
|
||||
import "swiper/css/swiper.min.css";
|
||||
import { getTab,getbanner } from "@/api/gw/home";
|
||||
import {getTab, getbanner} from "@/api/gw/home";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Swiper,
|
||||
@ -223,25 +224,30 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
indexList:[],
|
||||
newList:[[], []],
|
||||
categoryQuery: {
|
||||
categoryId: "",
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
indexList: [],
|
||||
newList: [[], []],
|
||||
noticeList: [],
|
||||
nationalVirtualLass:[],
|
||||
nationalVirtualLass: [],
|
||||
tablist: [
|
||||
{ name: '首页' },
|
||||
{ name: '中心概括' },
|
||||
{ name: '教学资源' },
|
||||
{ name: '教学平台' },
|
||||
{ name: '教学团队' },
|
||||
{ name: '专业委员会' },
|
||||
{ name: '教学研讨活动' },
|
||||
{ name: '虚仿专业频道' },
|
||||
{ name: '大赛风采' },
|
||||
{ name: '实践平台' },
|
||||
{ name: '合作企业' },
|
||||
{ name: '联系我们' },
|
||||
{name: '首页'},
|
||||
{name: '中心概括'},
|
||||
{name: '教学资源'},
|
||||
{name: '教学平台'},
|
||||
{name: '教学团队'},
|
||||
{name: '专业委员会'},
|
||||
{name: '教学研讨活动'},
|
||||
{name: '虚仿专业频道'},
|
||||
{name: '大赛风采'},
|
||||
{name: '实践平台'},
|
||||
{name: '合作企业'},
|
||||
{name: '联系我们'},
|
||||
],
|
||||
bannerlist:[],
|
||||
bannerlist: [],
|
||||
isMounted: false,
|
||||
swiperOptions: {
|
||||
navigation: {
|
||||
@ -314,10 +320,10 @@ export default {
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mounted() {
|
||||
// 页面加载完毕调用
|
||||
this.tabLsit();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
customswiper() {
|
||||
let swiper;
|
||||
@ -336,44 +342,39 @@ export default {
|
||||
/** 顶部tab列表 */
|
||||
tabLsit() {
|
||||
getTab().then(response => {
|
||||
if(response.code == 200){
|
||||
if (response.code == 200) {
|
||||
this.tablist = response.data;
|
||||
getbanner(response.data[0].id).then(res => {
|
||||
if(res.code == 200){
|
||||
let list = res.data[3].children.list
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
this.bannerlist.push(process.env.VUE_APP_BASE_API+list[i].imageUrl[0])
|
||||
}
|
||||
this.categoryQuery.categoryId = this.tablist[0].id
|
||||
getbanner(this.categoryQuery).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.indexList = res.data
|
||||
res.data[3].children.list.forEach(item => {
|
||||
this.bannerlist.push(process.env.VUE_APP_BASE_API + item.imageUrl[0])
|
||||
})
|
||||
|
||||
//新闻
|
||||
let index = 0;
|
||||
res.data[0].children.list.forEach(item => {
|
||||
item.contentImg = process.env.VUE_APP_BASE_API + item.contentImg
|
||||
if (index < 4) {
|
||||
this.newList[0].push(item)
|
||||
} else if (index < 8) {
|
||||
this.newList[1].push(item)
|
||||
}
|
||||
index += 1
|
||||
})
|
||||
|
||||
// 通知公告赋值
|
||||
this.noticeList = res.data[1].children.list
|
||||
|
||||
// 比赛
|
||||
this.nationalVirtualLass = res.data[2].children.list
|
||||
this.nationalVirtualLass.forEach(item => {
|
||||
item.contentImg = process.env.VUE_APP_BASE_API + item.contentImg
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
this.categoryList()
|
||||
})
|
||||
},
|
||||
/** 获取首页下的所有子栏目 */
|
||||
categoryList() {
|
||||
getbanner(this.tablist[0].id).then(response => {
|
||||
this.indexList = response.data
|
||||
let index = 0;
|
||||
// 新闻动态赋值
|
||||
this.indexList[0].children.list.forEach(item => {
|
||||
item.contentImg = process.env.VUE_APP_BASE_API + item.contentImg
|
||||
if (index < 4){
|
||||
this.newList[0].push(item)
|
||||
}else if (index < 8) {
|
||||
this.newList[1].push(item)
|
||||
}
|
||||
index += 1
|
||||
})
|
||||
|
||||
// 通知公告赋值
|
||||
this.noticeList = this.indexList[1].children.list
|
||||
|
||||
// 国家级虚拟仿真课赋值
|
||||
this.nationalVirtualLass = this.indexList[2].children.list
|
||||
this.nationalVirtualLass.forEach(item => {
|
||||
item.contentImg = process.env.VUE_APP_BASE_API + item.contentImg
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
@ -400,8 +401,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||
;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
color: #FFFFFF;
|
||||
@ -972,7 +972,8 @@ export default {
|
||||
/* align-items: center; */
|
||||
}
|
||||
|
||||
.index-footer .footer .logo .footer-contact {}
|
||||
.index-footer .footer .logo .footer-contact {
|
||||
}
|
||||
|
||||
.index-footer .footer .logo .footer-contact .p {
|
||||
display: inline-block;
|
||||
|
Loading…
Reference in New Issue
Block a user