Переглянути джерело

fix(app):
1.修改-商品删除下架后依然可以查询详情

wzq 3 тижнів тому
батько
коміт
a204aef3b6

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

@@ -1229,7 +1229,11 @@ public class OrderServiceImpl implements IOrderService {
             if (appOrder.getOrderType() == 0) {
                 //商品信息
                 String productIds = appOrder.getProductIds();
-                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectById(productIds);
+                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectAllById(productIds);
+                if (ObjectUtil.isEmpty(appSitePriceRules)){
+                    log.info("当前学校场地预约商品已下架!{}", productIds);
+                    throw new JeecgBootException("当前商品已下架!");
+                }
                 AppSitePlace appSitePlace = appSitePlaceMapper.selectById(appSitePriceRules.getSitePlaceId());
                 //使用须知
                 if (ObjectUtils.isNotEmpty(appSitePlace.getReminder())) {
@@ -1260,7 +1264,7 @@ public class OrderServiceImpl implements IOrderService {
                 //商品信息
                 String productIds = appOrder.getProductIds();
                 String[] split = productIds.split(",");
-                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectById(split[0].split("\\|")[0]);
+                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectAllById(split[0].split("\\|")[0]);
                 AppSitePlace appSitePlace = appSitePlaceMapper.selectById(appSitePriceRules.getSitePlaceId());
                 //使用须知
                 if (ObjectUtils.isNotEmpty(appSitePlace.getReminder())) {
@@ -1285,7 +1289,7 @@ public class OrderServiceImpl implements IOrderService {
             if (appOrder.getOrderType() == 2) {
                 //商品信息
                 String productIds = appOrder.getProductIds();
-                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectById(productIds);
+                AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectAllById(productIds);
                 AppSitePlace appSitePlace = appSitePlaceMapper.selectById(appSitePriceRules.getSitePlaceId());
                 //使用须知
                 if (ObjectUtils.isNotEmpty(appSitePlace.getReminder())) {
@@ -1339,7 +1343,7 @@ public class OrderServiceImpl implements IOrderService {
         if (appOrder.getType().equals(CommonConstant.ORDER_TYPE_2)) {
             //商品信息
             String productIds = appOrder.getProductIds();
-            AppCourses appCourses = appCoursesMapper.selectById(productIds);
+            AppCourses appCourses = appCoursesMapper.selectAllById(productIds);
             appOrderInfoDTO.setAppCourses(appCourses);
             //使用须知
             if (ObjectUtils.isNotEmpty(appCourses.getReminder())) {

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.jeecg.modules.app.dto.SearchDTO;
 import org.jeecg.modules.app.vo.AppCoursesPageVO;
 import org.jeecg.modules.app.vo.CourseInfoVO;
@@ -56,4 +57,12 @@ public interface AppCoursesMapper extends BaseMapper<AppCourses> {
     IPage<AppCoursesPageVO> getPageCourse(Page<AppCoursesPageVO> page, @Param("orgCode")String orgCode, @Param("userId")String userId);
 
     List<AppCoursesPageVO> queryMakeUpClassTable(@Param("orgCode")String orgCode, @Param("userId")String userId);
+
+    /**
+     * 查询课程详情(包含逻辑删除数据)
+     * @param id
+     * @return
+     */
+    @Select("select * from nm_courses where id = #{id}")
+    AppCourses selectAllById(String id);
 }

+ 18 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/AppSitePriceRulesMapper.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.app.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import org.jeecg.modules.app.vo.OrderVO;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
 import org.jeecg.modules.system.app.entity.AppSitePriceRules;
@@ -30,8 +31,25 @@ public interface AppSitePriceRulesMapper extends BaseMapper<AppSitePriceRules> {
 
     List<OrderVO.PreviewOrderTimePeriod> previewOrderPlaceGymnasiumChartered(@Param("rulesId")List<String> rulesId);
 
+    /**
+     * 批量插入
+     * @param list
+     * @return
+     */
     int insertList(@Param("list") List<AppSitePriceRules> list);
 
+    /**
+     * 批量更新
+     * @param list
+     * @return
+     */
     int updateList(@Param("list") List<AppSitePriceRules> list);
 
+    /**
+     * 根据id查询所有(包含逻辑删除数据)
+     * @param id
+     * @return
+     */
+    @Select("select * from nm_site_price_rules where id = #{id}")
+    AppSitePriceRules selectAllById(String id);
 }