| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.qxueyou.scc.admin.classroom.model.ClassRoom; |
| | |
| | | |
| | | @Override |
| | | public List<ClassRoom> list(String keyword, Short status, Integer pageSize, Integer pageNum) { |
| | | //判断是否是教师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append(" from ClassRoom where name like ? and createId=? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | hql.append(" from ClassRoom where name like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | |
| | | if(status!=null){ |
| | | hql.append(" and status = ? "); |
| | | params.add(status); |
| | | } |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and createId=?"); |
| | | params.add(teacherId); |
| | | } |
| | | |
| | | hql.append(" and deleteFlag is false order by createTime desc"); |
| | |
| | | |
| | | @Override |
| | | public int listCount(String keyword, Short status) { |
| | | //判断是否是教师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : ClientUtils.getUserId(); |
| | | StringBuffer hql = new StringBuffer(500); |
| | | hql.append(" from ClassRoom where name like ? and createId=? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%',ClientUtils.getUserId()); |
| | | hql.append(" from ClassRoom where name like ? "); |
| | | List<Object> params = CollectionUtils.newList('%' + keyword.trim() + '%'); |
| | | |
| | | if(status!=null){ |
| | | hql.append(" and status = ? "); |
| | | params.add(status); |
| | | } |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and createId=?"); |
| | | params.add(teacherId); |
| | | } |
| | | |
| | | hql.append(" and deleteFlag is false "); |
| | | |