Ver Fonte

refactor(app): 将课程地址从 address 改为 name

- 修改了多个 SQL 查询,将 e.address 替换为 e.name AS address
- 更新了 DetailServiceImpl 和 OrderServiceImpl 中获取地址的方式
- 这个改动统一了课程地址的字段名称,提高了代码的一致性和可维护性
SheepHy há 1 semana atrás
pai
commit
911985918e

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -283,7 +283,7 @@ public class DetailServiceImpl implements IDetailService {
             courseInfoVO.setHasDiscount(checkOrderOrFree(user.getId(), appCourses.getCategoryId(),appCourses.getId()));
             AppSite appSite = appSiteMapper.selectById(appCourses.getAddressSiteId());
             if (appSite!=null){
-                courseInfoVO.setAddress(appSite.getAddress());
+                courseInfoVO.setAddress(appSite.getName());
                 double km = PositionUtil.calculateDistance(latitude, longitude, appSite.getLatitude().doubleValue(), appSite.getLongitude().doubleValue());
                 courseInfoVO.setKm(new BigDecimal(String.valueOf(km)));
             }

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -1702,6 +1702,9 @@ public class OrderServiceImpl implements IOrderService {
             if (ObjectUtil.isNotEmpty(proInfoList)) {
                 List<AppOrderProInfo> infoList = proInfoList.stream().filter(orderProInfo -> !Objects.equals(orderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_6)).collect(Collectors.toList());
                 List<AppOrderProInfo> insureList = proInfoList.stream().filter(orderProInfo -> Objects.equals(orderProInfo.getType(), CommonConstant.ORDER_PRO_INFO_TYPE_6)).collect(Collectors.toList());
+                infoList.forEach(orderProInfo -> {
+                    orderProInfo.setAddress(appSiteMapper.selectById(orderProInfo.getSiteId()).getName());
+                });
                 record.setOrderProInfoList(infoList);
                 record.setOrderInsureList(insureList);
             }

+ 4 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -44,7 +44,7 @@
             a.selling_price,
             a.cover,
             a.video,
-            b.address,
+            b.name AS address,
             a.details,
             a.site_id,
             a.insure_ids,
@@ -86,7 +86,7 @@
             instructorAvatar;
     </select>
     <select id="findByCourseList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
-        select b.`name`,e.address,b.original_price,b.selling_price,b.cover
+        select b.`name`,e.name AS address,b.original_price,b.selling_price,b.cover
              ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum,b.start_time,b.end_time
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
@@ -104,7 +104,7 @@
         GROUP BY b.id
     </select>
     <select id="findByLaLoList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
-        select b.`name`,e.address,b.original_price,b.selling_price,b.cover,b.start_time,b.end_time
+        select b.`name`,e.name AS address,b.original_price,b.selling_price,b.cover,b.start_time,b.end_time
              ,b.id,b.price_type,ROUND(b.good_rate * 100)  as  good_rate ,e.latitude,e.longitude,count(c.courses_id) as coursesNum,
                ST_Distance_Sphere(
                        POINT(#{courseRequestVo.longitude}, #{courseRequestVo.latitude}),
@@ -138,7 +138,7 @@
         </if>
     </select>
     <select id="findByList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
-        select b.`name`,e.address,b.original_price,b.selling_price,b.start_time,b.end_time
+        select b.`name`,e.name AS address,b.original_price,b.selling_price,b.start_time,b.end_time
         ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id