zouxuan 5 lat temu
rodzic
commit
993a83a195

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/School.java

@@ -25,6 +25,10 @@ public class School {
 	private Integer organId;
 
 	/**  */
+	@ApiModelProperty(value = "所属机构名称", required = false)
+	private String organName;
+
+	/**  */
 	@ApiModelProperty(value = "地址", required = false)
 	private String address;
 
@@ -58,6 +62,14 @@ public class School {
 	@ApiModelProperty(value = "备注", required = false)
 	private String remark;
 
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
 	public void setId(Integer id) {
 		this.id = id;
 	}

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SchoolService.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.page.SchoolQueryInfo;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
@@ -22,4 +24,6 @@ public interface SchoolService extends BaseService<Integer, School> {
      * @return java.util.List<com.ym.mec.biz.dal.entity.School>
      */
     List<School> findVipSchoolByTeacher(Integer teacherId,String organId,Integer isDefault);
+
+    PageInfo<School> queryPageDetail(SchoolQueryInfo queryInfo);
 }

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SchoolServiceImpl.java

@@ -1,20 +1,31 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.OrganizationDao;
 import com.ym.mec.biz.dal.dao.SchoolDao;
 import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.page.SchoolQueryInfo;
 import com.ym.mec.biz.service.SchoolService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 @Service
 public class SchoolServiceImpl extends BaseServiceImpl<Integer, School>  implements SchoolService {
 	
 	@Autowired
 	private SchoolDao schoolDao;
+	@Autowired
+	private OrganizationDao organizationDao;
 
 	@Override
 	public BaseDAO<Integer, School> getDAO() {
@@ -30,4 +41,16 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School>  impleme
 	public List<School> findVipSchoolByTeacher(Integer teacherId,String organId,Integer isDefault) {
 		return schoolDao.findVipSchoolByUserId(teacherId,organId,isDefault);
 	}
+
+	@Override
+	public PageInfo<School> queryPageDetail(SchoolQueryInfo queryInfo) {
+		PageInfo<School> schoolPageInfo = queryPage(queryInfo);
+		List<School> rows = schoolPageInfo.getRows();
+		Set<Integer> organIds = rows.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
+		Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMap(StringUtils.join(organIds,",")));
+		rows.forEach(e->{
+			e.setOrganName(organNames.get(e.getOrganId()));
+		});
+		return schoolPageInfo;
+	}
 }

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -579,7 +579,7 @@
         LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
         <include refid="queryMusicGroupCourseScheduleSql"/>
-        ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
+        ORDER BY cs.class_date_ ,cs.start_class_time_ ,cg.name_
         <include refid="global.limit"/>
     </select>
 

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/SchoolMapper.xml

@@ -99,6 +99,9 @@
         <if test="organId != null">
             AND FIND_IN_SET(organ_id_,#{organId})
         </if>
+        <if test="search != null">
+            AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ LIKE CONCAT('%',#{search},'%'))
+        </if>
         ORDER BY id_
         <include refid="global.limit"/>
     </select>
@@ -112,6 +115,9 @@
         <if test="organId != null">
             AND FIND_IN_SET(organ_id_,#{organId})
         </if>
+        <if test="search != null">
+            AND (name_ LIKE CONCAT('%',#{search},'%') OR id_ LIKE CONCAT('%',#{search},'%'))
+        </if>
 	</select>
     <select id="queryByOrganId" resultMap="School">
         SELECT * FROM school

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/SchoolController.java

@@ -85,7 +85,7 @@ public class SchoolController extends BaseController {
 				}
 			}
 		}
-        return succeed(schoolService.queryPage(queryInfo));
+        return succeed(schoolService.queryPageDetail(queryInfo));
     }
 
     @ApiOperation(value = "根据机构编号获取学校列表")