limin il y a 7 ans
Parent
commit
ed172fd398

+ 8 - 0
src/main/java/com/goafanti/business/service/JtBusinessService.java

@@ -48,5 +48,13 @@ public interface JtBusinessService {
 	 * @return
 	 */
 	List<JtBusinessProject> getKJListByIds(Integer module, Integer isHost, Integer size);
+	/**
+	 * 根据名字查看二级分类
+	 * @param name
+	 * @param isHost
+	 * @param size
+	 * @return
+	 */
+	List<JtBusinessProject> getModuleByName(String  name, Integer isHost, Integer size);
 	
 }

+ 6 - 0
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java

@@ -444,6 +444,12 @@ public class JtBusinessServiceImpl  extends BaseMybatisDao<JtBusinessProjectMapp
 			Integer isHost, Integer size) {
 		return jtBusinessProjectMapper.getKJListByIds( module,  isHost,  size);
 	}
+
+	@Override
+	public List<JtBusinessProject> getModuleByName(String name, Integer isHost,
+			Integer size) {
+		return jtBusinessProjectMapper.getModuleByName(name, isHost, size);
+	}
 	
 	
 	

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

@@ -385,15 +385,7 @@ public class WebpageController extends BaseController {
 		//高企服务
 		JtBusinessCategory gaoqi = jtBusinessService.getBusinessCategoryByLayerAndName(1, "高新技术企业服务");
 		if (gaoqi != null) {
-			List<JtBusinessCategory> scienceProject = jtBusinessService.getCategoryByModule(2);
-			List<JtBusinessProject> gaoqiList = new ArrayList<JtBusinessProject>();
-			for (JtBusinessCategory jtBusinessCategory : scienceProject) {
-				List<JtBusinessProject> list = jtBusinessService.getBusinessProjectByCategoryId(jtBusinessCategory.getId(), 6, null);
-				gaoqiList.addAll(list);
-			}
-			if(gaoqiList.size()>6){
-				gaoqiList.subList(0, 6);
-			}
+			List<JtBusinessProject> gaoqiList = jtBusinessService.getKJListByIds(2,null,6);
 			/*List<JtBusinessProject> gaoqiList = jtBusinessService.getBusinessProjectByCategoryId(gaoqi2.getId(), 6, null);*/
 			for (JtBusinessProject project : gaoqiList) {
 				if (project.getMinImgUrl() != null && project.getMinImgUrl().length() <= 0)
@@ -410,32 +402,16 @@ public class WebpageController extends BaseController {
 		//企业资质认证
 		JtBusinessCategory qiyerenzheng = jtBusinessService.getBusinessCategoryByLayerAndName(1, "企业资质认定");
 		if (qiyerenzheng != null) {
-			//获得所有下级id
-			List<JtBusinessCategory> xaiji = jtBusinessService.getBusinessCategoryBySuperId(qiyerenzheng.getId(), 10);
-			List<JtBusinessProject> qyrzCategories = new ArrayList<JtBusinessProject>();
-			for (int i = 0; i < xaiji.size(); i++) {
-				List<JtBusinessProject> list = jtBusinessService.getBusinessProjectByCategoryId(xaiji.get(i).getId(), 10, null);
-				qyrzCategories.addAll(list);
-			}
-			if(qyrzCategories.size()>10){
-				qyrzCategories.subList(0, 10);
-			}
+			
+			List<JtBusinessProject> qyrzCategories = jtBusinessService.getModuleByName("企业资质认定", null, 12);
+			
 			modelview.addObject("qyrzCategories", qyrzCategories);
 			modelview.addObject("qyrzc1", qiyerenzheng);
 		}
 		//管理体系认证
 		JtBusinessCategory manageSys2 = jtBusinessService.getBusinessCategoryByLayerAndName(1, "管理体系认证");
 		if (manageSys2 != null) {
-			//获得所有下级id
-			List<JtBusinessCategory> xaiji = jtBusinessService.getBusinessCategoryBySuperId(manageSys2.getId(), 10);
-			List<JtBusinessProject> qyrzCategories = new ArrayList<JtBusinessProject>();
-			for (int i = 0; i < xaiji.size(); i++) {
-				List<JtBusinessProject> list = jtBusinessService.getBusinessProjectByCategoryId(xaiji.get(i).getId(), 18, null);
-				qyrzCategories.addAll(list);
-			}
-			if(qyrzCategories.size()>18){
-				qyrzCategories.subList(0, 18);
-			}
+			List<JtBusinessProject> qyrzCategories = jtBusinessService.getModuleByName("管理体系认证", null, 18);
 			//List<JtBusinessProject> manageSysPro = jtBusinessService.getBusinessProjectByCategoryId(manageSys2.getId(),18, null);
 			modelview.addObject("manageSystemList", qyrzCategories);
 			modelview.addObject("managerSysc1", manageSys2);

+ 2 - 1
src/main/java/com/goafanti/common/dao/JtBusinessProjectMapper.java

@@ -84,7 +84,8 @@ public interface JtBusinessProjectMapper {
   
 	JtBusinessProjectResult selectByPrimaryKeyWithModule(@Param("id")String id,@Param("uid")String uid);
   
-	List<JtBusinessProject> getKJListByIds(Integer module, Integer isHost, Integer size);
+	List<JtBusinessProject> getKJListByIds(@Param("module")Integer module, @Param("isHot")Integer isHost, @Param("size")Integer size);
+	List<JtBusinessProject> getModuleByName(@Param("name")String name, @Param("isHot")Integer isHost, @Param("size")Integer size);
      
   
 }

+ 23 - 4
src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml

@@ -849,10 +849,29 @@
 	  	p.min_img_url as minImgUrl
   	from jt_business_project p
     left join jt_business_category c on p.category_id = c.id
-    where c.module = #{0} 
-    and p.audit_status = 2 and is_hot = #{1}
+    where c.module = #{module} 
+    and p.audit_status = 2 
+    <if test="isHot">
+    and is_hot = #{isHot}
+    </if>
     order by release_date desc
-	  	limit #{2}
-	
+	  	limit #{size}
 	  </select>
+	   
+	 <!-- 根据二级分类名称查 -->
+	 <select id="getModuleByName" resultType="com.goafanti.common.model.JtBusinessProject">
+	 select  b.id,
+	  	b.name,
+	  	b.introduce,
+	  	b.min_img_url as minImgUrl
+	from (select x.id from jt_business_category x inner join jt_business_category y on x.super_id = y.id where y.name=#{name})a 
+	left join jt_business_project b on a.id = b.category_id
+	where  
+	b.audit_status = 2 
+	<if test="isHot">
+    and is_hot = #{isHot}
+    </if>
+	order by b.release_date desc 
+	limit #{size}
+	 </select>
 </mapper>