| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class VideoPPTVMapDao extends MongodbBaseDao<VideoPPTVMap> { |
| | | |
| | | public VideoPPTVMap selectByInfoId(String infoId) { |
| | | public List<VideoPPTVMap> list(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.infoId != null) { |
| | | andList.add(Criteria.where("infoId").is(daoQuery.infoId)); |
| | | } |
| | | |
| | | if (daoQuery.programCode != null) { |
| | | andList.add(Criteria.where("programCode").is(daoQuery.programCode)); |
| | | } |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("infoId").is(infoId)); |
| | | return findOne(query); |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | return findList(query); |
| | | } |
| | | |
| | | public List<VideoPPTVMap> listByInfoId(String infoId) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.infoId = infoId; |
| | | return list(daoQuery); |
| | | } |
| | | |
| | | |
| | | public static class DaoQuery { |
| | | public String infoId; |
| | | public String programCode; |
| | | } |
| | | |
| | | |