Przeglądaj źródła

后台新增曲库列表

zouxuan 4 lat temu
rodzic
commit
0b7c1fa949

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysExamSongDao.java

@@ -0,0 +1,10 @@
+package com.ym.mec.biz.dal.dao;
+
+
+import com.ym.mec.biz.dal.entity.SysExamSong;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface SysExamSongDao extends BaseDAO<Integer, SysExamSong> {
+
+	
+}

+ 149 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysExamSong.java

@@ -0,0 +1,149 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.ExamSongTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_exam_song):
+ */
+public class SysExamSong {
+
+	/**  */
+	private Integer id;
+
+	@ApiModelProperty(value = "名称", required = true)
+	private String name;
+	
+	@ApiModelProperty(value = "类型PERSON 个人,COMMON公用", required = true)
+	private ExamSongTypeEnum type;
+	
+	@ApiModelProperty(value = "声部列表", required = true)
+	private String subjectIds;
+
+	@ApiModelProperty(value = "声部列表", required = true)
+	private String subjectNames;
+	
+	@ApiModelProperty(value = "速度", required = true)
+	private Integer speed;
+	
+	@ApiModelProperty(value = "地址", required = true)
+	private String url;
+	
+	@ApiModelProperty(value = "上传人", required = true)
+	private Integer createUserId;
+
+	@ApiModelProperty(value = "上传人", required = true)
+	private String createUserName;
+	
+	@ApiModelProperty(value = "是否删除1是0否", required = true)
+	private Integer delFlag;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	/**  */
+	private java.util.Date createTime;
+
+	public String getSubjectNames() {
+		return subjectNames;
+	}
+
+	public void setSubjectNames(String subjectNames) {
+		this.subjectNames = subjectNames;
+	}
+
+	public String getCreateUserName() {
+		return createUserName;
+	}
+
+	public void setCreateUserName(String createUserName) {
+		this.createUserName = createUserName;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setType(ExamSongTypeEnum type){
+		this.type = type;
+	}
+	
+	public ExamSongTypeEnum getType(){
+		return this.type;
+	}
+			
+	public void setSubjectIds(String subjectIds){
+		this.subjectIds = subjectIds;
+	}
+	
+	public String getSubjectIds(){
+		return this.subjectIds;
+	}
+			
+	public void setSpeed(Integer speed){
+		this.speed = speed;
+	}
+	
+	public Integer getSpeed(){
+		return this.speed;
+	}
+			
+	public void setUrl(String url){
+		this.url = url;
+	}
+	
+	public String getUrl(){
+		return this.url;
+	}
+			
+	public void setCreateUserId(Integer createUserId){
+		this.createUserId = createUserId;
+	}
+	
+	public Integer getCreateUserId(){
+		return this.createUserId;
+	}
+			
+	public void setDelFlag(Integer delFlag){
+		this.delFlag = delFlag;
+	}
+	
+	public Integer getDelFlag(){
+		return this.delFlag;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ExamSongTypeEnum.java

@@ -0,0 +1,33 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum ExamSongTypeEnum implements BaseEnum<String, ExamSongTypeEnum> {
+	PERSON("PERSON", "个人"), COMMON("COMMON", "公共");
+
+	private String code;
+
+	private String msg;
+
+	ExamSongTypeEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+}

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

@@ -0,0 +1,29 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class SysExamSongQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "声部",required = true)
+    private Integer subjectId;
+
+    @ApiModelProperty(value = "类型",required = true)
+    private String type;
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysExamSongService.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.service;
+
+
+import com.ym.mec.biz.dal.entity.SysExamSong;
+import com.ym.mec.common.service.BaseService;
+
+public interface SysExamSongService extends BaseService<Integer, SysExamSong> {
+
+}

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

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.service.impl;
+
+
+import com.ym.mec.biz.dal.dao.SysExamSongDao;
+import com.ym.mec.biz.dal.entity.SysExamSong;
+import com.ym.mec.biz.service.SysExamSongService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SysExamSongServiceImpl extends BaseServiceImpl<Integer, SysExamSong> implements SysExamSongService {
+	
+	@Autowired
+	private SysExamSongDao sysExamSongDao;
+
+	@Override
+	public BaseDAO<Integer, SysExamSong> getDAO() {
+		return sysExamSongDao;
+	}
+	
+}

+ 104 - 0
mec-biz/src/main/resources/config/mybatis/SysExamSongMapper.xml

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.SysExamSongDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.SysExamSong" id="SysExamSong">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result column="subject_ids_" property="subjectIds" />
+		<result column="subject_names_" property="subjectNames" />
+		<result column="speed_" property="speed" />
+		<result column="url_" property="url" />
+		<result column="create_user_id_" property="createUserId" />
+		<result column="create_user_name_" property="createUserName" />
+		<result column="del_flag_" property="delFlag" />
+		<result column="update_time_" property="updateTime" />
+		<result column="create_time_" property="createTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="SysExamSong" >
+		SELECT * FROM sys_exam_song WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="SysExamSong">
+		SELECT * FROM sys_exam_song ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.SysExamSong" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO sys_exam_song (name_,type_,subject_ids_,speed_,url_,create_user_id_,update_time_,create_time_)
+		VALUES(#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subjectIds},#{speed},#{url},#{createUserId},NOW(),NOW())
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.SysExamSong">
+		UPDATE sys_exam_song
+		<set>
+		<if test="delFlag != null">
+		del_flag_ = #{delFlag},
+		</if>
+		<if test="createUserId != null">
+		create_user_id_ = #{createUserId},
+		</if>
+		<if test="url != null and url != ''">
+		url_ = #{url},
+		</if>
+		<if test="subjectIds != null and subjectIds != ''">
+		subject_ids_ = #{subjectIds},
+		</if>
+		<if test="type != null">
+		type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		</if>
+		<if test="name != null and name != ''">
+		name_ = #{name},
+		</if>
+		<if test="speed != null">
+		speed_ = #{speed},
+		</if>
+		update_time_ = NOW()
+		</set>
+		 WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<update id="delete" >
+		UPDATE sys_exam_song SET del_flag_ = 1 WHERE id_ = #{id}
+	</update>
+	<sql id="queryPageSql">
+		<where>
+			ses.del_flag_ = 0
+			<if test="search != null and search != ''">
+				AND (ses.id_ = #{search} OR ses.name_ LIKE CONCAT('%',#{search},'%'))
+			</if>
+			<if test="type != null and type != ''">
+				AND ses.type_ = #{type}
+			</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.*,GROUP_CONCAT(s.name_) subject_names_,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 `subject` s ON FIND_IN_SET(s.id_,ses.subject_ids_)
+		<include refid="queryPageSql"/>
+		GROUP BY ses.id_
+		ORDER BY ses.id_ DESC
+		<include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(0) FROM sys_exam_song ses
+		<include refid="queryPageSql"/>
+	</select>
+</mapper>

+ 53 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysExamSongController.java

@@ -0,0 +1,53 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.SysExamSong;
+import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
+import com.ym.mec.biz.service.SysExamSongService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+@RequestMapping("sysExamSong")
+@Api(tags = "曲库服务")
+@RestController
+public class SysExamSongController extends BaseController {
+
+    @Autowired
+    private SysExamSongService sysExamSongService;
+
+    @ApiOperation(value = "修改")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('sysExamSong/update')")
+    public Object update(@RequestBody SysExamSong sysExamSong) {
+        sysExamSongService.update(sysExamSong);
+        return succeed();
+    }
+
+    @ApiOperation(value = "新增")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('sysExamSong/add')")
+    public Object add(@RequestBody SysExamSong sysExamSong) {
+        sysExamSongService.insert(sysExamSong);
+        return succeed();
+    }
+
+    @ApiOperation(value = "删除")
+    @PostMapping("/del/{id}")
+    @PreAuthorize("@pcs.hasPermissions('sysExamSong/del')")
+    public Object del(@ApiParam(value = "收费类型编号", required = true) @PathVariable("id") Integer id) {
+        sysExamSongService.delete(id);
+        return succeed();
+    }
+
+    @ApiOperation(value = "分页查询")
+    @GetMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('sysExamSong/queryPage')")
+    public Object queryPage(SysExamSongQueryInfo queryInfo) {
+        return succeed(sysExamSongService.queryPage(queryInfo));
+    }
+
+}