From 86502003457005ba1cfe903a63057c18361f8516 Mon Sep 17 00:00:00 2001 From: sk1551 <15175617877@163.com> Date: Fri, 25 Dec 2020 15:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E9=97=BB=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/api/benyi/news.js | 53 ++ ruoyi-ui/src/views/benyi/news/index.vue | 467 +++++++++++++++++ .../src/views/benyi/newsapproval/index.vue | 469 ++++++++++++++++++ .../controller/BySchoolNewsController.java | 116 +++++ .../project/benyi/domain/BySchoolNews.java | 239 +++++++++ .../benyi/mapper/BySchoolNewsMapper.java | 61 +++ .../benyi/service/IBySchoolNewsService.java | 61 +++ .../service/impl/BySchoolNewsServiceImpl.java | 95 ++++ .../system/controller/SysDeptController.java | 2 +- .../mybatis/benyi/BySchoolNewsMapper.xml | 116 +++++ 10 files changed, 1678 insertions(+), 1 deletion(-) create mode 100644 ruoyi-ui/src/api/benyi/news.js create mode 100644 ruoyi-ui/src/views/benyi/news/index.vue create mode 100644 ruoyi-ui/src/views/benyi/newsapproval/index.vue create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolNewsController.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolNews.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolNewsMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolNewsService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolNewsServiceImpl.java create mode 100644 ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml diff --git a/ruoyi-ui/src/api/benyi/news.js b/ruoyi-ui/src/api/benyi/news.js new file mode 100644 index 000000000..8d8f57798 --- /dev/null +++ b/ruoyi-ui/src/api/benyi/news.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询新闻中心列表 +export function listNews(query) { + return request({ + url: '/benyi/news/list', + method: 'get', + params: query + }) +} + +// 查询新闻中心详细 +export function getNews(id) { + return request({ + url: '/benyi/news/' + id, + method: 'get' + }) +} + +// 新增新闻中心 +export function addNews(data) { + return request({ + url: '/benyi/news', + method: 'post', + data: data + }) +} + +// 修改新闻中心 +export function updateNews(data) { + return request({ + url: '/benyi/news', + method: 'put', + data: data + }) +} + +// 删除新闻中心 +export function delNews(id) { + return request({ + url: '/benyi/news/' + id, + method: 'delete' + }) +} + +// 导出新闻中心 +export function exportNews(query) { + return request({ + url: '/benyi/news/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/benyi/news/index.vue b/ruoyi-ui/src/views/benyi/news/index.vue new file mode 100644 index 000000000..3d1c711f2 --- /dev/null +++ b/ruoyi-ui/src/views/benyi/news/index.vue @@ -0,0 +1,467 @@ + + + + diff --git a/ruoyi-ui/src/views/benyi/newsapproval/index.vue b/ruoyi-ui/src/views/benyi/newsapproval/index.vue new file mode 100644 index 000000000..8a4ea1f65 --- /dev/null +++ b/ruoyi-ui/src/views/benyi/newsapproval/index.vue @@ -0,0 +1,469 @@ + + + + + diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolNewsController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolNewsController.java new file mode 100644 index 000000000..45a13be71 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolNewsController.java @@ -0,0 +1,116 @@ +package com.ruoyi.project.benyi.controller; + +import java.util.Date; +import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.project.common.SchoolCommon; +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.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.project.benyi.domain.BySchoolNews; +import com.ruoyi.project.benyi.service.IBySchoolNewsService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.page.TableDataInfo; + +/** + * 新闻中心Controller + * + * @author tsbz + * @date 2020-12-25 + */ +@RestController +@RequestMapping("/benyi/news") +public class BySchoolNewsController extends BaseController +{ + @Autowired + private IBySchoolNewsService bySchoolNewsService; + @Autowired + private SchoolCommon schoolCommon; + +/** + * 查询新闻中心列表 + */ +@PreAuthorize("@ss.hasPermi('benyi:news:list')") +@GetMapping("/list") + public TableDataInfo list(BySchoolNews bySchoolNews) + { + bySchoolNews.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId()); + startPage(); + List list = bySchoolNewsService.selectBySchoolNewsList(bySchoolNews); + return getDataTable(list); + } + + /** + * 导出新闻中心列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:news:export')") + @Log(title = "新闻中心", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(BySchoolNews bySchoolNews) + { + List list = bySchoolNewsService.selectBySchoolNewsList(bySchoolNews); + ExcelUtil util = new ExcelUtil(BySchoolNews.class); + return util.exportExcel(list, "news"); + } + + /** + * 获取新闻中心详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:news:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(bySchoolNewsService.selectBySchoolNewsById(id)); + } + + /** + * 新增新闻中心 + */ + @PreAuthorize("@ss.hasPermi('benyi:news:add')") + @Log(title = "新闻中心", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BySchoolNews bySchoolNews) + { + bySchoolNews.setIsdel("N"); + bySchoolNews.setCreateTime(new Date()); + bySchoolNews.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); + bySchoolNews.setIscheck("N"); + bySchoolNews.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId()); + bySchoolNews.setType("1"); + return toAjax(bySchoolNewsService.insertBySchoolNews(bySchoolNews)); + } + + /** + * 修改新闻中心 + */ + @PreAuthorize("@ss.hasPermi('benyi:news:edit')") + @Log(title = "新闻中心", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BySchoolNews bySchoolNews) + { + return toAjax(bySchoolNewsService.updateBySchoolNews(bySchoolNews)); + } + + /** + * 删除新闻中心 + */ + @PreAuthorize("@ss.hasPermi('benyi:news:remove')") + @Log(title = "新闻中心", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(bySchoolNewsService.deleteBySchoolNewsByIds(ids)); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolNews.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolNews.java new file mode 100644 index 000000000..ecb70cd7b --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/BySchoolNews.java @@ -0,0 +1,239 @@ +package com.ruoyi.project.benyi.domain; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.framework.aspectj.lang.annotation.Excel; +import com.ruoyi.framework.web.domain.BaseEntity; + +/** + * 新闻中心对象 by_school_news + * + * @author tsbz + * @date 2020-12-25 + */ +public class BySchoolNews extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + private Long id; + + /** + * 标题 + */ + @Excel(name = "标题") + private String title; + + /** + * 封面图片 + */ + @Excel(name = "封面图片") + private String imgurl; + + /** + * 摘要 + */ + @Excel(name = "摘要") + private String abstractcontent; + + /** + * 类型 + */ + @Excel(name = "类型") + private String type; + + /** + * 内容 + */ + @Excel(name = "内容") + private String content; + + /** + * 是否删除 + */ + @Excel(name = "是否删除") + private String isdel; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private Long createuserid; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createTime; + + /** + * 所属学校 + */ + @Excel(name = "所属学校") + private Long deptId; + + /** + * 是否置顶 + */ + @Excel(name = "是否置顶") + private String istop; + + /** + * 是否审核 + */ + @Excel(name = "是否审核") + private String ischeck; + + /** + * 审核人 + */ + @Excel(name = "审核人") + private Long checkuserid; + + /** + * 审核时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date checkTime; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitle() { + return title; + } + + public void setImgurl(String imgurl) { + this.imgurl = imgurl; + } + + public String getImgurl() { + return imgurl; + } + + public void setAbstractcontent(String abstractcontent) { + this.abstractcontent = abstractcontent; + } + + public String getAbstractcontent() { + return abstractcontent; + } + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + public void setContent(String content) { + this.content = content; + } + + public String getContent() { + return content; + } + + public void setIsdel(String isdel) { + this.isdel = isdel; + } + + public String getIsdel() { + return isdel; + } + + public void setCreateuserid(Long createuserid) { + this.createuserid = createuserid; + } + + public Long getCreateuserid() { + return createuserid; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public Long getDeptId() { + return deptId; + } + + public void setIstop(String istop) { + this.istop = istop; + } + + public String getIstop() { + return istop; + } + + public void setIscheck(String ischeck) { + this.ischeck = ischeck; + } + + public String getIscheck() { + return ischeck; + } + + public void setCheckuserid(Long checkuserid) { + this.checkuserid = checkuserid; + } + + public Long getCheckuserid() { + return checkuserid; + } + + public void setCheckTime(Date checkTime) { + this.checkTime = checkTime; + } + + public Date getCheckTime() { + return checkTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("title", getTitle()) + .append("imgurl", getImgurl()) + .append("abstractcontent", getAbstractcontent()) + .append("type", getType()) + .append("content", getContent()) + .append("isdel", getIsdel()) + .append("createuserid", getCreateuserid()) + .append("createTime", getCreateTime()) + .append("deptId", getDeptId()) + .append("istop", getIstop()) + .append("ischeck", getIscheck()) + .append("checkuserid", getCheckuserid()) + .append("checkTime", getCheckTime()) + .toString(); + } + + + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolNewsMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolNewsMapper.java new file mode 100644 index 000000000..3d01d5f59 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/BySchoolNewsMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; +import com.ruoyi.project.benyi.domain.BySchoolNews; + +/** + * 新闻中心Mapper接口 + * + * @author tsbz + * @date 2020-12-25 + */ +public interface BySchoolNewsMapper +{ + /** + * 查询新闻中心 + * + * @param id 新闻中心ID + * @return 新闻中心 + */ + public BySchoolNews selectBySchoolNewsById(Long id); + + /** + * 查询新闻中心列表 + * + * @param bySchoolNews 新闻中心 + * @return 新闻中心集合 + */ + public List selectBySchoolNewsList(BySchoolNews bySchoolNews); + + /** + * 新增新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + public int insertBySchoolNews(BySchoolNews bySchoolNews); + + /** + * 修改新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + public int updateBySchoolNews(BySchoolNews bySchoolNews); + + /** + * 删除新闻中心 + * + * @param id 新闻中心ID + * @return 结果 + */ + public int deleteBySchoolNewsById(Long id); + + /** + * 批量删除新闻中心 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteBySchoolNewsByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolNewsService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolNewsService.java new file mode 100644 index 000000000..70679c42d --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IBySchoolNewsService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; +import com.ruoyi.project.benyi.domain.BySchoolNews; + +/** + * 新闻中心Service接口 + * + * @author tsbz + * @date 2020-12-25 + */ +public interface IBySchoolNewsService +{ + /** + * 查询新闻中心 + * + * @param id 新闻中心ID + * @return 新闻中心 + */ + public BySchoolNews selectBySchoolNewsById(Long id); + + /** + * 查询新闻中心列表 + * + * @param bySchoolNews 新闻中心 + * @return 新闻中心集合 + */ + public List selectBySchoolNewsList(BySchoolNews bySchoolNews); + + /** + * 新增新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + public int insertBySchoolNews(BySchoolNews bySchoolNews); + + /** + * 修改新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + public int updateBySchoolNews(BySchoolNews bySchoolNews); + + /** + * 批量删除新闻中心 + * + * @param ids 需要删除的新闻中心ID + * @return 结果 + */ + public int deleteBySchoolNewsByIds(Long[] ids); + + /** + * 删除新闻中心信息 + * + * @param id 新闻中心ID + * @return 结果 + */ + public int deleteBySchoolNewsById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolNewsServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolNewsServiceImpl.java new file mode 100644 index 000000000..5ebe64907 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/BySchoolNewsServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.project.benyi.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.project.benyi.mapper.BySchoolNewsMapper; +import com.ruoyi.project.benyi.domain.BySchoolNews; +import com.ruoyi.project.benyi.service.IBySchoolNewsService; + +/** + * 新闻中心Service业务层处理 + * + * @author tsbz + * @date 2020-12-25 + */ +@Service +public class BySchoolNewsServiceImpl implements IBySchoolNewsService +{ + @Autowired + private BySchoolNewsMapper bySchoolNewsMapper; + + /** + * 查询新闻中心 + * + * @param id 新闻中心ID + * @return 新闻中心 + */ + @Override + public BySchoolNews selectBySchoolNewsById(Long id) + { + return bySchoolNewsMapper.selectBySchoolNewsById(id); + } + + /** + * 查询新闻中心列表 + * + * @param bySchoolNews 新闻中心 + * @return 新闻中心 + */ + @Override + public List selectBySchoolNewsList(BySchoolNews bySchoolNews) + { + return bySchoolNewsMapper.selectBySchoolNewsList(bySchoolNews); + } + + /** + * 新增新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + @Override + public int insertBySchoolNews(BySchoolNews bySchoolNews) + { + bySchoolNews.setCreateTime(DateUtils.getNowDate()); + return bySchoolNewsMapper.insertBySchoolNews(bySchoolNews); + } + + /** + * 修改新闻中心 + * + * @param bySchoolNews 新闻中心 + * @return 结果 + */ + @Override + public int updateBySchoolNews(BySchoolNews bySchoolNews) + { + return bySchoolNewsMapper.updateBySchoolNews(bySchoolNews); + } + + /** + * 批量删除新闻中心 + * + * @param ids 需要删除的新闻中心ID + * @return 结果 + */ + @Override + public int deleteBySchoolNewsByIds(Long[] ids) + { + return bySchoolNewsMapper.deleteBySchoolNewsByIds(ids); + } + + /** + * 删除新闻中心信息 + * + * @param id 新闻中心ID + * @return 结果 + */ + @Override + public int deleteBySchoolNewsById(Long id) + { + return bySchoolNewsMapper.deleteBySchoolNewsById(id); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java index 562e073b3..0c0b1d254 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDeptController.java @@ -46,7 +46,7 @@ public class SysDeptController extends BaseController { /** * 获取部门列表 */ - @PreAuthorize("@ss.hasPermi('system:dept:list')") + @PreAuthorize("@ss.hasPermi('system:dept:list')" + "||@ss.hasPermi('benyi:news:list')") @GetMapping("/list") public AjaxResult list(SysDept dept) { List depts = deptService.selectDeptList(dept); diff --git a/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml new file mode 100644 index 000000000..f518fc995 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + select id, title, imgurl, abstractcontent, type, content, isdel, createuserid, create_time, dept_id, istop, ischeck, checkuserid, check_time from by_school_news + + + + + + + + insert into by_school_news + + title, + imgurl, + abstractcontent, + type, + content, + isdel, + createuserid, + create_time, + dept_id, + istop, + ischeck, + checkuserid, + check_time, + + + #{title}, + #{imgurl}, + #{abstractcontent}, + #{type}, + #{content}, + #{isdel}, + #{createuserid}, + #{createTime}, + #{deptId}, + #{istop}, + #{ischeck}, + #{checkuserid}, + #{checkTime}, + + + + + update by_school_news + + title = #{title}, + imgurl = #{imgurl}, + abstractcontent = #{abstractcontent}, + type = #{type}, + content = #{content}, + isdel = #{isdel}, + createuserid = #{createuserid}, + create_time = #{createTime}, + dept_id = #{deptId}, + istop = #{istop}, + ischeck = #{ischeck}, + checkuserid = #{checkuserid}, + check_time = #{checkTime}, + + where id = #{id} + + + + delete from by_school_news where id = #{id} + + + + delete from by_school_news where id in + + #{id} + + + + \ No newline at end of file