@Select("select id from cmd_history where command=#{command,jdbcType=VARCHAR} and send_time=(select max(send_time) from cmd_history where command=#{command,jdbcType=VARCHAR})") String checkIfExist(@Param("command") String command);
例如此时:你有两条数据他们的command字段相同,但是时间不一致,此时你需要找到最新一天的记录的command相同的id。即此时找到2
那么就可以按照上述SQL语句书写