AnnouncementCQuery.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.bowintek.practice.mapper.cquery.AnnouncementCQuery">
  4. <select id="selectUserAnnouncementList" resultType="com.bowintek.practice.vo.system.AnnouncementModel">
  5. select ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus
  6. from sys_announcement ann
  7. left join sys_announcement_sys_role anrole on ann.AnnouncementID = anrole.AnnouncementID
  8. left join sys_announcement_sys_user anuser on ann.AnnouncementID = anuser.AnnouncementID
  9. left join sys_user_sys_role usrole on anrole.RoleID = usrole.RoleID
  10. where (usrole.UserID = #{userID} or anuser.UserID=#{userID} or (anrole.AnnouncementID is null and anuser.AnnouncementID is null))
  11. and ann.RecordStatus!=3
  12. and date_format(ann.StartTime,'%Y-%m-%d') <![CDATA[ <= CURDATE() ]]> and date_format(ann.endTime,'%Y-%m-%d') <![CDATA[ >= CURDATE() ]]>
  13. group by ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus
  14. order by ann.RecordStatus desc, ann.startTime desc
  15. </select>
  16. <select id="selectAnnouncementList" resultType="com.bowintek.practice.vo.system.AnnouncementModel">
  17. select ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus,us.Name createByName
  18. from sys_announcement ann
  19. left join sys_user us on ann.createBy =us.userid
  20. left join sys_announcement_sys_role anrole on ann.AnnouncementID = anrole.AnnouncementID
  21. left join sys_announcement_sys_user anuser on ann.AnnouncementID = anuser.AnnouncementID
  22. left join sys_user_sys_role usrole on anrole.RoleID = usrole.RoleID
  23. where ann.RecordStatus!=3
  24. <if test="userID!='' and userID!=null">
  25. (usrole.UserID = #{userID} or anuser.UserID=#{userID} or (anrole.AnnouncementID is null and anuser.AnnouncementID is null))
  26. </if>
  27. <if test="title!='' and title!=null">
  28. and ann.title like Concat('%',#{title},'%')
  29. </if>
  30. <if test="beiginDate!='' and beiginDate!=null">
  31. and ann.startTime <![CDATA[ >= ]]> STR_TO_DATE(#{beiginDate},'%Y-%m-%d')
  32. </if>
  33. <if test="endDate!='' and endDate!=null">
  34. and ann.endTime <![CDATA[ < ]]> DATE_ADD(STR_TO_DATE(#{endDate},'%Y-%m-%d'),interval 1 day)
  35. </if>
  36. group by ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus,us.Name
  37. order by ann.createTime desc
  38. </select>
  39. </mapper>