123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.dgtly.system.service.impl;
- import java.util.List;
- import com.dgtly.common.annotation.DataScope;
- import com.dgtly.common.utils.StringUtils;
- import com.dgtly.common.utils.TranslateUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.dgtly.common.core.text.Convert;
- import com.dgtly.system.domain.SysNotice;
- import com.dgtly.system.mapper.SysNoticeMapper;
- import com.dgtly.system.service.ISysNoticeService;
- /**
- * 公告 服务层实现
- *
- * @author ruoyi
- * @date 2018-06-25
- */
- @Service
- public class SysNoticeServiceImpl implements ISysNoticeService
- {
- @Autowired
- private SysNoticeMapper noticeMapper;
- /**
- * 查询公告信息
- *
- * @param noticeId 公告ID
- * @return 公告信息
- */
- @Override
- public SysNotice selectNoticeById(Long noticeId)
- {
- return noticeMapper.selectNoticeById(noticeId);
- }
- /**
- * 查询公告列表
- *
- * @param notice 公告信息
- * @return 公告集合
- */
- @Override
- public List<SysNotice> selectNoticeList(SysNotice notice)
- {
- return noticeMapper.selectNoticeList(notice);
- }
- /**
- * 新增公告
- *
- * @param notice 公告信息
- * @return 结果
- */
- @Override
- public int insertNotice(SysNotice notice)
- {
- //公告标题
- String noticeTitle = notice.getNoticeTitle();
- if(StringUtils.isNotEmpty(noticeTitle)) {
- notice.setNoticeTitleEn(TranslateUtil.getEnTranslateInfo(noticeTitle));
- }
- //公告概要
- String noticeOutline = notice.getNoticeOutline();
- if (StringUtils.isNotEmpty(noticeOutline)){
- notice.setNoticeOutlineEn(TranslateUtil.getEnTranslateInfo(noticeOutline));
- }
- //公告内容
- String noticeContent = notice.getNoticeContent();
- if (StringUtils.isNotEmpty(noticeContent)){
- notice.setNoticeContentEn(TranslateUtil.getDesEnTranslateInfo(noticeContent));
- }
- //图片
- String fmzFileUrl = notice.getFmzFileUrl();
- if (StringUtils.isNotEmpty(fmzFileUrl)){
- notice.setFmzFileUrlEn(fmzFileUrl);
- }
- return noticeMapper.insertNotice(notice);
- }
- /**
- * 修改公告
- *
- * @param notice 公告信息
- * @return 结果
- */
- @Override
- public int updateNotice(SysNotice notice)
- {
- //公告标题
- String noticeTitle = notice.getNoticeTitle();
- if(StringUtils.isNotEmpty(noticeTitle)) {
- notice.setNoticeTitleEn(TranslateUtil.getEnTranslateInfo(noticeTitle));
- }
- //公告概要
- String noticeOutline = notice.getNoticeOutline();
- if (StringUtils.isNotEmpty(noticeOutline)){
- notice.setNoticeOutlineEn(TranslateUtil.getEnTranslateInfo(noticeOutline));
- }
- //公告内容
- String noticeContent = notice.getNoticeContent();
- if (StringUtils.isNotEmpty(noticeContent)){
- notice.setNoticeContentEn(TranslateUtil.getDesEnTranslateInfo(noticeContent));
- }
- //图片
- String fmzFileUrl = notice.getFmzFileUrl();
- if (StringUtils.isNotEmpty(fmzFileUrl)){
- notice.setFmzFileUrlEn(fmzFileUrl);
- }
- return noticeMapper.updateNotice(notice);
- }
- /**
- * 删除公告对象
- *
- * @param ids 需要删除的数据ID
- * @return 结果
- */
- @Override
- public int deleteNoticeByIds(String ids)
- {
- return noticeMapper.deleteNoticeByIds(Convert.toStrArray(ids));
- }
- /**
- * 根据数据权限查询列表
- * @param notice
- * @return
- */
- @DataScope(deptAlias = "sd",userAlias = "su")
- @Override
- public List<SysNotice> selectNoticeListByRole(SysNotice notice) {
- return noticeMapper.selectNoticeListByRole(notice);
- }
- /**
- * @descption: 根据类型查询内容列表前三个
- * @param: 类型
- * @return: 内容列表三个
- * @auther: LiuLingChao
- * @date: 2019-11-04 11:40
- */
- @DataScope(deptAlias = "sd",userAlias = "su")
- @Override
- public List<SysNotice> selectNoticeTop3ByRole(SysNotice notice) {
- return noticeMapper.selectNoticeTop3ByRole(notice);
- }
- }
|