Commit 9c5839ee by carrieyzzhang

notice

parent 673355b4
......@@ -13,8 +13,12 @@ import java.util.List;
@Transactional
public interface NoticeRepository extends JpaRepository<IONotice, Long> {
@Query(value = "select * from ionotice n where n.isdeploy is true and (io_account like %?1% or io_account = '-1') order by deploy_date desc", nativeQuery = true)
List<IONotice> listRecentDeployNotice(String email);
// @Query(value = "select * from ionotice n where n.isdeploy is true and (io_account like %?1% or io_account = '-1') order by deploy_date desc", nativeQuery = true)
// List<IONotice> listRecentDeployNotice(String email);
@Query(value = "select * from ionotice n where n.isdeploy is true and n.modify_date>= ?1 and (io_account='-1' or io_account like CONCAT('%<',?2,'>%')) union select * from ionotice where is_top=1 and isdeploy is true and modify_date< ?1 and (io_account='-1' or io_account like CONCAT('%<',?2,'>%')) order by modify_date desc"
, nativeQuery = true)
List<IONotice> listRecentDeployNotice(String currentDate, Long rootParent);
}
......@@ -5,9 +5,11 @@ import com.google.common.collect.Lists;
import com.reyun.model.Account;
import com.reyun.model.IONotice;
import com.reyun.model.UserNoticeLog;
import com.reyun.repository.AccountRepository;
import com.reyun.repository.NoticeRepository;
import com.reyun.repository.UserNoticeLogRepository;
import com.reyun.service.NoticeService;
import com.reyun.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -27,10 +29,15 @@ public class NoticeServiceImpl implements NoticeService {
@Autowired
private UserNoticeLogRepository userNoticeLogRepository;
@Autowired
private AccountRepository accountRepository;
@Override
public List<IONotice> listRecentDeployNotice(Long accountId) {
List<IONotice> recentDeployNoticeList = noticeRepository.listRecentDeployNotice("<" + accountId + ">");
Account account = accountRepository.findOne(accountId);
List<IONotice> recentDeployNoticeList = noticeRepository.listRecentDeployNotice(DateUtil.getBeforeDays(7), account.getRootParent());
if (!CollectionUtils.isEmpty(recentDeployNoticeList)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment