<?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.yeejoin.amos.fas.business.dao.mapper.BizMessageMapper">


	<select id="queryCountForPage" resultType="long">

		SELECT
		COUNT(1)
		FROM
		toip_biz_message m
		WHERE
		1=1
		<if test="time!=null">
			and TO_DAYS(m.time) = TO_DAYS('${time}')
		</if>

		<if test="type!=null">
			AND m.type = '${type}'
		</if>
		<if test="title!=null">
			AND m.title LIKE '%${title}%'
		</if>
		<if test="orgCode!=null">
			AND (
			m.org_code = '${orgCode}'
			OR m.org_code LIKE '${orgCode}*%'
			)
		</if>
	</select>


	<select id="queryForPage" resultType="com.yeejoin.amos.fas.dao.entity.NodeMessageView">
		SELECT
		*
		FROM
		toip_biz_message m
		WHERE
		1=1
		<if test="time!=null">
			and TO_DAYS(m.time) = TO_DAYS('${time}')
		</if>

		<if test="type!=null">
			AND m.type = '${type}'
		</if>
		<if test="title!=null">
			AND m.title LIKE '%${title}%'
		</if>
		<if test="orgCode!=null">
			AND (
			m.org_code = '${orgCode}'
			OR m.org_code LIKE '${orgCode}*%'
			)
		</if>
		LIMIT ${start},${length} ;
	</select>




</mapper>