change 4 سال پیش
والد
کامیت
e30e02df41

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -19,7 +19,7 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
 
     List<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo);
 
-    List<Long> countGoods(Long applyId);
+    Long countGoods(Long applyId);
 
     List<ExamNumberGoodsVo> examNumberGoodsVos(Long applyId);
 

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -94,8 +94,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     public Boolean updateByEditBo(ExamApplyEditBo bo) {
         ExamApply update = BeanUtil.toBean(bo, ExamApply.class);
         if (bo.getStatus() == 1){
-            List<Long> contGoodsId = baseMapper.countGoods(bo.getApplyId());
-            if (CollectionUtils.isEmpty(contGoodsId)){
+            Long contGoodsId = baseMapper.countGoods(bo.getApplyId());
+            if (contGoodsId < 1){
                 throw new RuntimeException("请先设置适用商品");
             }
             List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(),1L);

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -116,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="countGoods" parameterType="long" resultType="long">
         SELECT
-        eag.goods_id
+        count(eag.goods_id)
         FROM
             exam_apply ea
             LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id where ea.apply_id =#{applyId}