mybatis中and和or
SQL中and的优先级要高于or所以使用时要用括号将or中的条件包上如:
where tti.status = 1<trim><if test="keyWord != null and keyWord != ''">and (tti.team_name like concat('%', #{keyWord}, '%')or tbp.person_name like concat('%', #{keyWord}, '%'))if><if test="releaseBeginTime != null">and date_format(tti.create_time,'%y%m%d') >= date_format(#{releaseBeginTime},'%y%m%d')if><if test="releaseEndTime != null">and date_format(tti.create_time,'%y%m%d') <= date_format(#{releaseEndTime},'%y%m%d')if><if test="teamType != null and teamType != ''">and tti.team_type = #{teamType}if><if test="teamLevel != null">and tti.team_level = #{teamLevel}if>trim>
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
