浏览代码

班级列表

change 4 年之前
父节点
当前提交
bcfba93a2e

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/ClassGradeQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -56,7 +57,7 @@ public class ClassGradeQueryBo extends BaseEntity {
 	private Integer learningStatus;
 	/** 1有效 0无效 */
 	@ApiModelProperty("1有效 0无效")
-	private Integer status;
+	private List<Integer> status;
 	/** 班级有效期开始时间 */
 	@ApiModelProperty("班级有效期开始时间")
 	private Long classStartTime;

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeMapper.java

@@ -1,7 +1,13 @@
 package com.zhongzheng.modules.grade.mapper;
 
+import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGrade;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.grade.vo.ClassGradeVo;
+
+import java.util.Collection;
+import java.util.List;
 
 /**
  * 班级Mapper接口
@@ -11,4 +17,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ClassGradeMapper extends BaseMapper<ClassGrade> {
 
+    Collection<ClassGradeVo> queryList(ClassGradeQueryBo bo);
+
+    List<GoodsVo> queryGoodsList(Long classId);
 }

+ 11 - 19
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.*;
 import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
 import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
@@ -32,6 +34,8 @@ import java.util.stream.Collectors;
 @Service
 public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGrade> implements IClassGradeService {
 
+    @Autowired
+    private  IGoodsService iGoodsService;
 
     @Autowired
     private IClassGradeGoodsService classGradeGoodsService;
@@ -44,23 +48,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
 
     @Override
     public List<ClassGradeVo> queryList(ClassGradeQueryBo bo) {
-        LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
-        lqw.eq(bo.getClassStatus() != null, ClassGrade::getClassStatus, bo.getClassStatus());
-        lqw.like(StrUtil.isNotBlank(bo.getOfficialName()), ClassGrade::getOfficialName, bo.getOfficialName());
-        lqw.like(StrUtil.isNotBlank(bo.getClassName()), ClassGrade::getClassName, bo.getClassName());
-        lqw.eq(bo.getStudentUpper() != null, ClassGrade::getStudentUpper, bo.getStudentUpper());
-        lqw.eq(bo.getLearningTimeStart() != null, ClassGrade::getLearningTimeStart, bo.getLearningTimeStart());
-        lqw.eq(bo.getLearningStatus() != null, ClassGrade::getLearningStatus, bo.getLearningStatus());
-        lqw.eq(bo.getStatus() != null, ClassGrade::getStatus, bo.getStatus());
-        lqw.eq(bo.getClassStartTime() != null, ClassGrade::getClassStartTime, bo.getClassStartTime());
-        lqw.eq(bo.getClassEndTime() != null, ClassGrade::getClassEndTime, bo.getClassEndTime());
-        lqw.eq(bo.getExamineId() != null, ClassGrade::getExamineId, bo.getExamineId());
-        lqw.eq(bo.getAreasId() != null, ClassGrade::getAreasId, bo.getAreasId());
-        lqw.eq(bo.getSysUserId() != null, ClassGrade::getSysUserId, bo.getSysUserId());
-        lqw.eq(bo.getInterfacePushId() != null, ClassGrade::getInterfacePushId, bo.getInterfacePushId());
-        lqw.eq(bo.getInterfaceAccountId() != null, ClassGrade::getInterfaceAccountId, bo.getInterfaceAccountId());
-        lqw.eq(bo.getInterfacePeriodId() != null, ClassGrade::getInterfacePeriodId, bo.getInterfacePeriodId());
-        return entity2Vo(this.list(lqw));
+        return entity2Vo(baseMapper.queryList(bo));
     }
 
     /**
@@ -69,17 +57,21 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     * @param collection 实体类集合
     * @return
     */
-    private List<ClassGradeVo> entity2Vo(Collection<ClassGrade> collection) {
+    private List<ClassGradeVo> entity2Vo(Collection<ClassGradeVo> collection) {
         List<ClassGradeVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, ClassGradeVo.class))
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
-            Page<ClassGrade> page = (Page<ClassGrade>)collection;
+            Page<ClassGradeVo> page = (Page<ClassGradeVo>)collection;
             Page<ClassGradeVo> pageVo = new Page<>();
             BeanUtil.copyProperties(page,pageVo);
             pageVo.addAll(voList);
             voList = pageVo;
         }
+        for (ClassGradeVo classGradeVo : voList) {
+            List<GoodsVo> goodsVoList=baseMapper.queryGoodsList(classGradeVo.getClassId());
+            classGradeVo.setGoodsList(goodsVoList);
+        }
         return voList;
     }
 

+ 113 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -26,5 +26,118 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="interfacePeriodId" column="interface_period_id"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeVo" id="ClassGradeVoResult">
+        <result property="classId" column="class_id"/>
+        <result property="classStatus" column="class_status"/>
+        <result property="officialName" column="official_name"/>
+        <result property="className" column="class_name"/>
+        <result property="studentUpper" column="student_upper"/>
+        <result property="learningTimeStart" column="learning_time_start"/>
+        <result property="learningStatus" column="learning_status"/>
+        <result property="status" column="status"/>
+        <result property="classStartTime" column="class_start_time"/>
+        <result property="classEndTime" column="class_end_time"/>
+        <result property="examineId" column="examine_id"/>
+        <result property="areasId" column="areas_id"/>
+        <result property="sysUserId" column="sys_user_id"/>
+        <result property="interfacePushId" column="interface_push_id"/>
+        <result property="remark" column="remark"/>
+        <result property="interfaceAccountId" column="interface_account_id"/>
+        <result property="interfacePeriodId" column="interface_period_id"/>
+        <result property="interfaceAccountName" column="interface_account_name"/>
+        <result property="interfacePeriodName" column="interface_period_name"/>
+        <result property="interfacePushName" column="interface_push_name"/>
+    </resultMap>
+
+
+    <resultMap type="com.zhongzheng.modules.goods.vo.GoodsVo" id="GoodsResultVo">
+        <result property="goodsId" column="goods_id"/>
+        <result property="year" column="year"/>
+        <result property="supplyId" column="supply_id"/>
+        <result property="goodsType" column="goods_type"/>
+        <result property="educationTypeId" column="education_type_id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="schoolId" column="school_id"/>
+        <result property="majorId" column="major_id"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="standPrice" column="stand_price"/>
+        <result property="lowestPrice" column="lowest_price"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="status" column="status"/>
+        <result property="validityStartTime" column="validity_start_time"/>
+        <result property="validityEndTime" column="validity_end_time"/>
+        <result property="studyStartTime" column="study_start_time"/>
+        <result property="studyEndTime" column="study_end_time"/>
+        <result property="certificateIds" column="certificate_ids"/>
+        <result property="introduce" column="introduce"/>
+        <result property="suitableObject" column="suitable_object"/>
+        <result property="buyNote" column="buy_note"/>
+        <result property="pcDetailHtml" column="pc_detail_html"/>
+        <result property="mobileDetailHtml" column="mobile_detail_html"/>
+        <result property="goodsStatus" column="goods_status"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="classHours" column="class_hours"/>
+        <result property="standPriceJson" column="stand_price_json"/>
+        <result property="code" column="code"/>
+        <result property="projectId" column="project_id"/>
+        <result property="goodsAuditionConfig" column="goods_audition_config"/>
+        <result property="goodsPhotographConfig" column="goods_photograph_config"/>
+        <result property="goodsPlayConfig" column="goods_play_config"/>
+        <result property="goodsExamConfig" column="goods_exam_config"/>
+
+        <result property="supplyName" column="supply_name"/>
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+        <result property="schoolName" column="school_name"/>
+        <result property="categoryName" column="category_name"/>
+        <result property="handoutsId" column="handouts_id"/>
+        <result property="templateType" column="template_type"/>
+    </resultMap>
+
+    <select id="queryList" parameterType="Long" resultMap="ClassGradeVoResult">
+        SELECT
+            g.*,
+            (SELECT name FROM class_grade_interface i where g.interface_push_id = i.id) as interface_push_name,
+            (SELECT name FROM class_grade_interface i where g.interface_account_id = i.id) as interface_account_name,
+            (SELECT name FROM class_grade_interface i where g.interface_period_id = i.id) as interface_period_name,
+            (SELECT nick_name FROM sys_user u where g.sys_user_id = u.user_id) as nick_name
+        FROM
+            class_grade g
+        where 1=1
+        <if test="status != null and status.size()!=0 ">
+            AND g.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="queryGoodsList" parameterType="Long" resultMap="GoodsResultVo">
+        SELECT
+            g.*,
+            ps.supply_name,
+            cet.education_name,
+            cpt.project_name,
+            cb.business_name,
+            s.school_name,
+            m.category_name,
+            ot.type AS template_type
+        FROM
+            goods g
+                LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
+                LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+                LEFT JOIN course_business cb ON g.business_id = cb.id
+                LEFT JOIN school s ON s.id = g.school_id
+                LEFT JOIN major m ON g.major_id = m.id
+                LEFT JOIN order_input_template ot ON cb.template_status = ot.id
+                LEFT JOIN class_grade_goods o ON o.goods_id = g.goods_id
+        WHERE
+            1 = 1
+          AND o.grade_id =#{classId}
+    </select>
+
 
 </mapper>