Browse Source

详情列表添加查询字段

liujc 2 years ago
parent
commit
9aa56d5568

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

@@ -47,6 +47,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;
     }

+ 24 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/DegreeRegistrationServiceImpl.java

@@ -29,6 +29,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -55,6 +56,9 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
     @Autowired
     private DegreeService degreeService;
 
+    @Autowired
+    private SubjectService subjectService;
+
     @Override
     public BaseDAO<Integer, DegreeRegistration> getDAO() {
         return degreeRegistrationDao;
@@ -111,7 +115,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
         if(money.compareTo(degreeRegistration.getPrice())!=0){
             throw new BizException("商品价格不符");
         }
-        
+
         Integer userId = degreeRegistration.getUserId();
         String channelType = "";
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
@@ -120,7 +124,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
         studentPaymentOrder.setOrderNo(orderNo);
         studentPaymentOrder.setType(OrderTypeEnum.DEGREE_REGISTRATION);
         studentPaymentOrder.setExpectAmount(money);
-        
+
         if(degreeRegistration.isUseBalance()){
         	SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
             if (userCashAccount == null) {
@@ -262,6 +266,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());

+ 11 - 4
mec-biz/src/main/resources/config/mybatis/DegreeRegistrationMapper.xml

@@ -49,6 +49,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 +61,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 +80,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 +98,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>