| | |
| | | @Override |
| | | public List<ExerciseInfo> list(String keyword,String classId,Short status,Integer pageSize,Integer pageNum) { |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append("from ExerciseInfo e where e.name like ? and e.createId =? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | |
| | | //判断是否是教师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | hql.append("from ExerciseInfo e where e.name like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and e.createId =?"); |
| | | params.add(teacherId); |
| | | } |
| | | if(status!=null){ |
| | | hql.append(" and e.status = ? "); |
| | | params.add(status); |
| | |
| | | @Override |
| | | public int listCount(String keyword,String classId, Short status) { |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append("from ExerciseInfo e where e.name like ? and e.createId =? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | |
| | | //判断是否是教师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | hql.append("from ExerciseInfo e where e.name like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and e.createId =?"); |
| | | params.add(teacherId); |
| | | } |
| | | if(status!=null){ |
| | | hql.append(" and e.status = ? "); |
| | | params.add(status); |