فهرست منبع

院校的省市

jinxia.mo 1 ماه پیش
والد
کامیت
c25dbfda05

+ 34 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontUniversitiesController.java

@@ -102,6 +102,40 @@ public class FrontUniversitiesController extends BaseController {
         return AjaxResult.success(universitiesService.getLocations(ConstantUtil.getExamTypeData(VistorContextHolder.getExamType().title())));
     }
 
+    @GetMapping("locations2")
+    @ApiOperation("00 院校列表数据筛选项-地域 回传location和cityName")
+    public AjaxResult locations2() {
+        List<BBusiWishUniversities> list = universitiesService.selectBBusiWishUniversitiesLocations2(ConstantUtil.getExamTypeData(VistorContextHolder.getExamType().title()));
+        
+        // 按location分组,收集每个location下的cityName
+        Map<String, Set<String>> locationCityMap = list.stream()
+                .filter(item -> StringUtils.isNotBlank(item.getLocation()) && StringUtils.isNotBlank(item.getCityName()))
+                .collect(Collectors.groupingBy(
+                        BBusiWishUniversities::getLocation,
+                        Collectors.mapping(
+                                BBusiWishUniversities::getCityName,
+                                Collectors.toSet()
+                        )
+                ));
+        
+        // 构建返回数据
+        List<Map<String, Object>> result = locationCityMap.entrySet().stream()
+                .sorted(Map.Entry.comparingByKey())
+                .map(entry -> {
+                    Map<String, Object> item = Maps.newHashMap();
+                    item.put("location", entry.getKey());
+                    // 将Set转为List并排序
+                    List<String> cityNames = entry.getValue().stream()
+                            .sorted()
+                            .collect(Collectors.toList());
+                    item.put("cityName", cityNames);
+                    return item;
+                })
+                .collect(Collectors.toList());
+        
+        return AjaxResult.success(result);
+    }
+
     @GetMapping("natureTypes")
     @ApiOperation("00 院校列表数据筛选项-主管机构类型 回传natureTypeCN")
     public AjaxResult natureTypes() {

+ 1 - 0
ie-system/src/main/java/com/ruoyi/syzy/mapper/BBusiWishUniversitiesMapper.java

@@ -44,6 +44,7 @@ public interface BBusiWishUniversitiesMapper {
     public List<BBusiWishUniversities> selectMajorWishUniversitiesListSimpleByMap2(Map cond);
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesListSimple(BBusiWishUniversities bBusiWishUniversities);
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesLocations(String entranceType);
+    public List<BBusiWishUniversities> selectBBusiWishUniversitiesLocations2(String entranceType);
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesTypes(String entranceType);
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesNatureTypes(String entranceType);
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesFeatures(String entranceType);

+ 1 - 1
ie-system/src/main/java/com/ruoyi/syzy/service/IBBusiWishUniversitiesService.java

@@ -60,7 +60,7 @@ public interface IBBusiWishUniversitiesService {
      * @return
      */
     public UniversityDetailDTO detail(String code, Integer year);
-
+    public List<BBusiWishUniversities> selectBBusiWishUniversitiesLocations2(String entranceType);
     public List<String> getLocations(String entranceType);
     public List<String> getTypes(String entranceType);
     public List<String> getNatureTypeCN(String entranceType);

+ 5 - 0
ie-system/src/main/java/com/ruoyi/syzy/service/impl/BBusiWishUniversitiesServiceImpl.java

@@ -109,6 +109,11 @@ public class BBusiWishUniversitiesServiceImpl implements IBBusiWishUniversitiesS
         return bBusiWishUniversitiesMapper.selectBBusiWishUniversitiesLocations(entranceType);
     }
 
+    @Override
+    public List<BBusiWishUniversities> selectBBusiWishUniversitiesLocations2(String entranceType) {
+        return bBusiWishUniversitiesMapper.selectBBusiWishUniversitiesLocations2(entranceType);
+    }
+
     @Override
     public List<BBusiWishUniversities> selectBBusiWishUniversitiesTypes(String entranceType) {
         return bBusiWishUniversitiesMapper.selectBBusiWishUniversitiesTypes(entranceType);

+ 13 - 1
ie-system/src/main/resources/mapper/syzy/BBusiWishUniversitiesMapper.xml

@@ -108,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       <if test="logo != null  and logo != ''"> and logo like concat('%', #{logo}, '%')</if>
       <if test="bannerUrl != null  and bannerUrl != ''"> and bannerUrl like concat('%', #{bannerUrl}, '%')</if>
       <if test="location != null  and location != ''"> and location = #{location}</if>
+      <if test="cityName != null  and cityName != ''"> and cityName = #{cityName}</if>
       <if test="managerType != null  and managerType != ''"> and managerType = #{managerType}</if>
       <if test="type != null  and type != ''"> and type like concat('%', #{type}, '%')</if>
       <if test="level != null  and level != ''"> and level = #{level}</if>
@@ -153,6 +154,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       <if test="status != null "> and u.status = #{status}</if>
       <if test="tier != null "> and u.tier = #{tier}</if>
       <if test="entranceType != null "> and u.entranceType = #{entranceType}</if>
+      <if test="location != null  and location != ''"> and location = #{location}</if>
+      <if test="cityName != null  and cityName != ''"> and cityName = #{cityName}</if>
       <if test="types != null"> and <foreach item="o" collection="types" open="(" separator=" OR " close=")">u.type like concat('%', #{o}, '%')</foreach></if>
       <if test="levels != null"> and u.level in <foreach item="o" collection="levels" open="(" separator="," close=")">#{o}</foreach></if>
       <if test="tiers != null"> and u.tier in <foreach item="o" collection="tiers" open="(" separator="," close=")">#{o}</foreach></if>
@@ -203,6 +206,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       <if test="tier != null "> and u.tier = #{tier}</if>
       <if test="entranceType != null "> and u.entranceType = #{entranceType}</if>
       <if test="examMajor != null "> and p.liberalScience = #{examMajor}</if>
+      <if test="location != null  and location != ''"> and location = #{location}</if>
+      <if test="cityName != null  and cityName != ''"> and cityName = #{cityName}</if>
       <if test="types != null"> and <foreach item="o" collection="types" open="(" separator=" OR " close=")">u.type like concat('%', #{o}, '%')</foreach></if>
       <if test="levels != null"> and u.level in <foreach item="o" collection="levels" open="(" separator="," close=")">#{o}</foreach></if>
       <if test="tiers != null"> and u.tier in <foreach item="o" collection="tiers" open="(" separator="," close=")">#{o}</foreach></if>
@@ -244,7 +249,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       <if test="managerType != null  and managerType != ''"> and managerType = #{managerType}</if>
       <if test="status != null "> and status = #{status}</if>
       <if test="entranceType != null "> and u.entranceType = #{entranceType}</if>
-
+      <if test="location != null  and location != ''"> and location = #{location}</if>
+      <if test="cityName != null  and cityName != ''"> and cityName = #{cityName}</if>
       <if test="locations != null"> and location in <foreach item="o" collection="locations" open="(" separator="," close=")">#{o}</foreach></if>
       <if test="types != null"> and <foreach item="o" collection="types" open="(" separator=" OR " close=")">type like concat('%', #{o}, '%')</foreach></if>
       <if test="levels != null"> and level in <foreach item="o" collection="levels" open="(" separator="," close=")">#{o}</foreach></if>
@@ -285,6 +291,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       <if test="code != null  and code != ''"> and code = #{code}</if>
       <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
       <if test="location != null  and location != ''"> and location = #{location}</if>
+      <if test="cityName != null  and cityName != ''"> and cityName = #{cityName}</if>
       <if test="managerType != null  and managerType != ''"> and managerType = #{managerType}</if>
       <if test="type != null  and type != ''"> and type like concat('%', #{type}, '%')</if>
       <if test="level != null  and level != ''"> and level = #{level}</if>
@@ -318,6 +325,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
       ORDER BY CONVERT( location USING gbk ) COLLATE gbk_chinese_ci ASC
   </select>
 
+  <select id="selectBBusiWishUniversitiesLocations2" parameterType="String" resultMap="BBusiWishUniversitiesResult">
+    SELECT distinct location,cityName from b_busi_wish_universities where entranceType = #{entranceType}
+    ORDER BY CONVERT( location USING gbk ) COLLATE gbk_chinese_ci ASC
+  </select>
+
   <select id="selectBBusiWishUniversitiesTypes" parameterType="String" resultMap="BBusiWishUniversitiesResult">
     SELECT distinct type from b_busi_wish_universities where status>0 and type is not null and type !='' and entranceType = #{entranceType}
   </select>