<select id="selectByWord" resultType="user">
select
id, login_name "username", nickname, password, role, email,
login_date "loginDate", create_date "createDate", status,
to_char(login_date, 'yyyy-mm-dd hh24:mi:ss') "loginDateStr",
to_char(create_date,'yyyy-mm-dd hh24:mi:ss') "createDateStr"
from t_user
<where>
<if test="loginname!=null and loginname!=''">
<bind name="loginname" value="'%'+_parameter.loginname+'%'"/>
and login_name like #{loginname} escape '/'
</if>
<if test="nickname!=null and nickname!=''">
<bind name="nickname" value="'%'+_parameter.nickname+'%'"/>
and nickname like #{nickname} escape '/'
</if>
<if test="useremail!=null and useremail!=''">
<bind name="useremail" value="'%'+_parameter.useremail+'%'"/>
and email like #{useremail} escape '/'
</if>
<if test="createbegin!=null and createbegin!='' and createend!=null and createend!=''">
and create_date>=to_date(#{createbegin},'yyyy-mm-dd')
and to_date(#{createend},'yyyy-mm-dd')>=create_date
</if>
<if test="loginbegin!=null and loginbegin!='' and loginend!=null and loginend!=''">
and login_date>=to_date(#{loginbegin},'yyyy-mm-dd')
and to_date(#{loginend},'yyyy-mm-dd')>=login_date
</if>
<if test="role!='-1'">
and role=#{role}
</if>
</where>
</select>
Oracle中sql的模糊查询
最新推荐文章于 2024-06-11 17:55:55 发布