Joburgess 5 年之前
父節點
當前提交
18f81c2b46

+ 4 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamLocationController.java

@@ -4,8 +4,10 @@ import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
+import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.entity.ExamLocation;
 import com.keao.edu.user.entity.ExamSong;
+import com.keao.edu.user.page.ExamLocationQueryInfo;
 import com.keao.edu.user.service.ExamLocationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -29,7 +31,7 @@ public class ExamLocationController extends BaseController {
 
     @ApiOperation("分页查询")
     @GetMapping(value = "/list")
-    public HttpResponseResult<PageInfo<ExamLocation>> getList(QueryInfo queryInfo) {
+    public HttpResponseResult<PageInfo<ExamLocation>> getList(ExamLocationQueryInfo queryInfo) {
         return succeed(examLocationService.queryPage(queryInfo));
     }
 
@@ -43,6 +45,7 @@ public class ExamLocationController extends BaseController {
     @ApiOperation("新增考点")
     @PostMapping(value = "/add")
     public HttpResponseResult add(ExamLocation examLocation) {
+        examLocation.setTenantId(TenantContextHolder.getTenantId().toString());
         examLocationService.insert(examLocation);
         return succeed();
     }

+ 12 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamSong.java

@@ -21,6 +21,9 @@ public class ExamSong {
 	@ApiModelProperty(value = "专业")
 	private String subjectList;
 
+	@ApiModelProperty(value = "专业名称")
+	private String subjectNames;
+
 	@ApiModelProperty(value = "级别")
 	private String levelList;
 
@@ -77,7 +80,15 @@ public class ExamSong {
 	public String getSubjectList(){
 		return this.subjectList;
 	}
-			
+
+	public String getSubjectNames() {
+		return subjectNames;
+	}
+
+	public void setSubjectNames(String subjectNames) {
+		this.subjectNames = subjectNames;
+	}
+
 	public void setLevelList(String levelList){
 		this.levelList = levelList;
 	}

+ 3 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamLocationQueryInfo.java

@@ -12,13 +12,13 @@ import javax.management.Query;
 public class ExamLocationQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "是否可用")
-    private boolean isAvailable;
+    private Integer isAvailable;
 
-    public boolean isAvailable() {
+    public Integer getIsAvailable() {
         return isAvailable;
     }
 
-    public void setAvailable(boolean available) {
+    public void setIsAvailable(Integer available) {
         isAvailable = available;
     }
 }

+ 26 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSongServiceImpl.java

@@ -1,13 +1,22 @@
 package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.dao.ExamSongDao;
 import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.service.ExamSongService;
+import com.keao.edu.util.collection.MapUtil;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> implements ExamSongService {
 	
@@ -18,5 +27,21 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
 	public BaseDAO<Integer, ExamSong> getDAO() {
 		return examSongDao;
 	}
-	
+
+    @Override
+    public PageInfo<ExamSong> queryPage(QueryInfo queryInfo) {
+        PageInfo<ExamSong> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<ExamSong> dataList = new ArrayList<>();
+        int count = this.findCount(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = this.getDAO().queryPage(params);
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

+ 8 - 5
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -11,6 +11,7 @@
 		<result column="song_name_" property="songName" />
 		<result column="song_author_" property="songAuthor" />
 		<result column="subject_list_" property="subjectList" />
+		<result column="subject_names_" property="subjectNames" />
 		<result column="level_list_" property="levelList" />
 		<result column="type_" property="type"  typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
 		<result column="file_url_list_" property="fileUrlList" />
@@ -80,27 +81,29 @@
 
 	<sql id="queryCondition">
 		<where>
-			del_flag_=0 AND tenant_id_ = #{tenantId}
+			es.del_flag_=0 AND es.tenant_id_ = #{tenantId}
 			<if test="subjectList!=null">
-				AND FIND_IN_SET(#{subjectList}, subject_list_)
+				AND FIND_IN_SET(#{subjectList}, es.subject_list_)
 			</if>
 			<if test="search!=null">
-				AND (id_=#{search} OR song_name_ LIKE CONCAT('%', #{search}, '%'))
+				AND (es.id_=#{search} OR es.song_name_ LIKE CONCAT('%', #{search}, '%'))
 			</if>
 		</where>
 	</sql>
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ExamSong" parameterType="map">
-		SELECT * FROM exam_song
+		SELECT es.*,GROUP_CONCAT(s.name_) subject_names_ FROM exam_song es
+		LEFT JOIN subject s ON FIND_IN_SET(s.id_, es.subject_list_)
 		<include refid="queryCondition"/>
+		GROUP BY es.id_
 		ORDER BY id_
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM exam_song
+		SELECT COUNT(*) FROM exam_song es
 		<include refid="queryCondition"/>
 	</select>
     <select id="getExamSongs" resultMap="ExamSong">