<?xml version="1.0" encoding="utf-8" ?>
<select>
  <selectstr>
	SELECT u_sys_post.postid
		,u_sys_post.scid
		,u_sys_post.deptid
		,u_sys_post.empid
		,u_sys_post.sdate
		,u_sys_post.edate
		,u_sys_post.dscrp
		,u_sys_post.opemp
		,u_sys_post.opdate
		,u_sys_post.level
		,u_sys_post.type
		,CASE WHEN u_sys_post.empid = -1 THEN '全部用户' ELSE u_user_jlhprice.username END AS username
	FROM u_sys_post
	LEFT OUTER JOIN u_user_jlhprice ON u_sys_post.empid = u_user_jlhprice.empid
  </selectstr>
  <where>
	<when notnull="@type">
		u_sys_post.type = @type
	</when>
	<when notnull="@empid">
		u_sys_post.empid = -1 OR @empid = 0 OR u_sys_post.empid = @empid
	</when>
	<when>
		getdate() >= u_sys_post.sdate AND getdate() <= u_sys_post.edate
	</when>
  </where>
  <orderstr>
	opdate DESC
  </orderstr>
  <displayfields>
  </displayfields>
</select>
