<select id="find" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
<choose>
<when test="type !=null and type !=''">
<if test='type =="0"'>
SELECT u.USERID AS "userId",u.USERREALNAME AS "userRealName",'应届生' AS "type",'转正提醒'
AS "type",
to_char(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6),'yyyy-mm-dd') AS "ZzDate",
trunc(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6) - SYSDATE) AS "beforeDay"
FROM USERINFO ui,USERDETAILINFO u,DUAL
WHERE ui.USERID=u.USERID AND u.FRESHPREVIOUSGRADUATE=0 AND
(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6) - SYSDATE) <= 30
AND 0 <= (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6) - SYSDATE)
<if test="userId !=null and userId !=''">
AND ui.userid = #{userId,jdbcType=VARCHAR}
</if>
<if test="deptId !=null and deptId !=''">
AND ui.deptid = #{deptId,jdbcType=VARCHAR}
</if>
ORDER BY "ZzDate"
</if>
<if test='type =="1"'>
SELECT u.USERID AS "userId",u.USERREALNAME AS "userRealName",'成熟型人才' AS
"type",'转正提醒' AS "type",
to_char(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12),'yyyy-mm-dd') AS "ZzDate",
trunc(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12) - SYSDATE) AS "beforeDay"
FROM USERINFO ui,USERDETAILINFO u,DUAL
WHERE ui.USERID=u.USERID AND u.FRESHPREVIOUSGRADUATE=1 AND
(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12) - SYSDATE) <= 30
AND 0 <= (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12) - SYSDATE)
<if test="userId !=null and userId !=''">
AND ui.userid = #{userId,jdbcType=VARCHAR}
</if>
<if test="deptId !=null and deptId !=''">
AND ui.deptid = #{deptId,jdbcType=VARCHAR}
</if>
ORDER BY "ZzDate"
</if>
</when>
<otherwise>
SELECT u.USERID AS "userId",u.USERREALNAME AS "userRealName",'应届生' AS "type",'转正提醒' AS
"type",
to_char(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6),'yyyy-mm-dd') AS "ZzDate",
trunc(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),6) - SYSDATE) AS "beforeDay"
FROM USERINFO ui,USERDETAILINFO u,DUAL
WHERE ui.USERID=u.USERID AND u.FRESHPREVIOUSGRADUATE=0 AND (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd
hh24:mi:ss'),6) - SYSDATE) <= 30
AND 0 <= (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd
hh24:mi:ss'),6) - SYSDATE)
<if test="userId !=null and userId !=''">
AND ui.userid = #{userId,jdbcType=VARCHAR}
</if>
<if test="deptId !=null and deptId !=''">
AND ui.deptid = #{deptId,jdbcType=VARCHAR}
</if>
UNION
SELECT u.USERID AS "userId",u.USERREALNAME AS "userRealName",'成熟型人才' AS "type",'转正提醒'
AS "type",
to_char(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12),'yyyy-mm-dd') AS "ZzDate",
trunc(add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd hh24:mi:ss'),12) - SYSDATE) AS "beforeDay"
FROM USERINFO ui,USERDETAILINFO u,DUAL
WHERE ui.USERID=u.USERID AND u.FRESHPREVIOUSGRADUATE=1 AND (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd
hh24:mi:ss'),12) - SYSDATE) <= 30
AND 0 <= (add_months(to_date(u.ENTRYDATE,'yyyy-mm-dd
hh24:mi:ss'),12) - SYSDATE)
<if test="userId !=null and userId !=''">
AND ui.userid = #{userId,jdbcType=VARCHAR}
</if>
<if test="deptId !=null and deptId !=''">
AND ui.deptid = #{deptId,jdbcType=VARCHAR}
</if>
ORDER BY "ZzDate"
</otherwise>
</choose>
</select>