瀏覽代碼

add:乐团编制

yonge 2 年之前
父節點
當前提交
227f97fa5a

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPlanMakingDao.java

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

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPlanMakingDto.java

@@ -0,0 +1,19 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.ym.mec.biz.dal.entity.MusicGroupPlanMaking;
+
+public class MusicGroupPlanMakingDto extends MusicGroupPlanMaking {
+
+	private Map<Integer,String> subjectMap = new HashMap<Integer,String>();
+
+	public Map<Integer, String> getSubjectMap() {
+		return subjectMap;
+	}
+
+	public void setSubjectMap(Map<Integer, String> subjectMap) {
+		this.subjectMap = subjectMap;
+	}
+}

+ 70 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPlanMaking.java

@@ -0,0 +1,70 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(music_group_plan_making):
+ */
+public class MusicGroupPlanMaking {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private String name;
+	
+	/**  */
+	private String subjectIdList;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	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 setSubjectIdList(String subjectIdList){
+		this.subjectIdList = subjectIdList;
+	}
+	
+	public String getSubjectIdList(){
+		return this.subjectIdList;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPlanMakingService.java

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

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

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

+ 74 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPlanMakingMapper.xml

@@ -0,0 +1,74 @@
+<?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.MusicGroupPlanMakingDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPlanMaking"
+		id="MusicGroupPlanMaking">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="subject_id_list_" property="subjectIdList" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicGroupPlanMaking">
+		SELECT * FROM music_group_plan_making WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicGroupPlanMaking">
+		SELECT * FROM music_group_plan_making ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPlanMaking"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO music_group_plan_making
+		(id_,name_,subject_id_list_,create_time_,update_time_)
+		VALUES(#{id},#{name},#{subjectIdList},#{createTime},#{updateTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPlanMaking">
+		UPDATE music_group_plan_making
+		<set>
+			<if test="subjectIdList != null">
+				subject_id_list_ = #{subjectIdList},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="name != null">
+				name_ = #{name},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM music_group_plan_making WHERE
+		id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicGroupPlanMaking" parameterType="map">
+		SELECT * FROM music_group_plan_making ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_group_plan_making
+	</select>
+</mapper>

+ 103 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPlanMakingController.java

@@ -0,0 +1,103 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.dto.MusicGroupPlanMakingDto;
+import com.ym.mec.biz.dal.entity.MusicGroupPlanMaking;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.service.MusicGroupPlanMakingService;
+import com.ym.mec.biz.service.SubjectService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.yonge.log.model.AuditLogAnnotation;
+
+@RequestMapping("musicGroupPlanMaking")
+@Api(tags = "乐团编制服务")
+@RestController
+public class MusicGroupPlanMakingController extends BaseController {
+	
+	@Autowired
+	private MusicGroupPlanMakingService musicGroupPlanMakingService;
+	
+	@Autowired
+	private SubjectService subjectService;
+
+	@ApiOperation(value = "查询所有乐团编制")
+	@GetMapping(value = "/queryAll", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/queryAll')")
+	public HttpResponseResult<List<MusicGroupPlanMakingDto>> queryAll() throws Exception {
+
+		List<MusicGroupPlanMakingDto> result = new ArrayList<MusicGroupPlanMakingDto>();
+
+		List<MusicGroupPlanMaking> list = musicGroupPlanMakingService.findAll(null);
+
+		for (MusicGroupPlanMaking pm : list) {
+			MusicGroupPlanMakingDto dto = new MusicGroupPlanMakingDto();
+
+			BeanUtils.copyProperties(pm, dto);
+
+			List<Subject> subjectList = subjectService.findBySubjectByIdList(pm.getSubjectIdList());
+			if (subjectList != null) {
+				dto.setSubjectMap(subjectList.stream().collect(Collectors.toMap(Subject::getId, Subject::getName)));
+			}
+
+			result.add(dto);
+		}
+		return succeed(result);
+	}
+
+	@ApiOperation(value = "查询乐团编制")
+	@GetMapping(value = "/query", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/query')")
+	public HttpResponseResult<MusicGroupPlanMakingDto> query(Integer id) throws Exception {
+
+		MusicGroupPlanMaking pm = musicGroupPlanMakingService.get(id);
+
+		if (pm != null) {
+			MusicGroupPlanMakingDto dto = new MusicGroupPlanMakingDto();
+
+			BeanUtils.copyProperties(pm, dto);
+
+			List<Subject> subjectList = subjectService.findBySubjectByIdList(pm.getSubjectIdList());
+			if (subjectList != null) {
+				dto.setSubjectMap(subjectList.stream().collect(Collectors.toMap(Subject::getId, Subject::getName)));
+			}
+			return succeed(dto);
+		}
+		return succeed();
+	}
+
+	@ApiOperation(value = "查询所有乐团编制")
+	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@AuditLogAnnotation(operateName = "乐团基本信息修改",interfaceURL = "musicGroupPlanMaking/add")
+	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/add')")
+	public Object add(@RequestBody MusicGroupPlanMaking musicGroupPlanMaking) throws Exception {
+		musicGroupPlanMakingService.insert(musicGroupPlanMaking);
+		return succeed();
+	}
+
+	@ApiOperation(value = "查询所有乐团编制")
+	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@AuditLogAnnotation(operateName = "乐团基本信息修改",interfaceURL = "musicGroupPlanMaking/update")
+	@PreAuthorize("@pcs.hasPermissions('musicGroupPlanMaking/update')")
+	public Object update(@RequestBody MusicGroupPlanMaking musicGroupPlanMaking) throws Exception {
+		musicGroupPlanMakingService.update(musicGroupPlanMaking);
+		return succeed();
+	}
+	
+}