瀏覽代碼

Merge remote-tracking branch 'origin/feature/0406-degree' into feature/0406-degree

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/DegreeRegistrationServiceImpl.java
zouxuan 2 年之前
父節點
當前提交
b009296ca3

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/DegreeRegistration.java

@@ -48,6 +48,8 @@ public class DegreeRegistration {
     @ApiModelProperty(value = "声部",required = true)
     private Integer subjectId;
 
+    private String subjectName;
+
     @ApiModelProperty(value = "考试级别",required = true)
     private String level;
 

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/DegreeQueryInfo.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.page;
 
+import com.ym.mec.biz.dal.enums.DegreeTypeEnum;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -66,6 +67,12 @@ public class DegreeQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "乐器", required = true)
     private String subject;
 
+    @ApiModelProperty(value = "声部", required = true)
+    private Integer subjectId;
+
+    @ApiModelProperty(value = "考级类型",required = true)
+    private DegreeTypeEnum type;
+
     /**
      * 考试级别
      */
@@ -136,6 +143,22 @@ public class DegreeQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "0-未支付 1-支付中 2-已支付 2-已退费",required = false)
     private Integer status;
 
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public DegreeTypeEnum getType() {
+        return type;
+    }
+
+    public void setType(DegreeTypeEnum type) {
+        this.type = type;
+    }
+
     public String getDegreeType() {
         return degreeType;
     }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/DegreeRegistrationServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -54,6 +55,9 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
     @Autowired
     private DegreeService degreeService;
 
+    @Autowired
+    private SubjectService subjectService;
+
     @Override
     public BaseDAO<Integer, DegreeRegistration> getDAO() {
         return degreeRegistrationDao;
@@ -263,6 +267,24 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
                 degreeRegistration.setVipTeacherName(vipTeacherMapper.get(degreeRegistration.getUserId()));
                 degreeRegistration.setNormalTeacherName(teacherMapper.get(degreeRegistration.getUserId()));
             }
+            // 设置声部
+            Set<Integer> subjectIdSet = dataList.stream().map(o -> o.getSubjectId()).filter(Objects::nonNull).collect(Collectors.toSet());
+
+            List<Subject> subjectList = subjectService.findBySubjectByIdList(new ArrayList<>(subjectIdSet));
+
+            // id 分组
+            Map<Integer, Subject> subjectMap = subjectList.stream().collect(Collectors.toMap(Subject::getId, Function.identity()));
+            for (DegreeRegistration degreeRegistration : dataList) {
+                if (degreeRegistration.getSubjectId() == null) {
+                    continue;
+                }
+                Subject subject = subjectMap.get(degreeRegistration.getSubjectId());
+                if (subject != null) {
+                    degreeRegistration.setSubjectName(subject.getName());
+                }
+            }
+
+
             DegreeRegistration degree = degreeRegistrationDao.getTotalAmount(params);
             pageInfo.setApplyNum(degreeRegistrationDao.countApplyNum(params));
             pageInfo.setTotalAmount(degree.getMoney());

+ 18 - 5
mec-biz/src/main/resources/config/mybatis/DegreeRegistrationMapper.xml

@@ -26,7 +26,6 @@
         <result column="status_" jdbcType="TINYINT" property="status"/>
         <result column="certificate_type_" property="certificateType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 		<result column="tenant_id_" property="tenantId" />
-		<result column="type_" property="type" />
 		<result column="type_" property="type"  typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
 
@@ -49,6 +48,9 @@
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(organ_id_,#{organId})
             </if>
+            <if test="type != null">
+                AND type_ = #{type}
+            </if>
             <if test="status != null">
                 AND status_ = #{status}
             </if>
@@ -58,9 +60,6 @@
             <if test="id != null">
                 AND id_ = #{id}
             </if>
-            <if test="search != null and search != ''">
-                AND (id_ = #{search} OR name_ LIKE CONCAT('%',#{search},'%') )
-            </if>
             <if test="orderNo != null">
                 AND order_no_ = #{orderNo}
             </if>
@@ -80,7 +79,11 @@
                 AND city_ LIKE CONCAT('%', #{city},'%')
             </if>
             <if test="subject != null">
-                AND subject_= #{subject}
+                AND subject_ = #{subject}
+            </if>
+
+            <if test="subjectId != null">
+                AND subject_id_= #{subjectId}
             </if>
             <if test="mobile != null">
                 AND mobile_= #{mobile}
@@ -94,6 +97,9 @@
             <if test="endTime != null">
                 <![CDATA[AND DATE_FORMAT(create_time_,"%Y-%m-%d") <= #{endTime}]]>
             </if>
+            <if test="search != null and search != ''">
+                and (user_id_ like concat('%',#{search},'%') or name_ like CONCAT('%',#{search},'%') or mobile_ like CONCAT('%',#{search},'%') )
+            </if>
         </where>
     </sql>
 
@@ -337,4 +343,11 @@
     <select id="findByByOrderId" resultMap="DegreeRegistration">
         SELECT * FROM degree_registration WHERE order_no_ = #{orderNo}
     </select>
+
+    <select id="selectByDegreeId" resultMap="DegreeRegistration">
+        SELECT *
+        FROM degree_registration
+        WHERE degree_id_ = #{degreeId}
+          AND status_ = 1
+    </select>
 </mapper>