这是在controller里面:
String search = "";
if("null".equals(start_time)||"".equals(start_time))
search += " ";
else{
search += " and to_char(A.create_time, 'YYYY-MM-DD') >= '"+start_time+"'";
}
if("null".equals(end_time)||"".equals(end_time))
search += " ";
else{
search += " and to_char(A.create_time, 'YYYY-MM-DD') <= '"+end_time+"'";
}
if("null".equals(followType)||"".equals(followType)){
search += " ";
}else{
if("0".equals(followType)){
search += " ";
}else{
search += " and A.S_FORM_ID ='"+followType+"'";
}
}
conMap.put("search", search);
conMap.put("userId", userId);
conMap.put("page", page);
conMap.put("pageSize", pageSize);
followTypeList = followupService.searchfollowTypeMiList(conMap);
传到mapper
这是在mapper里面:
SELECT * FROM (
SELECT PATIENT_ID,
USER_NAME,
RECORD_ID,
S_FORM_ID,
S_FORM_NAME,
CREATE_TIME,
ROWNUM rn
FROM (select ROWNUM,
C.PATIENT_ID,
C.USER_NAME,
A.RECORD_ID,
A.S_FORM_ID,
B.S_FORM_NAME,
to_char(A.CREATE_TIME, 'YYYY-MM-DD HH24:mi:ss') as CREATE_TIME
from T_SELF_MEA_RECORD A, T_SELF_MEA_FORM B, T_PATIENT_INFO C
where A.S_FORM_ID = B.S_FORM_ID
AND A.PATIENT_ID = C.PATIENT_ID
AND A.PATIENT_ID = #{userId}
${search}
ORDER BY A.CREATE_TIME DESC)
WHERE ROWNUM <= #{page} * #{pageSize,jdbcType=NUMERIC} )
WHERE rn >= ((#{page} - 1) * #{pageSize,jdbcType=NUMERIC}) + 1
从而实现了拼接