//查看学生课堂表现 //从数据库中查询出学生的课堂表现列表,这个列表中只存了学生的ID,但是我们的目的是还要得到学生的姓名 List<LessonBehave> lessonBehaveList = lessonBehaveDao.queryLessonBehaveForList(request); if (CollectionUtils.isNotEmpty(lessonBehaveList)) { //从缓存中填充学生姓名的值到lessonBehaveList中 MemcachedUtils.fillingListObject(lessonBehaveList, LessonBehave.class); } //在实例字段上添加@CacheField注示 public class LessonBehave{ //学生编号 private String studentId; //学生姓名 @CacheField(keyName = "studentId", dictType = DictType.USER_SIMPLEINFO_NAME) private String studentName; //省略get、set方法 }
另外参考文件:
commonserver/src/com/tianwen/eeducation/server/memcached/utils/MemcachedUtils.java
commonserver/src/com/tianwen/eeducation/server/common/annotation/CachedFieldPropertyManager.java
commonserver/resources/mapping/ds0/framework/model/dictitem-sql-pgsql.xml