123456789101112131415161718192021222324252627282930313233343536373839 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.bowintek.practice.mapper.cquery.AnnouncementCQuery">
- <select id="selectUserAnnouncementList" resultType="com.bowintek.practice.vo.system.AnnouncementModel">
- select ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus
- from sys_announcement ann
- left join sys_announcement_sys_role anrole on ann.AnnouncementID = anrole.AnnouncementID
- left join sys_announcement_sys_user anuser on ann.AnnouncementID = anuser.AnnouncementID
- left join sys_user_sys_role usrole on anrole.RoleID = usrole.RoleID
- where (usrole.UserID = #{userID} or anuser.UserID=#{userID} or (anrole.AnnouncementID is null and anuser.AnnouncementID is null))
- and ann.RecordStatus!=3
- and date_format(ann.StartTime,'%Y-%m-%d') <![CDATA[ <= CURDATE() ]]> and date_format(ann.endTime,'%Y-%m-%d') <![CDATA[ >= CURDATE() ]]>
- group by ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus
- order by ann.RecordStatus desc, ann.startTime desc
- </select>
- <select id="selectAnnouncementList" resultType="com.bowintek.practice.vo.system.AnnouncementModel">
- select ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus,us.Name createByName
- from sys_announcement ann
- left join sys_user us on ann.createBy =us.userid
- left join sys_announcement_sys_role anrole on ann.AnnouncementID = anrole.AnnouncementID
- left join sys_announcement_sys_user anuser on ann.AnnouncementID = anuser.AnnouncementID
- left join sys_user_sys_role usrole on anrole.RoleID = usrole.RoleID
- where ann.RecordStatus!=3
- <if test="userID!='' and userID!=null">
- (usrole.UserID = #{userID} or anuser.UserID=#{userID} or (anrole.AnnouncementID is null and anuser.AnnouncementID is null))
- </if>
- <if test="title!='' and title!=null">
- and ann.title like Concat('%',#{title},'%')
- </if>
- <if test="beiginDate!='' and beiginDate!=null">
- and ann.startTime <![CDATA[ >= ]]> STR_TO_DATE(#{beiginDate},'%Y-%m-%d')
- </if>
- <if test="endDate!='' and endDate!=null">
- and ann.endTime <![CDATA[ < ]]> DATE_ADD(STR_TO_DATE(#{endDate},'%Y-%m-%d'),interval 1 day)
- </if>
- group by ann.announcementID,ann.content,ann.title,ann.startTime,ann.endTime,ann.createTime,ann.RecordStatus,us.Name
- order by ann.createTime desc
- </select>
- </mapper>
|