How does Mybatis gracefully query time conditions?

when searching with Mybatis, you can query all conditions dynamically.
for example:

<select id="selectByModelVague" parameterType="com.test.model.User" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from User
    <where>
      <if test="userState != null">
        user_state = -sharp{userState}
      </if>
      <if test="userGender != null">
        and user_gender = -sharp{userGender}
      </if>
      <trim prefix="and (" suffix=")" prefixOverrides="and|or">
        <if test="userNickName != null">
          user_nick_name = -sharp{userNickName}
        </if>
        <if test="userRealName != null">
          or user_real_name = -sharp{userRealName}
        </if>
      </trim>
    </where>
  </select>

in this way, you can easily query the criteria. If you want to search by gender, you just need to add the gender attribute to the incoming model! But the time is different.

because there are all kinds of strange time restrictions, and there may be something like this:

<if test="startTime != null">
  and startTime > -sharp{startTime}
</if>

it is also possible to have such a thing:

<if test="startTime != null">
  and startTime < -sharp{startTime}
</if>

there may even be something like this:

<if test="startTime != null">
  and startTime > -sharp{startTime} and endTime < -sharp{startTime}
</if>

in short, time can not be written directly at one time and can be called dynamically, just like ordinary variables. Because there are too many possibilities for query conditions of time. At this time, we can only write a lot of extra query methods according to the time search conditions.

so, my question is, is there any tool or method that can gracefully perform a time search without modifying the mapping file?


or this:

  

in fact, mybatis does not have the isnotempty method of ibatis, but to solve this problem, I first judge in service that starttime, has fewer dynamic sql tag elements in querying
mybatis

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b383ad-40684.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b383ad-40684.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?