浏览代码

查询列表限制数量

liliang4869 7 年之前
父节点
当前提交
ee18f3dd62

+ 4 - 4
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -423,12 +423,12 @@ public class WebpageController extends BaseController {
 		modelview.addObject("industryList", industryList);
 		modelview.addObject("industryList", industryList);
 		
 		
 		//最新需求
 		//最新需求
-		List<DemandListBo> recentDemandList=demandService.recentDemand();
+		List<DemandListBo> recentDemandList=demandService.recentDemand(5);
 		LimitLengthUtil.limiteDemandCompanyAndName(recentDemandList, 18, 18);
 		LimitLengthUtil.limiteDemandCompanyAndName(recentDemandList, 18, 18);
 		modelview.addObject("recentDemandList",recentDemandList);
 		modelview.addObject("recentDemandList",recentDemandList);
-//		
+//		 
 //		//加急需求
 //		//加急需求
-		List<DemandListBo> urgentDemand=demandService.getUrgentDemand();
+		List<DemandListBo> urgentDemand=demandService.getUrgentDemand(5);
 		List<DemandListBo> urgentDemand2=urgentDemand.subList(0, Math.min(2, urgentDemand.size()));
 		List<DemandListBo> urgentDemand2=urgentDemand.subList(0, Math.min(2, urgentDemand.size()));
 		List<DemandListBo> urgentDemand3=urgentDemand.subList( Math.min(2, urgentDemand.size()),  Math.min(5, urgentDemand.size()));
 		List<DemandListBo> urgentDemand3=urgentDemand.subList( Math.min(2, urgentDemand.size()),  Math.min(5, urgentDemand.size()));
 		System.out.print("u2:"+urgentDemand2.size()+" u3:"+urgentDemand3.size());
 		System.out.print("u2:"+urgentDemand2.size()+" u3:"+urgentDemand3.size());
@@ -438,7 +438,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("urgentDemand3",urgentDemand3);
 		modelview.addObject("urgentDemand3",urgentDemand3);
 		
 		
 		//热点需求
 		//热点需求
-		List<DemandListBo> hotDemand=demandService.getHotDemand();
+		List<DemandListBo> hotDemand=demandService.getHotDemand(5);
 		List<DemandListBo> hotDemand2=hotDemand.subList(0, Math.min(2, hotDemand.size()));
 		List<DemandListBo> hotDemand2=hotDemand.subList(0, Math.min(2, hotDemand.size()));
 		List<DemandListBo> hotDemand3=hotDemand.subList( Math.min(2, hotDemand.size()),  Math.min(5, hotDemand.size()));
 		List<DemandListBo> hotDemand3=hotDemand.subList( Math.min(2, hotDemand.size()),  Math.min(5, hotDemand.size()));
 		System.out.print("u2:"+hotDemand2.size()+" u3:"+hotDemand3.size());
 		System.out.print("u2:"+hotDemand2.size()+" u3:"+hotDemand3.size());

+ 3 - 3
src/main/java/com/goafanti/common/dao/DemandMapper.java

@@ -61,13 +61,13 @@ public interface DemandMapper {
 
 
 	Demand selectDemandFollow(String id);
 	Demand selectDemandFollow(String id);
 	
 	
-	List<DemandListBo> selectRecentDemand();
+	List<DemandListBo> selectRecentDemand(int size);
 	
 	
 	List<DemandListBo> selectCompanyDemand(int size);
 	List<DemandListBo> selectCompanyDemand(int size);
 	
 	
-	List<DemandListBo> getUrgentDemand();
+	List<DemandListBo> getUrgentDemand(int size);
 	
 	
-	List<DemandListBo> getHotDemand();
+	List<DemandListBo> getHotDemand(int size);
 	
 	
 	List<DemandListBo> getAreaDemand(int size);
 	List<DemandListBo> getAreaDemand(int size);
 	
 	

+ 3 - 3
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -1013,7 +1013,7 @@
   
   
   </select>
   </select>
   <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
   <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
- select name,employer_name as employerName,id ,release_date as releaseDate,demand_type as demandType from demand where audit_status=2 order by  release_date  desc LIMIT 5 
+ select name,employer_name as employerName,id ,release_date as releaseDate,demand_type as demandType from demand where audit_status=2 order by  release_date  desc limit #{size}
   </select>
   </select>
   
   
     <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
     <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
@@ -1022,13 +1022,13 @@
    <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
    <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  validity_period as validityPeriod
  validity_period as validityPeriod
-  from demand d  where d.is_urgent=1 and d.audit_status=2 order by  release_date  desc
+  from demand d  where d.is_urgent=1 and d.audit_status=2 order by  release_date  desc limit #{size}
   </select>
   </select>
   
   
   <select id="getHotDemand" resultType="com.goafanti.demand.bo.DemandListBo">
   <select id="getHotDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  validity_period as validityPeriod
  validity_period as validityPeriod
-  from demand d  where d.is_hot=1 and d.audit_status=2 order by  release_date  desc
+  from demand d  where d.is_hot=1 and d.audit_status=2 order by  release_date  desc limit #{size}
   </select>
   </select>
   
   
    <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">
    <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">

+ 3 - 3
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -68,13 +68,13 @@ public interface DemandService {
 	Demand DemandFollowDetails(String id);
 	Demand DemandFollowDetails(String id);
 	
 	
 	//科技需求首页列表
 	//科技需求首页列表
-	List<DemandListBo> recentDemand();
+	List<DemandListBo> recentDemand(int size);
 	
 	
 	List<DemandListBo> companyDemand(int size);
 	List<DemandListBo> companyDemand(int size);
 	
 	
-	List<DemandListBo> getUrgentDemand();
+	List<DemandListBo> getUrgentDemand(int size);
 	
 	
-	List<DemandListBo> getHotDemand();
+	List<DemandListBo> getHotDemand(int size);
 	
 	
 	List<DemandListBo> areaDemand(int size);
 	List<DemandListBo> areaDemand(int size);
 	
 	

+ 6 - 6
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -834,9 +834,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 	}
 		
 		
 	@Override
 	@Override
-	public List<DemandListBo> recentDemand() {
+	public List<DemandListBo> recentDemand(int size) {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
-		return demandMapper.selectRecentDemand();
+		return demandMapper.selectRecentDemand(size);
 	}
 	}
 	
 	
 
 
@@ -847,15 +847,15 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<DemandListBo> getUrgentDemand() {
+	public List<DemandListBo> getUrgentDemand(int size) {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
-		return demandMapper.getUrgentDemand();
+		return demandMapper.getUrgentDemand(size);
 	}
 	}
 
 
 	@Override
 	@Override
-	public List<DemandListBo> getHotDemand() {
+	public List<DemandListBo> getHotDemand(int size) {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
-		return demandMapper.getHotDemand();
+		return demandMapper.getHotDemand(size);
 	}
 	}
 
 
 	@Override
 	@Override