|
@@ -1,94 +1,64 @@
|
|
|
package com.tianhu.system.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.tianhu.system.domain.SysNotice;
|
|
|
import com.tianhu.system.mapper.SysNoticeMapper;
|
|
|
import com.tianhu.system.service.ISysNoticeService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 公告 服务层实现
|
|
|
- *
|
|
|
- * @author tianhu
|
|
|
+ * ClassName: SysNoticeServiceImpl<br>
|
|
|
+ * Description: ISysNoticeService实现 <br>
|
|
|
+ * Company: keao
|
|
|
+ *
|
|
|
+ * @author cuixq
|
|
|
+ * @version v1.0.0 2021-09-14 cuixq 由Generator自动创建
|
|
|
*/
|
|
|
@Service
|
|
|
-public class SysNoticeServiceImpl implements ISysNoticeService
|
|
|
-{
|
|
|
- @Autowired
|
|
|
- private SysNoticeMapper noticeMapper;
|
|
|
+@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
|
|
+public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {
|
|
|
|
|
|
- /**
|
|
|
- * 查询公告信息
|
|
|
- *
|
|
|
- * @param noticeId 公告ID
|
|
|
- * @return 公告信息
|
|
|
- */
|
|
|
- @Override
|
|
|
- public SysNotice selectNoticeById(String noticeId)
|
|
|
- {
|
|
|
- return noticeMapper.selectNoticeById(noticeId);
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ private SysNoticeMapper sysNoticeMapper;
|
|
|
|
|
|
- /**
|
|
|
- * 查询公告列表
|
|
|
- *
|
|
|
- * @param notice 公告信息
|
|
|
- * @return 公告集合
|
|
|
- */
|
|
|
@Override
|
|
|
- public List<SysNotice> selectNoticeList(SysNotice notice)
|
|
|
- {
|
|
|
- return noticeMapper.selectNoticeList(notice);
|
|
|
+ public IPage<SysNotice> findSysNotices(QueryRequest request, LambdaQueryWrapper<SysNotice> wrapper) {
|
|
|
+ Page<SysNotice> page = new Page<>(request.getPageNum(), request.getPageSize());
|
|
|
+ return this.page(page, wrapper);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 新增公告
|
|
|
- *
|
|
|
- * @param notice 公告信息
|
|
|
- * @return 结果
|
|
|
- */
|
|
|
@Override
|
|
|
- public int insertNotice(SysNotice notice)
|
|
|
- {
|
|
|
- return noticeMapper.insertNotice(notice);
|
|
|
+ public List<SysNotice> findSysNotices(LambdaQueryWrapper<SysNotice> wrapper) {
|
|
|
+ return this.list(wrapper);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改公告
|
|
|
- *
|
|
|
- * @param notice 公告信息
|
|
|
- * @return 结果
|
|
|
- */
|
|
|
@Override
|
|
|
- public int updateNotice(SysNotice notice)
|
|
|
- {
|
|
|
- return noticeMapper.updateNotice(notice);
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void createSysNotice(SysNotice sysNotice) {
|
|
|
+ this.save(sysNotice);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 删除公告对象
|
|
|
- *
|
|
|
- * @param noticeId 公告ID
|
|
|
- * @return 结果
|
|
|
- */
|
|
|
@Override
|
|
|
- public int deleteNoticeById(String noticeId)
|
|
|
- {
|
|
|
- return noticeMapper.deleteNoticeById(noticeId);
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateSysNotice(SysNotice sysNotice) {
|
|
|
+ this.saveOrUpdate(sysNotice);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 批量删除公告信息
|
|
|
- *
|
|
|
- * @param noticeIds 需要删除的公告ID
|
|
|
- * @return 结果
|
|
|
- */
|
|
|
@Override
|
|
|
- public int deleteNoticeByIds(String[] noticeIds)
|
|
|
- {
|
|
|
- return noticeMapper.deleteNoticeByIds(noticeIds);
|
|
|
- }
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void deleteSysNotice(LambdaQueryWrapper<SysNotice> wrapper) {
|
|
|
+ this.remove(wrapper);
|
|
|
+ }
|
|
|
}
|