Ver Fonte

搜索条件新增

change há 3 anos atrás
pai
commit
248c74cbb8

+ 16 - 2
zhongzheng-system/src/main/resources/mapper/modules/user/UserPlanGoodsMapper.xml

@@ -130,12 +130,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             (SELECT cet.education_name FROM  course_education_type cet  where cet.id = g.education_type_id) as education_name,
             (SELECT cet.project_name FROM  course_project_type cet where cet.id = g.project_id) as project_name,
             (SELECT cet.business_name FROM  course_business cet  where cet.id = g.business_id) as business_name,
+            ( SELECT
+                  cgu.grade_id
+              FROM
+                  class_grade_user cgu
+                      LEFT JOIN class_grade_goods cgg on cgu.grade_id = cgg.grade_id
+                      LEFT JOIN class_grade cg on cg.grade_id = cgg.grade_id
+              WHERE
+                  cgu.user_id = up.user_id
+                and cgg.goods_id = upg.sour
+                and cg.`status` = 1
+                and cgu.`status` = 1
+              ORDER BY cgu.create_time desc
+                                                                                                               LIMIT 1) as gradeId
         FROM
             goods g
-                LEFT JOIN user_plan_goods upg on g.goods_id = upg.source_id
+            LEFT JOIN user_plan_goods upg on g.goods_id = upg.source_id
+            LEFT JOIN user_plan up on upg.plan_id = up.plan_id
         WHERE
             1=1
-        and upg.plan_id=#{planId}
+          and upg.plan_id=#{planId}
           and g.goods_type =1
     </select>
 </mapper>