1.对于mapper类中的持久化操作:原来用法(mapper+xml)-----新用法(mapper+provider)
代码写法:
@Mapper @Component public interface AttendanceMapper extends TkMapper<Attendance> { @SelectProvider(type = AttendanceProvider.class, method = "attendanceQuery") List<JSONObject> queryJson(JSONObject params); @Select("SELECT COUNT(DISTINCT a.id) from scs_attendance a left join scs_monitor b on a.monitorId=b.id WHERE a.idNumber=#{idNumber} AND b.flag=#{flag} AND a.attendanceTime BETWEEN #{startTime} AND #{endTime}") int getCount(@Param("flag") Integer flag, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("idNumber") String idNumber); }
provider写法:
3,关于时间日期相关的比对操作-----对于mapper 跟 controller
mapper层
@Select("SELECT COUNT(DISTINCT a.id) from scs_attendance a left join scs_monitor b on a.monitorId=b.id WHERE a.idNumber=#{idNumber} AND b.flag=#{flag} AND a.attendanceTime BETWEEN #{startTime} AND #{endTime}") int getCount(@Param("flag") Integer flag, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("idNumber") String idNumber);
controller 层(使用 hutool 工具包):
3,人脸识别方面的设计---支持图片的压缩存储: