mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-19 01:15:54 +08:00
后端新增新闻模块
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.iot.domain.NewsCategory;
|
||||
import com.ruoyi.iot.service.INewsCategoryService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 新闻分类Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
@Api(tags = "新闻分类")
|
||||
@RestController
|
||||
@RequestMapping("/iot/newsCategory")
|
||||
public class NewsCategoryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private INewsCategoryService newsCategoryService;
|
||||
|
||||
/**
|
||||
* 查询新闻分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("新闻分类分页列表")
|
||||
public TableDataInfo list(NewsCategory newsCategory)
|
||||
{
|
||||
startPage();
|
||||
List<NewsCategory> list = newsCategoryService.selectNewsCategoryList(newsCategory);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新闻分类简短列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:list')")
|
||||
@GetMapping("/newsCategoryShortList")
|
||||
@ApiOperation("分类简短列表")
|
||||
public AjaxResult newsCategoryShortList()
|
||||
{
|
||||
List<IdAndName> list = newsCategoryService.selectNewsCategoryShortList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出新闻分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:export')")
|
||||
@Log(title = "新闻分类", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, NewsCategory newsCategory)
|
||||
{
|
||||
List<NewsCategory> list = newsCategoryService.selectNewsCategoryList(newsCategory);
|
||||
ExcelUtil<NewsCategory> util = new ExcelUtil<NewsCategory>(NewsCategory.class);
|
||||
util.exportExcel(response, list, "新闻分类数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新闻分类详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:query')")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
@ApiOperation("新闻分类详情")
|
||||
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
|
||||
{
|
||||
return AjaxResult.success(newsCategoryService.selectNewsCategoryByCategoryId(categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增新闻分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:add')")
|
||||
@Log(title = "新闻分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加新闻分类")
|
||||
public AjaxResult add(@RequestBody NewsCategory newsCategory)
|
||||
{
|
||||
return toAjax(newsCategoryService.insertNewsCategory(newsCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改新闻分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:edit')")
|
||||
@Log(title = "新闻分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改新闻分类")
|
||||
public AjaxResult edit(@RequestBody NewsCategory newsCategory)
|
||||
{
|
||||
return toAjax(newsCategoryService.updateNewsCategory(newsCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除新闻分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:newsCategory:remove')")
|
||||
@Log(title = "新闻分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{categoryIds}")
|
||||
@ApiOperation("删除新闻分类")
|
||||
public AjaxResult remove(@PathVariable Long[] categoryIds)
|
||||
{
|
||||
return toAjax(newsCategoryService.deleteNewsCategoryByCategoryIds(categoryIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.iot.domain.News;
|
||||
import com.ruoyi.iot.service.INewsService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 新闻资讯Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
@Api(tags = "新闻资讯")
|
||||
@RestController
|
||||
@RequestMapping("/iot/news")
|
||||
public class NewsController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private INewsService newsService;
|
||||
|
||||
/**
|
||||
* 查询新闻资讯列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("新闻分页列表")
|
||||
public TableDataInfo list(News news)
|
||||
{
|
||||
startPage();
|
||||
List<News> list = newsService.selectNewsList(news);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出新闻资讯列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:export')")
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, News news)
|
||||
{
|
||||
List<News> list = newsService.selectNewsList(news);
|
||||
ExcelUtil<News> util = new ExcelUtil<News>(News.class);
|
||||
util.exportExcel(response, list, "新闻资讯数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新闻资讯详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:query')")
|
||||
@GetMapping(value = "/{newsId}")
|
||||
@ApiOperation("新闻详情")
|
||||
public AjaxResult getInfo(@PathVariable("newsId") Long newsId)
|
||||
{
|
||||
return AjaxResult.success(newsService.selectNewsByNewsId(newsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增新闻资讯
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:add')")
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加新闻资讯")
|
||||
public AjaxResult add(@RequestBody News news)
|
||||
{
|
||||
return toAjax(newsService.insertNews(news));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改新闻资讯
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:edit')")
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改新闻资讯")
|
||||
public AjaxResult edit(@RequestBody News news)
|
||||
{
|
||||
return toAjax(newsService.updateNews(news));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除新闻资讯
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:news:remove')")
|
||||
@Log(title = "新闻资讯", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{newsIds}")
|
||||
@ApiOperation("删除新闻资讯")
|
||||
public AjaxResult remove(@PathVariable Long[] newsIds)
|
||||
{
|
||||
return toAjax(newsService.deleteNewsByNewsIds(newsIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 新闻资讯对象 news
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public class News extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 新闻ID */
|
||||
private Long newsId;
|
||||
|
||||
/** 标题 */
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/** 内容 */
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
private String imgUrl;
|
||||
|
||||
/** 置顶 */
|
||||
@Excel(name = "置顶")
|
||||
private Integer isTop;
|
||||
|
||||
/** 广告 */
|
||||
@Excel(name = "广告")
|
||||
private Integer isBanner;
|
||||
|
||||
/** 分类ID */
|
||||
@Excel(name = "分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
/** 分类名称 */
|
||||
@Excel(name = "分类名称")
|
||||
private String categoryName;
|
||||
|
||||
/** 发布 */
|
||||
@Excel(name = "发布")
|
||||
private Integer status;
|
||||
|
||||
/** 作者 */
|
||||
@Excel(name = "作者")
|
||||
private String author;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setNewsId(Long newsId)
|
||||
{
|
||||
this.newsId = newsId;
|
||||
}
|
||||
|
||||
public Long getNewsId()
|
||||
{
|
||||
return newsId;
|
||||
}
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
public void setImgUrl(String imgUrl)
|
||||
{
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public String getImgUrl()
|
||||
{
|
||||
return imgUrl;
|
||||
}
|
||||
public void setIsTop(Integer isTop)
|
||||
{
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsTop()
|
||||
{
|
||||
return isTop;
|
||||
}
|
||||
public void setIsBanner(Integer isBanner)
|
||||
{
|
||||
this.isBanner = isBanner;
|
||||
}
|
||||
|
||||
public Integer getIsBanner()
|
||||
{
|
||||
return isBanner;
|
||||
}
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setAuthor(String author)
|
||||
{
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getAuthor()
|
||||
{
|
||||
return author;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("newsId", getNewsId())
|
||||
.append("title", getTitle())
|
||||
.append("content", getContent())
|
||||
.append("imgUrl", getImgUrl())
|
||||
.append("isTop", getIsTop())
|
||||
.append("isBanner", getIsBanner())
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("status", getStatus())
|
||||
.append("author", getAuthor())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 新闻分类对象 news_category
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public class NewsCategory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 分类ID */
|
||||
@Excel(name = "分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
/** 分类名字 */
|
||||
@Excel(name = "分类名字")
|
||||
private String categoryName;
|
||||
|
||||
/** 显示顺序 */
|
||||
@Excel(name = "显示顺序")
|
||||
private Integer orderNum;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.NewsCategory;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
|
||||
/**
|
||||
* 新闻分类Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public interface NewsCategoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询新闻分类
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 新闻分类
|
||||
*/
|
||||
public NewsCategory selectNewsCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 查询新闻分类列表
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 新闻分类集合
|
||||
*/
|
||||
public List<NewsCategory> selectNewsCategoryList(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 查询新闻分类简短列表
|
||||
*
|
||||
* @return 新闻分类集合
|
||||
*/
|
||||
public List<IdAndName> selectNewsCategoryShortList();
|
||||
|
||||
/**
|
||||
* 新增新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNewsCategory(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 修改新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNewsCategory(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 删除新闻分类
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 批量删除新闻分类
|
||||
*
|
||||
* @param categoryIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsCategoryByCategoryIds(Long[] categoryIds);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.News;
|
||||
|
||||
/**
|
||||
* 新闻资讯Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public interface NewsMapper
|
||||
{
|
||||
/**
|
||||
* 查询新闻资讯
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 新闻资讯
|
||||
*/
|
||||
public News selectNewsByNewsId(Long newsId);
|
||||
|
||||
/**
|
||||
* 查询新闻资讯列表
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 新闻资讯集合
|
||||
*/
|
||||
public List<News> selectNewsList(News news);
|
||||
|
||||
/**
|
||||
* 新增新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNews(News news);
|
||||
|
||||
/**
|
||||
* 修改新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNews(News news);
|
||||
|
||||
/**
|
||||
* 删除新闻资讯
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsByNewsId(Long newsId);
|
||||
|
||||
/**
|
||||
* 批量删除新闻资讯
|
||||
*
|
||||
* @param newsIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsByNewsIds(Long[] newsIds);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.NewsCategory;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
|
||||
/**
|
||||
* 新闻分类Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public interface INewsCategoryService
|
||||
{
|
||||
/**
|
||||
* 查询新闻分类
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 新闻分类
|
||||
*/
|
||||
public NewsCategory selectNewsCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 查询新闻分类列表
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 新闻分类集合
|
||||
*/
|
||||
public List<NewsCategory> selectNewsCategoryList(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 查询新闻分类简短列表
|
||||
*
|
||||
* @return 新闻分类集合
|
||||
*/
|
||||
public List<IdAndName> selectNewsCategoryShortList();
|
||||
|
||||
/**
|
||||
* 新增新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNewsCategory(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 修改新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNewsCategory(NewsCategory newsCategory);
|
||||
|
||||
/**
|
||||
* 批量删除新闻分类
|
||||
*
|
||||
* @param categoryIds 需要删除的新闻分类主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsCategoryByCategoryIds(Long[] categoryIds);
|
||||
|
||||
/**
|
||||
* 删除新闻分类信息
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsCategoryByCategoryId(Long categoryId);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.News;
|
||||
|
||||
/**
|
||||
* 新闻资讯Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
public interface INewsService
|
||||
{
|
||||
/**
|
||||
* 查询新闻资讯
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 新闻资讯
|
||||
*/
|
||||
public News selectNewsByNewsId(Long newsId);
|
||||
|
||||
/**
|
||||
* 查询新闻资讯列表
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 新闻资讯集合
|
||||
*/
|
||||
public List<News> selectNewsList(News news);
|
||||
|
||||
/**
|
||||
* 新增新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNews(News news);
|
||||
|
||||
/**
|
||||
* 修改新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNews(News news);
|
||||
|
||||
/**
|
||||
* 批量删除新闻资讯
|
||||
*
|
||||
* @param newsIds 需要删除的新闻资讯主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsByNewsIds(Long[] newsIds);
|
||||
|
||||
/**
|
||||
* 删除新闻资讯信息
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNewsByNewsId(Long newsId);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.iot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.iot.mapper.NewsCategoryMapper;
|
||||
import com.ruoyi.iot.domain.NewsCategory;
|
||||
import com.ruoyi.iot.service.INewsCategoryService;
|
||||
|
||||
/**
|
||||
* 新闻分类Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
@Service
|
||||
public class NewsCategoryServiceImpl implements INewsCategoryService
|
||||
{
|
||||
@Autowired
|
||||
private NewsCategoryMapper newsCategoryMapper;
|
||||
|
||||
/**
|
||||
* 查询新闻分类
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 新闻分类
|
||||
*/
|
||||
@Override
|
||||
public NewsCategory selectNewsCategoryByCategoryId(Long categoryId)
|
||||
{
|
||||
return newsCategoryMapper.selectNewsCategoryByCategoryId(categoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新闻分类列表
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 新闻分类
|
||||
*/
|
||||
@Override
|
||||
public List<NewsCategory> selectNewsCategoryList(NewsCategory newsCategory)
|
||||
{
|
||||
return newsCategoryMapper.selectNewsCategoryList(newsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新闻分类简短列表
|
||||
*
|
||||
* @return 新闻分类
|
||||
*/
|
||||
@Override
|
||||
public List<IdAndName> selectNewsCategoryShortList()
|
||||
{
|
||||
return newsCategoryMapper.selectNewsCategoryShortList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNewsCategory(NewsCategory newsCategory)
|
||||
{
|
||||
newsCategory.setCreateTime(DateUtils.getNowDate());
|
||||
return newsCategoryMapper.insertNewsCategory(newsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改新闻分类
|
||||
*
|
||||
* @param newsCategory 新闻分类
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNewsCategory(NewsCategory newsCategory)
|
||||
{
|
||||
newsCategory.setUpdateTime(DateUtils.getNowDate());
|
||||
return newsCategoryMapper.updateNewsCategory(newsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除新闻分类
|
||||
*
|
||||
* @param categoryIds 需要删除的新闻分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNewsCategoryByCategoryIds(Long[] categoryIds)
|
||||
{
|
||||
return newsCategoryMapper.deleteNewsCategoryByCategoryIds(categoryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除新闻分类信息
|
||||
*
|
||||
* @param categoryId 新闻分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNewsCategoryByCategoryId(Long categoryId)
|
||||
{
|
||||
return newsCategoryMapper.deleteNewsCategoryByCategoryId(categoryId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.iot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.iot.mapper.NewsMapper;
|
||||
import com.ruoyi.iot.domain.News;
|
||||
import com.ruoyi.iot.service.INewsService;
|
||||
|
||||
/**
|
||||
* 新闻资讯Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-04-09
|
||||
*/
|
||||
@Service
|
||||
public class NewsServiceImpl implements INewsService
|
||||
{
|
||||
@Autowired
|
||||
private NewsMapper newsMapper;
|
||||
|
||||
/**
|
||||
* 查询新闻资讯
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 新闻资讯
|
||||
*/
|
||||
@Override
|
||||
public News selectNewsByNewsId(Long newsId)
|
||||
{
|
||||
return newsMapper.selectNewsByNewsId(newsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新闻资讯列表
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 新闻资讯
|
||||
*/
|
||||
@Override
|
||||
public List<News> selectNewsList(News news)
|
||||
{
|
||||
return newsMapper.selectNewsList(news);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNews(News news)
|
||||
{
|
||||
news.setCreateTime(DateUtils.getNowDate());
|
||||
return newsMapper.insertNews(news);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改新闻资讯
|
||||
*
|
||||
* @param news 新闻资讯
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNews(News news)
|
||||
{
|
||||
news.setUpdateTime(DateUtils.getNowDate());
|
||||
return newsMapper.updateNews(news);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除新闻资讯
|
||||
*
|
||||
* @param newsIds 需要删除的新闻资讯主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNewsByNewsIds(Long[] newsIds)
|
||||
{
|
||||
return newsMapper.deleteNewsByNewsIds(newsIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除新闻资讯信息
|
||||
*
|
||||
* @param newsId 新闻资讯主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNewsByNewsId(Long newsId)
|
||||
{
|
||||
return newsMapper.deleteNewsByNewsId(newsId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user