123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- package com.ruoyi.system.service.impl;
- import java.util.Date;
- 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.system.mapper.PostCollectionsSystemMapper;
- import com.ruoyi.system.domain.PostCollectionsSystem;
- import com.ruoyi.system.service.IPostCollectionsSystemService;
- /**
- * 藏品套系Service业务层处理
- *
- * @author ruoyi
- * @date 2023-02-15
- */
- @Service
- public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemService
- {
- @Autowired
- private PostCollectionsSystemMapper postCollectionsSystemMapper;
- /**
- * 查询藏品套系
- *
- * @param id 藏品套系主键
- * @return 藏品套系
- */
- @Override
- public PostCollectionsSystem selectPostCollectionsSystemById(Long id)
- {
- return postCollectionsSystemMapper.selectPostCollectionsSystemById(id);
- }
- /**
- * 查询藏品套系列表
- *
- * @param postCollectionsSystem 藏品套系
- * @return 藏品套系
- */
- @Override
- public List<PostCollectionsSystem> selectPostCollectionsSystemList(PostCollectionsSystem postCollectionsSystem)
- {
- return postCollectionsSystemMapper.selectPostCollectionsSystemList(postCollectionsSystem);
- }
- /**
- * 新增藏品套系
- *
- * @param postCollectionsSystem 藏品套系
- * @return 结果
- */
- @Override
- public int insertPostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
- {
- postCollectionsSystem.setCreateTime(DateUtils.getNowDate());
- return postCollectionsSystemMapper.insertPostCollectionsSystem(postCollectionsSystem);
- }
- /**
- * 修改藏品套系
- *
- * @param postCollectionsSystem 藏品套系
- * @return 结果
- */
- @Override
- public int updatePostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
- {
- postCollectionsSystem.setUpdateTime(DateUtils.getNowDate());
- return postCollectionsSystemMapper.updatePostCollectionsSystem(postCollectionsSystem);
- }
- /**
- * 批量删除藏品套系
- *
- * @param ids 需要删除的藏品套系主键
- * @return 结果
- */
- @Override
- public int deletePostCollectionsSystemByIds(Long[] ids)
- {
- return postCollectionsSystemMapper.deletePostCollectionsSystemByIds(ids);
- }
- /**
- * 删除藏品套系信息
- *
- * @param id 藏品套系主键
- * @return 结果
- */
- @Override
- public int deletePostCollectionsSystemById(Long id)
- {
- return postCollectionsSystemMapper.deletePostCollectionsSystemById(id);
- }
- /**
- * 套系搜索功能
- * @return
- */
- @Override
- public List<PostCollectionsSystem> selectByTitleAndTime(String title, Date TimeLeft, Date TimeRight) {
- if (title != null) {
- //标题不为空则判断时间
- if (TimeLeft != null && TimeRight != null) {
- if( TimeLeft.before(TimeRight)) {
- return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
- }else {
- return null;
- }
- }else {
- //时间为空
- return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
- }
- } else {
- //标题为空
- //确保查询到的公告为已发布的公告
- if (TimeLeft != null && TimeRight != null) {
- //时间不为空 ,且左时间在右时间之前
- if( TimeLeft.before(TimeRight)) {
- return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
- }else {
- return null;
- }
- }
- }
- PostCollectionsSystem post = new PostCollectionsSystem();
- return postCollectionsSystemMapper.selectPostCollectionsSystemList(post);
- }
- }
|