PostCollectionsSystemServiceImpl.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package com.ruoyi.system.service.impl;
  2. import java.util.Date;
  3. import java.util.List;
  4. import com.ruoyi.common.utils.DateUtils;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7. import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
  8. import com.ruoyi.system.domain.PostCollectionsSystem;
  9. import com.ruoyi.system.service.IPostCollectionsSystemService;
  10. /**
  11. * 藏品套系Service业务层处理
  12. *
  13. * @author ruoyi
  14. * @date 2023-02-15
  15. */
  16. @Service
  17. public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemService
  18. {
  19. @Autowired
  20. private PostCollectionsSystemMapper postCollectionsSystemMapper;
  21. /**
  22. * 查询藏品套系
  23. *
  24. * @param id 藏品套系主键
  25. * @return 藏品套系
  26. */
  27. @Override
  28. public PostCollectionsSystem selectPostCollectionsSystemById(Long id)
  29. {
  30. return postCollectionsSystemMapper.selectPostCollectionsSystemById(id);
  31. }
  32. /**
  33. * 查询藏品套系列表
  34. *
  35. * @param postCollectionsSystem 藏品套系
  36. * @return 藏品套系
  37. */
  38. @Override
  39. public List<PostCollectionsSystem> selectPostCollectionsSystemList(PostCollectionsSystem postCollectionsSystem)
  40. {
  41. return postCollectionsSystemMapper.selectPostCollectionsSystemList(postCollectionsSystem);
  42. }
  43. /**
  44. * 新增藏品套系
  45. *
  46. * @param postCollectionsSystem 藏品套系
  47. * @return 结果
  48. */
  49. @Override
  50. public int insertPostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
  51. {
  52. postCollectionsSystem.setCreateTime(DateUtils.getNowDate());
  53. return postCollectionsSystemMapper.insertPostCollectionsSystem(postCollectionsSystem);
  54. }
  55. /**
  56. * 修改藏品套系
  57. *
  58. * @param postCollectionsSystem 藏品套系
  59. * @return 结果
  60. */
  61. @Override
  62. public int updatePostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
  63. {
  64. postCollectionsSystem.setUpdateTime(DateUtils.getNowDate());
  65. return postCollectionsSystemMapper.updatePostCollectionsSystem(postCollectionsSystem);
  66. }
  67. /**
  68. * 批量删除藏品套系
  69. *
  70. * @param ids 需要删除的藏品套系主键
  71. * @return 结果
  72. */
  73. @Override
  74. public int deletePostCollectionsSystemByIds(Long[] ids)
  75. {
  76. return postCollectionsSystemMapper.deletePostCollectionsSystemByIds(ids);
  77. }
  78. /**
  79. * 删除藏品套系信息
  80. *
  81. * @param id 藏品套系主键
  82. * @return 结果
  83. */
  84. @Override
  85. public int deletePostCollectionsSystemById(Long id)
  86. {
  87. return postCollectionsSystemMapper.deletePostCollectionsSystemById(id);
  88. }
  89. /**
  90. * 套系搜索功能
  91. * @return
  92. */
  93. @Override
  94. public List<PostCollectionsSystem> selectByTitleAndTime(String title, Date TimeLeft, Date TimeRight) {
  95. if (title != null) {
  96. //标题不为空则判断时间
  97. if (TimeLeft != null && TimeRight != null) {
  98. if( TimeLeft.before(TimeRight)) {
  99. return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
  100. }else {
  101. return null;
  102. }
  103. }else {
  104. //时间为空
  105. return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
  106. }
  107. } else {
  108. //标题为空
  109. //确保查询到的公告为已发布的公告
  110. if (TimeLeft != null && TimeRight != null) {
  111. //时间不为空 ,且左时间在右时间之前
  112. if( TimeLeft.before(TimeRight)) {
  113. return postCollectionsSystemMapper.selectPostListByTitleOrTime(title, TimeLeft, TimeRight);
  114. }else {
  115. return null;
  116. }
  117. }
  118. }
  119. PostCollectionsSystem post = new PostCollectionsSystem();
  120. return postCollectionsSystemMapper.selectPostCollectionsSystemList(post);
  121. }
  122. }