Przeglądaj źródła

后台伴奏曲库

zouxuan 4 lat temu
rodzic
commit
b97380a450

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysExamSongAccompaniment.java

@@ -15,6 +15,9 @@ public class SysExamSongAccompaniment {
 	
 	/**  */
 	private Integer subjectId;
+
+	/**  */
+	private String subjectName;
 	
 	/**  */
 	private String mp3Url;
@@ -33,6 +36,14 @@ public class SysExamSongAccompaniment {
 	/**  */
 	private java.util.Date updateTime;
 
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
 	public int getDelFlag() {
 		return delFlag;
 	}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysExamSongQueryInfo.java

@@ -14,6 +14,16 @@ public class SysExamSongQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "类型",required = true)
     private String type;
 
+    private Integer sysExamSongId;
+
+    public Integer getSysExamSongId() {
+        return sysExamSongId;
+    }
+
+    public void setSysExamSongId(Integer sysExamSongId) {
+        this.sysExamSongId = sysExamSongId;
+    }
+
     public Integer getCreateUserId() {
         return createUserId;
     }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysExamSongAccompanimentService.java

@@ -6,4 +6,5 @@ import com.ym.mec.common.service.BaseService;
 
 public interface SysExamSongAccompanimentService extends BaseService<Integer, SysExamSongAccompaniment> {
 
+    void updateAcc(SysExamSongAccompaniment sysExamSongAccompaniment);
 }

+ 22 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysExamSongAccompanimentServiceImpl.java

@@ -5,9 +5,15 @@ import com.ym.mec.biz.dal.dao.SysExamSongAccompanimentDao;
 import com.ym.mec.biz.dal.entity.SysExamSongAccompaniment;
 import com.ym.mec.biz.service.SysExamSongAccompanimentService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 public class SysExamSongAccompanimentServiceImpl extends BaseServiceImpl<Integer, SysExamSongAccompaniment> implements SysExamSongAccompanimentService {
@@ -19,5 +25,20 @@ public class SysExamSongAccompanimentServiceImpl extends BaseServiceImpl<Integer
 	public BaseDAO<Integer, SysExamSongAccompaniment> getDAO() {
 		return sysExamSongAccompanimentDao;
 	}
-	
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateAcc(SysExamSongAccompaniment sysExamSongAccompaniment) {
+		SysExamSongAccompaniment accompaniment = sysExamSongAccompanimentDao.get(sysExamSongAccompaniment.getId());
+		if(accompaniment == null){
+			throw new BizException("操作失败:伴奏信息不存在");
+		}
+		List<Integer> idList = new ArrayList<>();
+		idList.add(accompaniment.getId());
+		List<Integer> subjectIds = sysExamSongAccompanimentDao.findSubjectByExamId(accompaniment.getExamSongId(),idList);
+		if(subjectIds.size() > 0 && subjectIds.contains(accompaniment.getId())){
+			throw new BizException("操作失败:请勿提交重复的伴奏声部");
+		}
+		sysExamSongAccompanimentDao.update(sysExamSongAccompaniment);
+	}
 }

+ 0 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysExamSongServiceImpl.java

@@ -16,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.sql.Connection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;

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

@@ -10,6 +10,7 @@
 		<result column="id_" property="id" />
 		<result column="exam_song_id_" property="examSongId" />
 		<result column="subject_id_" property="subjectId" />
+		<result column="subject_name_" property="subjectName" />
 		<result column="mp3_url_" property="mp3Url" />
 		<result column="xml_url_" property="xmlUrl" />
 		<result column="del_flag_" property="delFlag" />
@@ -98,7 +99,20 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysExamSongAccompaniment" parameterType="map">
-		SELECT * FROM sys_exam_song_accompaniment ORDER BY id_ <include refid="global.limit"/>
+		SELECT sesa.*,s.name_ subject_name_
+		FROM sys_exam_song_accompaniment sesa
+		LEFT JOIN `subject` s ON s.id_ = sesa.subject_id_
+		<where>
+			sesa.del_flag_ = 0
+			<if test="subjectId != null">
+				AND sesa.subject_id_ = #{subjectId}
+			</if>
+			<if test="sysExamSongId != null">
+				AND sesa.exam_song_id_ = #{sysExamSongId}
+			</if>
+		</where>
+		ORDER BY sesa.id_ DESC
+		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->

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

@@ -100,18 +100,13 @@
 					AND ses.create_user_id_ = #{createUserId}
 				</if>
 			</if>
-			<if test="subjectId != null">
-				AND FIND_IN_SET(#{subjectId},ses.subject_ids_)
-			</if>
 		</where>
 	</sql>
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysExamSong" parameterType="map">
-		SELECT ses.*,s.name_ subject_name_,su.real_name_ create_user_name_
+		SELECT ses.*,su.real_name_ create_user_name_
 		FROM sys_exam_song ses
 		LEFT JOIN sys_user su ON ses.create_user_id_ = su.id_
-		LEFT JOIN sys_exam_song_accompaniment sesa ON sesa.exam_song_id_ = ses.id_
-		LEFT JOIN `subject` s ON s.id_ = sesa.subject_id_
 		<include refid="queryPageSql"/>
 		GROUP BY ses.id_
 		ORDER BY ses.id_ DESC

+ 7 - 7
mec-web/src/main/java/com/ym/mec/web/controller/SysExamSongAccompanimentController.java

@@ -1,8 +1,8 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.dal.entity.SysExamSong;
+import com.ym.mec.biz.dal.entity.SysExamSongAccompaniment;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
-import com.ym.mec.biz.service.SysExamSongService;
+import com.ym.mec.biz.service.SysExamSongAccompanimentService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -17,13 +17,13 @@ import org.springframework.web.bind.annotation.*;
 public class SysExamSongAccompanimentController extends BaseController {
 
     @Autowired
-    private SysExamSongService sysExamSongService;
+    private SysExamSongAccompanimentService sysExamSongAccompanimentService;
 
     @ApiOperation(value = "修改")
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('sysExamSong/update')")
-    public Object update(@RequestBody SysExamSong sysExamSong) {
-        sysExamSongService.update(sysExamSong);
+    public Object update(@RequestBody SysExamSongAccompaniment sysExamSongAccompaniment) {
+        sysExamSongAccompanimentService.updateAcc(sysExamSongAccompaniment);
         return succeed();
     }
 
@@ -31,7 +31,7 @@ public class SysExamSongAccompanimentController extends BaseController {
     @PostMapping("/del/{id}")
     @PreAuthorize("@pcs.hasPermissions('sysExamSong/del')")
     public Object del(@ApiParam(value = "收费类型编号", required = true) @PathVariable("id") Integer id) {
-        sysExamSongService.del(id);
+        sysExamSongAccompanimentService.delete(id);
         return succeed();
     }
 
@@ -39,7 +39,7 @@ public class SysExamSongAccompanimentController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('sysExamSong/queryPage')")
     public Object queryPage(SysExamSongQueryInfo queryInfo) {
-        return succeed(sysExamSongService.queryPage(queryInfo));
+        return succeed(sysExamSongAccompanimentService.queryPage(queryInfo));
     }
 
 }