<selectid="selectByDynamicField"resultType="com.ruoyi.garden.domain.excel.FeedBackExcel"> select <iftest="'id' in selectFields"> id, </if> <iftest="'username' in selectFields"> username, </if> <iftest="'phone' in selectFields"> phone, </if> <iftest="'email' in selectFields"> email </if> <iftest="'age' in selectFields"> age, </if> <iftest="'createTime' in selectFields"> create_time, </if> <iftest="'updateTime' in selectFields"> update_time </if> from user <where> <iftest="username != null and username != ''"> AND username like concat('%', #{username}, '%') </if> <iftest="phone != null and phone != ''"> AND phone like concat('%', #{phone}, '%') </if> <iftest="email != null and email != ''"> AND email like concat('%', #{email}, '%') </if> <iftest="age != null"> AND age = #{age} </if> <iftest="createTime != null"> AND create_time = #{createTime} </if> <iftest="updateTime != null"> AND update_time = #{updateTime} </if> <iftest="selectIds != null and selectIds.size != 0"> and id in <foreachcollection="selectIds"item="item"open="("close=")"separator=","> #{item} </foreach> </if> </where> ORDER BY create_time DESC </select>