2024.8.2
This commit is contained in:
		
							parent
							
								
									a31a2ff1e7
								
							
						
					
					
						commit
						2fd13b6779
					
				| @ -10,6 +10,8 @@ import com.ruoyi.common.utils.sign.Base64; | |||||||
| import com.ruoyi.system.domain.XysArticle; | import com.ruoyi.system.domain.XysArticle; | ||||||
| import com.ruoyi.system.domain.XysCategory; | import com.ruoyi.system.domain.XysCategory; | ||||||
| import com.ruoyi.system.domain.XysImg; | import com.ruoyi.system.domain.XysImg; | ||||||
|  | import com.ruoyi.system.mapper.XysArticleMapper; | ||||||
|  | import com.ruoyi.system.mapper.XysCategoryMapper; | ||||||
| import com.ruoyi.system.service.IXysArticleService; | import com.ruoyi.system.service.IXysArticleService; | ||||||
| import com.ruoyi.system.service.IXysCategoryService; | import com.ruoyi.system.service.IXysCategoryService; | ||||||
| import com.ruoyi.system.service.IXysImgService; | import com.ruoyi.system.service.IXysImgService; | ||||||
| @ -36,6 +38,10 @@ public class DoorController extends BaseController | |||||||
|     private IXysImgService xysImgService; |     private IXysImgService xysImgService; | ||||||
|     @Autowired |     @Autowired | ||||||
|     private IXysCategoryService categoryService; |     private IXysCategoryService categoryService; | ||||||
|  |     @Autowired | ||||||
|  |     private XysArticleMapper articleMapper; | ||||||
|  |     @Autowired | ||||||
|  |     private XysCategoryMapper categoryMapper; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @ -90,4 +96,49 @@ public class DoorController extends BaseController | |||||||
|         return success(categoryService.selectXysCategoryList(category)); |         return success(categoryService.selectXysCategoryList(category)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 下一篇 | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/getNext") | ||||||
|  |     public AjaxResult getNext(XysArticle xysArticle) | ||||||
|  |     { | ||||||
|  |         return success(articleMapper.getNext(xysArticle)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 上一篇 | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/getUp") | ||||||
|  |     public AjaxResult getUp(XysArticle xysArticle) | ||||||
|  |     { | ||||||
|  |         return success(articleMapper.getUp(xysArticle)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 下一篇 | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/getNextCat") | ||||||
|  |     public AjaxResult getNextCat(XysCategory xysCategory) | ||||||
|  |     { | ||||||
|  |         return success(categoryMapper.getNextCat(xysCategory)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 上一篇 | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/getUpCat") | ||||||
|  |     public AjaxResult getUpCat(XysCategory xysCategory) | ||||||
|  |     { | ||||||
|  |         return success(categoryMapper.getUpCat(xysCategory)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * | ||||||
|  |      */ | ||||||
|  |     @GetMapping(value = "/getCategoryById/{id}") | ||||||
|  |     public AjaxResult getCategoryById(@PathVariable("id") Long Id) | ||||||
|  |     { | ||||||
|  |         return success(categoryService.selectXysCategoryById(Id)); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,6 +46,17 @@ public class XysCategoryController extends BaseController | |||||||
|         return getDataTable(list); |         return getDataTable(list); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询文章分类列表 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('system:category:list')") | ||||||
|  |     @GetMapping("/catList") | ||||||
|  |     public TableDataInfo catList(XysCategory xysCategory) | ||||||
|  |     { | ||||||
|  |         List<XysCategory> list = xysCategoryService.selectXysCategoryList(xysCategory); | ||||||
|  |         return getDataTable(list); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 导出文章分类列表 |      * 导出文章分类列表 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -26,6 +26,18 @@ public class XysArticle extends BaseEntity | |||||||
|     @Excel(name = "封面图") |     @Excel(name = "封面图") | ||||||
|     private String coverImg; |     private String coverImg; | ||||||
| 
 | 
 | ||||||
|  |     public String getContentImg() { | ||||||
|  |         return contentImg; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setContentImg(String contentImg) { | ||||||
|  |         this.contentImg = contentImg; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** 封面图 */ | ||||||
|  |     @Excel(name = "内容图片") | ||||||
|  |     private String contentImg; | ||||||
|  | 
 | ||||||
|     public String getDescription() { |     public String getDescription() { | ||||||
|         return description; |         return description; | ||||||
|     } |     } | ||||||
| @ -46,9 +58,29 @@ public class XysArticle extends BaseEntity | |||||||
|     @Excel(name = "文章所属分类") |     @Excel(name = "文章所属分类") | ||||||
|     private Long articleCat; |     private Long articleCat; | ||||||
| 
 | 
 | ||||||
|  |     public String getCatName() { | ||||||
|  |         return catName; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setCatName(String catName) { | ||||||
|  |         this.catName = catName; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private String catName; | ||||||
|  | 
 | ||||||
|     /** $column.columnComment */ |     /** $column.columnComment */ | ||||||
|     private String delFlag; |     private String delFlag; | ||||||
| 
 | 
 | ||||||
|  |     public Integer getSort() { | ||||||
|  |         return sort; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setSort(Integer sort) { | ||||||
|  |         this.sort = sort; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private Integer sort; | ||||||
|  | 
 | ||||||
|     public void setId(Long id) |     public void setId(Long id) | ||||||
|     { |     { | ||||||
|         this.id = id; |         this.id = id; | ||||||
|  | |||||||
| @ -40,6 +40,16 @@ public class XysCategory extends BaseEntity | |||||||
|     @Excel(name = "封面图") |     @Excel(name = "封面图") | ||||||
|     private String coverImg; |     private String coverImg; | ||||||
| 
 | 
 | ||||||
|  |     public String getContentImg() { | ||||||
|  |         return contentImg; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setContentImg(String contentImg) { | ||||||
|  |         this.contentImg = contentImg; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private String contentImg; | ||||||
|  | 
 | ||||||
|     /** 简介 */ |     /** 简介 */ | ||||||
|     @Excel(name = "简介") |     @Excel(name = "简介") | ||||||
|     private String description; |     private String description; | ||||||
| @ -47,6 +57,16 @@ public class XysCategory extends BaseEntity | |||||||
|     /**  */ |     /**  */ | ||||||
|     private String delFlag; |     private String delFlag; | ||||||
| 
 | 
 | ||||||
|  |     public Integer getSort() { | ||||||
|  |         return sort; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void setSort(Integer sort) { | ||||||
|  |         this.sort = sort; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private Integer sort; | ||||||
|  | 
 | ||||||
|     public void setId(Long id) |     public void setId(Long id) | ||||||
|     { |     { | ||||||
|         this.id = id; |         this.id = id; | ||||||
|  | |||||||
| @ -65,4 +65,8 @@ public interface XysArticleMapper | |||||||
|      * @return 结果 |      * @return 结果 | ||||||
|      */ |      */ | ||||||
|     public int deleteXysArticleByIds(Long[] ids); |     public int deleteXysArticleByIds(Long[] ids); | ||||||
|  | 
 | ||||||
|  |     XysArticle getNext(XysArticle xysArticle); | ||||||
|  | 
 | ||||||
|  |     XysArticle getUp(XysArticle xysArticle); | ||||||
| } | } | ||||||
|  | |||||||
| @ -58,4 +58,8 @@ public interface XysCategoryMapper | |||||||
|      * @return 结果 |      * @return 结果 | ||||||
|      */ |      */ | ||||||
|     public int deleteXysCategoryByIds(Long[] ids); |     public int deleteXysCategoryByIds(Long[] ids); | ||||||
|  | 
 | ||||||
|  |     XysCategory getNextCat(XysCategory xysCategory); | ||||||
|  | 
 | ||||||
|  |     XysCategory getUpCat(XysCategory xysCategory); | ||||||
| } | } | ||||||
|  | |||||||
| @ -8,9 +8,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|         <result property="id" column="id"/> |         <result property="id" column="id"/> | ||||||
|         <result property="title" column="title"/> |         <result property="title" column="title"/> | ||||||
|         <result property="coverImg" column="cover_img"/> |         <result property="coverImg" column="cover_img"/> | ||||||
|  |         <result property="contentImg" column="content_img"/> | ||||||
|         <result property="description" column="description"/> |         <result property="description" column="description"/> | ||||||
|         <result property="content" column="content"/> |         <result property="content" column="content"/> | ||||||
|         <result property="articleCat" column="article_cat"/> |         <result property="articleCat" column="article_cat"/> | ||||||
|  |         <result property="sort" column="sort"/> | ||||||
|         <result property="createTime" column="create_time"/> |         <result property="createTime" column="create_time"/> | ||||||
|         <result property="createBy" column="create_by"/> |         <result property="createBy" column="create_by"/> | ||||||
|         <result property="updateTime" column="update_time"/> |         <result property="updateTime" column="update_time"/> | ||||||
| @ -20,7 +22,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|     </resultMap> |     </resultMap> | ||||||
| 
 | 
 | ||||||
|     <sql id="selectXysArticleVo"> |     <sql id="selectXysArticleVo"> | ||||||
|         select id, title, cover_img, description,content, article_cat, create_time, create_by, update_time, update_by, remark, del_flag from xys_article |         select id, | ||||||
|  |                title, | ||||||
|  |                cover_img, | ||||||
|  |                content_img, | ||||||
|  |                description, | ||||||
|  |                content, | ||||||
|  |                article_cat, | ||||||
|  |                sort, | ||||||
|  |                create_time, | ||||||
|  |                create_by, | ||||||
|  |                update_time, | ||||||
|  |                update_by, | ||||||
|  |                remark, | ||||||
|  |                del_flag | ||||||
|  |         from xys_article | ||||||
|     </sql> |     </sql> | ||||||
| 
 | 
 | ||||||
|     <select id="selectHomeArticleList" parameterType="XysArticle" resultMap="XysArticleResult"> |     <select id="selectHomeArticleList" parameterType="XysArticle" resultMap="XysArticleResult"> | ||||||
| @ -35,12 +51,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|     <select id="selectXysArticleList" parameterType="XysArticle" resultMap="XysArticleResult"> |     <select id="selectXysArticleList" parameterType="XysArticle" resultMap="XysArticleResult"> | ||||||
|         <include refid="selectXysArticleVo"/> |         select a.*,c.title as catName from xys_article a left join xys_category c on a.article_cat = c.id | ||||||
|         <where> |         <where> | ||||||
|             <if test="title != null  and title != ''"> and title = #{title}</if> |             <if test="title != null  and title != ''">and a.title = #{title}</if> | ||||||
|             <if test="articleCat != null "> and article_cat = #{articleCat}</if> |             <if test="articleCat != null ">and a.article_cat = #{articleCat}</if> | ||||||
|         </where> |         </where> | ||||||
|         order by create_time desc |         order by sort asc,create_time desc | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|     <select id="selectXysArticleById" parameterType="Long" resultMap="XysArticleResult"> |     <select id="selectXysArticleById" parameterType="Long" resultMap="XysArticleResult"> | ||||||
| @ -53,9 +69,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> |         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|             <if test="title != null">title,</if> |             <if test="title != null">title,</if> | ||||||
|             <if test="coverImg != null">cover_img,</if> |             <if test="coverImg != null">cover_img,</if> | ||||||
|  |             <if test="contentImg != null">content_img,</if> | ||||||
|             <if test="content != null">content,</if> |             <if test="content != null">content,</if> | ||||||
|             <if test="description != null">description,</if> |             <if test="description != null">description,</if> | ||||||
|             <if test="articleCat != null">article_cat,</if> |             <if test="articleCat != null">article_cat,</if> | ||||||
|  |             <if test="sort != null">sort,</if> | ||||||
|             <if test="createTime != null">create_time,</if> |             <if test="createTime != null">create_time,</if> | ||||||
|             <if test="createBy != null">create_by,</if> |             <if test="createBy != null">create_by,</if> | ||||||
|             <if test="updateTime != null">update_time,</if> |             <if test="updateTime != null">update_time,</if> | ||||||
| @ -66,9 +84,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> |         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|             <if test="title != null">#{title},</if> |             <if test="title != null">#{title},</if> | ||||||
|             <if test="coverImg != null">#{coverImg},</if> |             <if test="coverImg != null">#{coverImg},</if> | ||||||
|  |             <if test="contentImg != null">#{contentImg},</if> | ||||||
|             <if test="content != null">#{content},</if> |             <if test="content != null">#{content},</if> | ||||||
|             <if test="description != null">#{description},</if> |             <if test="description != null">#{description},</if> | ||||||
|             <if test="articleCat != null">#{articleCat},</if> |             <if test="articleCat != null">#{articleCat},</if> | ||||||
|  |             <if test="sort != null">#{sort},</if> | ||||||
|             <if test="createTime != null">#{createTime},</if> |             <if test="createTime != null">#{createTime},</if> | ||||||
|             <if test="createBy != null">#{createBy},</if> |             <if test="createBy != null">#{createBy},</if> | ||||||
|             <if test="updateTime != null">#{updateTime},</if> |             <if test="updateTime != null">#{updateTime},</if> | ||||||
| @ -83,9 +103,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|         <trim prefix="SET" suffixOverrides=","> |         <trim prefix="SET" suffixOverrides=","> | ||||||
|             <if test="title != null">title = #{title},</if> |             <if test="title != null">title = #{title},</if> | ||||||
|             <if test="coverImg != null">cover_img = #{coverImg},</if> |             <if test="coverImg != null">cover_img = #{coverImg},</if> | ||||||
|  |             <if test="contentImg != null">content_img = #{contentImg},</if> | ||||||
|             <if test="content != null">content = #{content},</if> |             <if test="content != null">content = #{content},</if> | ||||||
|             <if test="description != null">description = #{description},</if> |             <if test="description != null">description = #{description},</if> | ||||||
|             <if test="articleCat != null">article_cat = #{articleCat},</if> |             <if test="articleCat != null">article_cat = #{articleCat},</if> | ||||||
|  |             <if test="sort != null">sort = #{sort},</if> | ||||||
|             <if test="createTime != null">create_time = #{createTime},</if> |             <if test="createTime != null">create_time = #{createTime},</if> | ||||||
|             <if test="createBy != null">create_by = #{createBy},</if> |             <if test="createBy != null">create_by = #{createBy},</if> | ||||||
|             <if test="updateTime != null">update_time = #{updateTime},</if> |             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||||
| @ -97,7 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|     </update> |     </update> | ||||||
| 
 | 
 | ||||||
|     <delete id="deleteXysArticleById" parameterType="Long"> |     <delete id="deleteXysArticleById" parameterType="Long"> | ||||||
|         delete from xys_article where id = #{id} |         delete | ||||||
|  |         from xys_article | ||||||
|  |         where id = #{id} | ||||||
|     </delete> |     </delete> | ||||||
| 
 | 
 | ||||||
|     <delete id="deleteXysArticleByIds" parameterType="String"> |     <delete id="deleteXysArticleByIds" parameterType="String"> | ||||||
| @ -106,4 +130,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||||
|             #{id} |             #{id} | ||||||
|         </foreach> |         </foreach> | ||||||
|     </delete> |     </delete> | ||||||
|  | 
 | ||||||
|  |     <select id="getNext" resultMap="XysArticleResult"> | ||||||
|  |         select id,title from xys_article | ||||||
|  |         <where> | ||||||
|  |             <if test="id != null">and id > #{id}</if> | ||||||
|  |             <if test="articleCat != null ">and article_cat = #{articleCat}</if> | ||||||
|  |         </where> | ||||||
|  |         limit 1 | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
|  |     <select id="getUp" resultMap="XysArticleResult"> | ||||||
|  |         select id,title from xys_article | ||||||
|  |         <where> | ||||||
|  |             <if test="id != null">and id < #{id}</if> | ||||||
|  |             <if test="articleCat != null ">and article_cat = #{articleCat}</if> | ||||||
|  |         </where> | ||||||
|  |         ORDER BY create_time desc | ||||||
|  |         limit 1 | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
| </mapper> | </mapper> | ||||||
|  | |||||||
| @ -9,7 +9,9 @@ | |||||||
|         <result property="parentId"    column="parent_id"    /> |         <result property="parentId"    column="parent_id"    /> | ||||||
|         <result property="title"    column="title"    /> |         <result property="title"    column="title"    /> | ||||||
|         <result property="coverImg"    column="cover_img"    /> |         <result property="coverImg"    column="cover_img"    /> | ||||||
|  |         <result property="contentImg"    column="content_img"    /> | ||||||
|         <result property="description"    column="description"    /> |         <result property="description"    column="description"    /> | ||||||
|  |         <result property="sort"    column="sort"    /> | ||||||
|         <result property="createTime"    column="create_time"    /> |         <result property="createTime"    column="create_time"    /> | ||||||
|         <result property="createBy"    column="create_by"    /> |         <result property="createBy"    column="create_by"    /> | ||||||
|         <result property="updateTime"    column="update_time"    /> |         <result property="updateTime"    column="update_time"    /> | ||||||
| @ -19,7 +21,8 @@ | |||||||
|     </resultMap> |     </resultMap> | ||||||
| 
 | 
 | ||||||
|     <sql id="selectXysCategoryVo"> |     <sql id="selectXysCategoryVo"> | ||||||
|         select id, parent_id, title, cover_img, description, create_time, create_by, update_time, update_by, remark, del_flag from xys_category |         select id, parent_id, title, cover_img,content_img, description, | ||||||
|  |                sort, create_time, create_by, update_time, update_by, remark, del_flag from xys_category | ||||||
|     </sql> |     </sql> | ||||||
| 
 | 
 | ||||||
|     <select id="selectXysCategoryList" parameterType="XysCategory" resultMap="XysCategoryResult"> |     <select id="selectXysCategoryList" parameterType="XysCategory" resultMap="XysCategoryResult"> | ||||||
| @ -30,6 +33,7 @@ | |||||||
|             <if test="coverImg != null  and coverImg != ''"> and cover_img = #{coverImg}</if> |             <if test="coverImg != null  and coverImg != ''"> and cover_img = #{coverImg}</if> | ||||||
|             <if test="description != null  and description != ''"> and description = #{description}</if> |             <if test="description != null  and description != ''"> and description = #{description}</if> | ||||||
|         </where> |         </where> | ||||||
|  |         order by sort asc,create_time desc | ||||||
|     </select> |     </select> | ||||||
| 
 | 
 | ||||||
|     <select id="selectXysCategoryById" parameterType="Long" resultMap="XysCategoryResult"> |     <select id="selectXysCategoryById" parameterType="Long" resultMap="XysCategoryResult"> | ||||||
| @ -44,7 +48,9 @@ | |||||||
|             <if test="parentId != null">parent_id,</if> |             <if test="parentId != null">parent_id,</if> | ||||||
|             <if test="title != null">title,</if> |             <if test="title != null">title,</if> | ||||||
|             <if test="coverImg != null">cover_img,</if> |             <if test="coverImg != null">cover_img,</if> | ||||||
|  |             <if test="contentImg != null">content_img,</if> | ||||||
|             <if test="description != null">description,</if> |             <if test="description != null">description,</if> | ||||||
|  |             <if test="sort != null">sort,</if> | ||||||
|             <if test="createTime != null">create_time,</if> |             <if test="createTime != null">create_time,</if> | ||||||
|             <if test="createBy != null">create_by,</if> |             <if test="createBy != null">create_by,</if> | ||||||
|             <if test="updateTime != null">update_time,</if> |             <if test="updateTime != null">update_time,</if> | ||||||
| @ -57,7 +63,9 @@ | |||||||
|             <if test="parentId != null">#{parentId},</if> |             <if test="parentId != null">#{parentId},</if> | ||||||
|             <if test="title != null">#{title},</if> |             <if test="title != null">#{title},</if> | ||||||
|             <if test="coverImg != null">#{coverImg},</if> |             <if test="coverImg != null">#{coverImg},</if> | ||||||
|  |             <if test="contentImg != null">#{contentImg},</if> | ||||||
|             <if test="description != null">#{description},</if> |             <if test="description != null">#{description},</if> | ||||||
|  |             <if test="sort != null">#{sort},</if> | ||||||
|             <if test="createTime != null">#{createTime},</if> |             <if test="createTime != null">#{createTime},</if> | ||||||
|             <if test="createBy != null">#{createBy},</if> |             <if test="createBy != null">#{createBy},</if> | ||||||
|             <if test="updateTime != null">#{updateTime},</if> |             <if test="updateTime != null">#{updateTime},</if> | ||||||
| @ -73,7 +81,9 @@ | |||||||
|             <if test="parentId != null">parent_id = #{parentId},</if> |             <if test="parentId != null">parent_id = #{parentId},</if> | ||||||
|             <if test="title != null">title = #{title},</if> |             <if test="title != null">title = #{title},</if> | ||||||
|             <if test="coverImg != null">cover_img = #{coverImg},</if> |             <if test="coverImg != null">cover_img = #{coverImg},</if> | ||||||
|  |             <if test="contentImg != null">content_img = #{contentImg},</if> | ||||||
|             <if test="description != null">description = #{description},</if> |             <if test="description != null">description = #{description},</if> | ||||||
|  |             <if test="sort != null">sort = #{sort},</if> | ||||||
|             <if test="createTime != null">create_time = #{createTime},</if> |             <if test="createTime != null">create_time = #{createTime},</if> | ||||||
|             <if test="createBy != null">create_by = #{createBy},</if> |             <if test="createBy != null">create_by = #{createBy},</if> | ||||||
|             <if test="updateTime != null">update_time = #{updateTime},</if> |             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||||
| @ -94,4 +104,25 @@ | |||||||
|             #{id} |             #{id} | ||||||
|         </foreach> |         </foreach> | ||||||
|     </delete> |     </delete> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <select id="getNextCat" resultMap="XysCategoryResult"> | ||||||
|  |         select id,title from xys_category | ||||||
|  |         <where> | ||||||
|  |             <if test="id != null">and id > #{id}</if> | ||||||
|  |             <if test="parentId != null ">and parent_id = #{parentId}</if> | ||||||
|  |         </where> | ||||||
|  |         limit 1 | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
|  |     <select id="getUpCat" resultMap="XysCategoryResult"> | ||||||
|  |         select id,title from xys_category | ||||||
|  |         <where> | ||||||
|  |             <if test="id != null">and id < #{id}</if> | ||||||
|  |             <if test="parentId != null ">and parent_id = #{parentId}</if> | ||||||
|  |         </where> | ||||||
|  |         ORDER BY create_time desc | ||||||
|  |         limit 1 | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
| </mapper> | </mapper> | ||||||
|  | |||||||
| @ -9,6 +9,15 @@ export function listCategory(query) { | |||||||
|   }) |   }) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // 查询文章分类列表
 | ||||||
|  | export function catList(query) { | ||||||
|  |   return request({ | ||||||
|  |     url: '/system/category/catList', | ||||||
|  |     method: 'get', | ||||||
|  |     params: query | ||||||
|  |   }) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // 查询文章分类详细
 | // 查询文章分类详细
 | ||||||
| export function getCategory(id) { | export function getCategory(id) { | ||||||
|   return request({ |   return request({ | ||||||
|  | |||||||
| @ -182,7 +182,7 @@ export default { | |||||||
|         // 获取光标所在位置 |         // 获取光标所在位置 | ||||||
|         let length = quill.getSelection().index; |         let length = quill.getSelection().index; | ||||||
|         // 插入图片  res.url为服务器返回的图片地址 |         // 插入图片  res.url为服务器返回的图片地址 | ||||||
|         quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName); |         quill.insertEmbed(length, "image", res.url); | ||||||
|         // 调整光标到最后 |         // 调整光标到最后 | ||||||
|         quill.setSelection(length + 1); |         quill.setSelection(length + 1); | ||||||
|       } else { |       } else { | ||||||
|  | |||||||
| @ -45,12 +45,17 @@ | |||||||
|           <image-preview :src="scope.row.coverImg" :width="50" :height="50" /> |           <image-preview :src="scope.row.coverImg" :width="50" :height="50" /> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column label="内容" align="center" prop="content" /> |       <el-table-column label="内容" align="center" prop="content" show-overflow-tooltip> | ||||||
|       <el-table-column label="文章所属分类" align="center" prop="articleCat"> |  | ||||||
|         <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
|           <dict-tag :options="dict.type.article_cat" :value="scope.row.articleCat" /> |           <div>{{ scope.row.content }}</div> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|  |       <el-table-column label="文章所属分类" align="center" prop="catName"> | ||||||
|  | <!--        <template slot-scope="scope">--> | ||||||
|  | <!--          <dict-tag :options="dict.type.article_cat" :value="scope.row.articleCat" />--> | ||||||
|  | <!--        </template>--> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="sort" align="center" prop="sort" /> | ||||||
|       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||||
|         <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
|           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||||||
| @ -73,6 +78,9 @@ | |||||||
|         <el-form-item label="封面图" prop="coverImg"> |         <el-form-item label="封面图" prop="coverImg"> | ||||||
|           <image-upload v-model="form.coverImg" /> |           <image-upload v-model="form.coverImg" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|  |         <el-form-item label="内容图片" prop="contentImg"> | ||||||
|  |           <image-upload v-model="form.contentImg" /> | ||||||
|  |         </el-form-item> | ||||||
|         <el-form-item label="简介" prop="description"> |         <el-form-item label="简介" prop="description"> | ||||||
|           <el-input v-model="form.description" placeholder="请输入文章简介" /> |           <el-input v-model="form.description" placeholder="请输入文章简介" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
| @ -84,6 +92,9 @@ | |||||||
|           <el-option v-for="item in categoryList" :key="item.id" :label="item.title" :value="item.id" /> |           <el-option v-for="item in categoryList" :key="item.id" :label="item.title" :value="item.id" /> | ||||||
|         </el-select> |         </el-select> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|  |         <el-form-item label="排序" prop="sort"> | ||||||
|  |           <el-input-number v-model="form.sort" controls-position="right" :min="0" /> | ||||||
|  |         </el-form-item> | ||||||
|         <el-form-item label="备注" prop="remark"> |         <el-form-item label="备注" prop="remark"> | ||||||
|           <el-input v-model="form.remark" placeholder="请输入备注" /> |           <el-input v-model="form.remark" placeholder="请输入备注" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
| @ -98,7 +109,7 @@ | |||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import { listArticle, getArticle, delArticle, addArticle, updateArticle } from "@/api/system/article"; | import { listArticle, getArticle, delArticle, addArticle, updateArticle } from "@/api/system/article"; | ||||||
| import { listCategory } from "@/api/system/category"; | import { catList } from "@/api/system/category"; | ||||||
| export default { | export default { | ||||||
|   name: "Article", |   name: "Article", | ||||||
|   dicts: ['article_cat'], |   dicts: ['article_cat'], | ||||||
| @ -144,7 +155,7 @@ export default { | |||||||
|   methods: { |   methods: { | ||||||
|     //获取文章分类列表 |     //获取文章分类列表 | ||||||
|     getfenlei() { |     getfenlei() { | ||||||
|       listCategory().then(response => { |       catList().then(response => { | ||||||
|         this.categoryList = response.rows; |         this.categoryList = response.rows; | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
| @ -170,9 +181,11 @@ export default { | |||||||
|         id: null, |         id: null, | ||||||
|         title: null, |         title: null, | ||||||
|         coverImg: null, |         coverImg: null, | ||||||
|  |         contentImg: null, | ||||||
|         description: null, |         description: null, | ||||||
|         content: null, |         content: null, | ||||||
|         articleCat: null, |         articleCat: null, | ||||||
|  |         sort:null, | ||||||
|         createTime: null, |         createTime: null, | ||||||
|         createBy: null, |         createBy: null, | ||||||
|         updateTime: null, |         updateTime: null, | ||||||
|  | |||||||
| @ -45,7 +45,12 @@ | |||||||
|           <image-preview :src="scope.row.coverImg" :width="50" :height="50" /> |           <image-preview :src="scope.row.coverImg" :width="50" :height="50" /> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column label="简介" align="center" prop="description" /> |       <el-table-column label="简介" align="center" prop="description" show-overflow-tooltip> | ||||||
|  |         <template slot-scope="scope"> | ||||||
|  |           <div>{{ scope.row.description }}</div> | ||||||
|  |         </template> | ||||||
|  |       </el-table-column> | ||||||
|  |       <el-table-column label="排序" align="center" prop="sort" /> | ||||||
|       <el-table-column label="备注" align="center" prop="remark" /> |       <el-table-column label="备注" align="center" prop="remark" /> | ||||||
|       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||||
|         <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
| @ -74,9 +79,15 @@ | |||||||
|         <el-form-item label="封面图" prop="coverImg"> |         <el-form-item label="封面图" prop="coverImg"> | ||||||
|           <image-upload v-model="form.coverImg" /> |           <image-upload v-model="form.coverImg" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|  |         <el-form-item label="内容图" prop="contentImg"> | ||||||
|  |           <image-upload v-model="form.contentImg" /> | ||||||
|  |         </el-form-item> | ||||||
|         <el-form-item label="简介" prop="description"> |         <el-form-item label="简介" prop="description"> | ||||||
|           <el-input v-model="form.description" type="textarea" placeholder="请输入内容" /> |           <el-input v-model="form.description" type="textarea" placeholder="请输入内容" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
|  |         <el-form-item label="排序" prop="sort"> | ||||||
|  |           <el-input-number v-model="form.sort" controls-position="right" :min="0" /> | ||||||
|  |         </el-form-item> | ||||||
|         <el-form-item label="备注" prop="remark"> |         <el-form-item label="备注" prop="remark"> | ||||||
|           <el-input v-model="form.remark" placeholder="请输入备注" /> |           <el-input v-model="form.remark" placeholder="请输入备注" /> | ||||||
|         </el-form-item> |         </el-form-item> | ||||||
| @ -91,7 +102,7 @@ | |||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/system/category"; | import { listCategory, getCategory, delCategory, addCategory, updateCategory,catList } from "@/api/system/category"; | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   name: "Category", |   name: "Category", | ||||||
| @ -142,7 +153,7 @@ export default { | |||||||
|   methods: { |   methods: { | ||||||
|     //获取上级分类 |     //获取上级分类 | ||||||
|     gettop(){ |     gettop(){ | ||||||
|       listCategory().then(response => { |       catList().then(response => { | ||||||
|         this.options=response.rows |         this.options=response.rows | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
| @ -168,7 +179,9 @@ export default { | |||||||
|         parentId: null, |         parentId: null, | ||||||
|         title: null, |         title: null, | ||||||
|         coverImg: null, |         coverImg: null, | ||||||
|  |         contentImg: null, | ||||||
|         description: null, |         description: null, | ||||||
|  |         sort:null, | ||||||
|         createTime: null, |         createTime: null, | ||||||
|         createBy: null, |         createBy: null, | ||||||
|         updateTime: null, |         updateTime: null, | ||||||
| @ -248,4 +261,5 @@ export default { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
| </script> | </script> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user