$lock = M('locked_record');
$type = 1;
$subQuery = $lock->table('sys_locked_record')
->where(array('type'=>$type))
->order('addtime desc')
->buildSql();
$res = $lock->table($subQuery.'a')->group('uid')->select();
默认是获取第一条数据 子查询可以很好的解决这个问题