Selaa lähdekoodia

Merge branch 'master' of https://gitee.com/zouxuan/mec

zouxuan 5 vuotta sitten
vanhempi
commit
132d428f6f
24 muutettua tiedostoa jossa 654 lisäystä ja 160 poistoa
  1. 4 3
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  2. 0 21
      mec-web/src/main/java/com/ym/mec/web/controller/education/DemoController.java
  3. 0 21
      mec-web/src/main/java/com/ym/mec/web/controller/student/DemoController.java
  4. 0 21
      mec-web/src/main/java/com/ym/mec/web/controller/system/DemoController.java
  5. 0 21
      mec-web/src/main/java/com/ym/mec/web/controller/teacher/DemoController.java
  6. 8 0
      mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupDao.java
  7. 10 1
      mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupRelationDao.java
  8. 9 0
      mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupTeacherMapperDao.java
  9. 9 0
      mec-web/src/main/java/com/ym/mec/web/dal/dao/TeacherDefaultMusicGroupSalaryDao.java
  10. 3 3
      mec-web/src/main/java/com/ym/mec/web/dal/entity/ClassGroupStudentMapper.java
  11. 103 0
      mec-web/src/main/java/com/ym/mec/web/dal/entity/ClassGroupTeacherMapper.java
  12. 103 0
      mec-web/src/main/java/com/ym/mec/web/dal/entity/TeacherDefaultMusicGroupSalary.java
  13. 11 0
      mec-web/src/main/java/com/ym/mec/web/service/ClassGroupRelationService.java
  14. 17 3
      mec-web/src/main/java/com/ym/mec/web/service/ClassGroupService.java
  15. 8 0
      mec-web/src/main/java/com/ym/mec/web/service/ClassGroupTeacherMapperService.java
  16. 8 0
      mec-web/src/main/java/com/ym/mec/web/service/TeacherDefaultMusicGroupSalaryService.java
  17. 7 1
      mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupRelationServiceImpl.java
  18. 103 57
      mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupServiceImpl.java
  19. 23 0
      mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupTeacherMapperServiceImpl.java
  20. 23 0
      mec-web/src/main/java/com/ym/mec/web/service/impl/TeacherDefaultMusicGroupSalaryServiceImpl.java
  21. 5 0
      mec-web/src/main/resources/config/mybatis/ClassGroupMapper.xml
  22. 19 8
      mec-web/src/main/resources/config/mybatis/ClassGroupRelationMapper.xml
  23. 90 0
      mec-web/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml
  24. 91 0
      mec-web/src/main/resources/config/mybatis/TeacherDefaultMusicGroupSalaryMapper.xml

+ 4 - 3
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -29,8 +29,10 @@ public class ClassGroupController extends BaseController {
 
     @ApiOperation(value = "新增合奏班")
     @PostMapping("/addMixClass")
-    public Object addMixClass(@ApiParam(value = "班级编号,号分割", required = true) String classGroupIds) throws Exception {
-        return succeed(classGroupService.addMixClassGroup(classGroupIds));
+    public Object addMixClass(@ApiParam(value = "乐团编号", required = true) @RequestParam Integer musicGroupId,
+                              @ApiParam(value = "班级名称", required = true) String name,
+                              @ApiParam(value = "班级编号,号分割", required = true) String classGroupIds) throws Exception {
+        return succeed(classGroupService.addMixClassGroup(musicGroupId, name, classGroupIds));
     }
 
     @ApiOperation(value = "删除班级")
@@ -74,5 +76,4 @@ public class ClassGroupController extends BaseController {
     }
 
 
-
 }

+ 0 - 21
mec-web/src/main/java/com/ym/mec/web/controller/education/DemoController.java

@@ -1,21 +0,0 @@
-package com.ym.mec.web.controller.education;
-
-import io.swagger.annotations.Api;
-
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.ym.mec.common.controller.BaseController;
-
-@RequestMapping("edu")
-@Api(tags = "Demo")
-@RestController
-public class DemoController extends BaseController {
-
-
-    @PostMapping("/queryPage")
-    public Object queryPage(){
-        return succeed();
-    }
-}

+ 0 - 21
mec-web/src/main/java/com/ym/mec/web/controller/student/DemoController.java

@@ -1,21 +0,0 @@
-package com.ym.mec.web.controller.student;
-
-import io.swagger.annotations.Api;
-
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.ym.mec.common.controller.BaseController;
-
-@RequestMapping("student")
-@Api(tags = "Demo")
-@RestController
-public class DemoController extends BaseController {
-
-
-    @PostMapping("/queryPage")
-    public Object queryPage(){
-        return succeed();
-    }
-}

+ 0 - 21
mec-web/src/main/java/com/ym/mec/web/controller/system/DemoController.java

@@ -1,21 +0,0 @@
-package com.ym.mec.web.controller.system;
-
-import io.swagger.annotations.Api;
-
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.ym.mec.common.controller.BaseController;
-
-@RequestMapping("system")
-@Api(tags = "Demo")
-@RestController
-public class DemoController extends BaseController {
-
-
-    @PostMapping("/queryPage")
-    public Object queryPage(){
-        return succeed();
-    }
-}

+ 0 - 21
mec-web/src/main/java/com/ym/mec/web/controller/teacher/DemoController.java

@@ -1,21 +0,0 @@
-package com.ym.mec.web.controller.teacher;
-
-import io.swagger.annotations.Api;
-
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.ym.mec.common.controller.BaseController;
-
-@RequestMapping("teacher")
-@Api(tags = "Demo")
-@RestController
-public class DemoController extends BaseController {
-
-
-    @PostMapping("/queryPage")
-    public Object queryPage(){
-        return succeed();
-    }
-}

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupDao.java

@@ -42,8 +42,16 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
 
     /**
      * 查询合奏班包含子班的名字信息
+     *
      * @param classGroupId
      * @return
      */
     ClassGroup findMixClassChildClassGroupNames(@Param("classGroupId") int classGroupId);
+
+    /**
+     * 跟班级ids查询班级信息
+     * @param ids
+     * @return
+     */
+    List<ClassGroup> findClassGroupByIds(@Param("ids") String ids);
 }

+ 10 - 1
mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupRelationDao.java

@@ -2,8 +2,17 @@ package com.ym.mec.web.dal.dao;
 
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.web.dal.entity.ClassGroupRelation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ClassGroupRelationDao extends BaseDAO<Integer, ClassGroupRelation> {
 
-	
+
+    /**
+     * 批量插入班级关联关系
+     * @param classGroupRelationList
+     * @return
+     */
+    int classGroupRelationsInsert(@Param("classGroupRelationList") List<ClassGroupRelation> classGroupRelationList);
 }

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dao/ClassGroupTeacherMapperDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.web.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.web.dal.entity.ClassGroupTeacherMapper;
+
+public interface ClassGroupTeacherMapperDao extends BaseDAO<Long, ClassGroupTeacherMapper> {
+
+	
+}

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dao/TeacherDefaultMusicGroupSalaryDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.web.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.web.dal.entity.TeacherDefaultMusicGroupSalary;
+
+public interface TeacherDefaultMusicGroupSalaryDao extends BaseDAO<Long, TeacherDefaultMusicGroupSalary> {
+
+	
+}

+ 3 - 3
mec-web/src/main/java/com/ym/mec/web/dal/entity/ClassGroupStudentMapper.java

@@ -14,7 +14,7 @@ public class ClassGroupStudentMapper {
 	
 	/** 班级 */
 	@ApiModelProperty(value = "班级编号",required = false)
-	private Long classGroupId;
+	private int classGroupId;
 	
 	/** 学生 */
 	@ApiModelProperty(value = "学生编号",required = false)
@@ -43,11 +43,11 @@ public class ClassGroupStudentMapper {
 		return this.id;
 	}
 			
-	public void setClassGroupId(Long classGroupId){
+	public void setClassGroupId(int classGroupId){
 		this.classGroupId = classGroupId;
 	}
 	
-	public Long getClassGroupId(){
+	public int getClassGroupId(){
 		return this.classGroupId;
 	}
 			

+ 103 - 0
mec-web/src/main/java/com/ym/mec/web/dal/entity/ClassGroupTeacherMapper.java

@@ -0,0 +1,103 @@
+package com.ym.mec.web.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(class_group_teacher_mapper):
+ */
+public class ClassGroupTeacherMapper {
+
+	/**  */
+	private Long id;
+	
+	/**  */
+	private Integer musicGroupId;
+	
+	/**  */
+	private Integer classGroupId;
+	
+	/** 老师角色(主教、助教) */
+	private String teacherRole;
+	
+	/**  */
+	private Integer userId;
+	
+	/** 薪酬 */
+	private long salary;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setMusicGroupId(Integer musicGroupId){
+		this.musicGroupId = musicGroupId;
+	}
+	
+	public Integer getMusicGroupId(){
+		return this.musicGroupId;
+	}
+			
+	public void setClassGroupId(Integer classGroupId){
+		this.classGroupId = classGroupId;
+	}
+	
+	public Integer getClassGroupId(){
+		return this.classGroupId;
+	}
+			
+	public void setTeacherRole(String teacherRole){
+		this.teacherRole = teacherRole;
+	}
+	
+	public String getTeacherRole(){
+		return this.teacherRole;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setSalary(long salary){
+		this.salary = salary;
+	}
+	
+	public long getSalary(){
+		return this.salary;
+	}
+			
+	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);
+	}
+
+}

+ 103 - 0
mec-web/src/main/java/com/ym/mec/web/dal/entity/TeacherDefaultMusicGroupSalary.java

@@ -0,0 +1,103 @@
+package com.ym.mec.web.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(teacher_default_music_group_salary):
+ */
+public class TeacherDefaultMusicGroupSalary {
+
+	/**  */
+	private Long id;
+	
+	/**  */
+	private Integer userId;
+	
+	/** 班级类型(参照 class_group表的type_字段) */
+	private String classGroupType;
+	
+	/**  */
+	private Integer subjectId;
+	
+	/** 主教薪酬 */
+	private long mainTeacherSalary;
+	
+	/** 助教薪酬 */
+	private long assistantTeacherSalary;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setClassGroupType(String classGroupType){
+		this.classGroupType = classGroupType;
+	}
+	
+	public String getClassGroupType(){
+		return this.classGroupType;
+	}
+			
+	public void setSubjectId(Integer subjectId){
+		this.subjectId = subjectId;
+	}
+	
+	public Integer getSubjectId(){
+		return this.subjectId;
+	}
+			
+	public void setMainTeacherSalary(long mainTeacherSalary){
+		this.mainTeacherSalary = mainTeacherSalary;
+	}
+	
+	public long getMainTeacherSalary(){
+		return this.mainTeacherSalary;
+	}
+			
+	public void setAssistantTeacherSalary(long assistantTeacherSalary){
+		this.assistantTeacherSalary = assistantTeacherSalary;
+	}
+	
+	public long getAssistantTeacherSalary(){
+		return this.assistantTeacherSalary;
+	}
+			
+	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);
+	}
+
+}

+ 11 - 0
mec-web/src/main/java/com/ym/mec/web/service/ClassGroupRelationService.java

@@ -2,7 +2,18 @@ package com.ym.mec.web.service;
 
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.web.dal.entity.ClassGroupRelation;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface ClassGroupRelationService extends BaseService<Integer, ClassGroupRelation> {
 
+
+    /**
+     * 批量插入班级关联关系
+     * @param classGroupRelationList
+     * @return
+     */
+    int classGroupRelationsInsert(List<ClassGroupRelation> classGroupRelationList);
+
 }

+ 17 - 3
mec-web/src/main/java/com/ym/mec/web/service/ClassGroupService.java

@@ -2,6 +2,8 @@ package com.ym.mec.web.service;
 
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.web.dal.entity.ClassGroup;
+import com.ym.mec.web.dal.entity.ClassGroupRelation;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -9,6 +11,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     /**
      * 查询老师乐团课课程
+     *
      * @param teacherId
      * @return
      */
@@ -16,13 +19,15 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     /**
      * 合奏班相关班级获取
+     *
      * @param mixClassGroupId
      * @return
      */
-    List<ClassGroup> findClassGroup(Integer musicGroupId,Integer mixClassGroupId);
+    List<ClassGroup> findClassGroup(Integer musicGroupId, Integer mixClassGroupId);
 
     /**
      * 根据乐团编号查询单技班列表
+     *
      * @param musicGroupId
      * @return
      */
@@ -31,6 +36,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     /**
      * 根据乐团编号查询合奏班列表
+     *
      * @param musicGroupId
      * @return
      */
@@ -38,6 +44,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     /**
      * 添加单技班
+     *
      * @param classGroup
      * @return
      */
@@ -45,12 +52,19 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     /**
      * 添加合奏班
+     *
      * @param classGroupIds
      * @return
      * @throws Exception
      */
-    ClassGroup addMixClassGroup(String classGroupIds) throws Exception;
-
+    ClassGroup addMixClassGroup(int musicGroupId, String name, String classGroupIds) throws Exception;
 
+    /**
+     * 跟班级ids查询班级信息
+     *
+     * @param ids
+     * @return
+     */
+    List<ClassGroup> findClassGroupByIds(String ids);
 
 }

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/service/ClassGroupTeacherMapperService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.web.service;
+
+import com.ym.mec.common.service.BaseService;
+import com.ym.mec.web.dal.entity.ClassGroupTeacherMapper;
+
+public interface ClassGroupTeacherMapperService extends BaseService<Long, ClassGroupTeacherMapper> {
+
+}

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/service/TeacherDefaultMusicGroupSalaryService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.web.service;
+
+import com.ym.mec.common.service.BaseService;
+import com.ym.mec.web.dal.entity.TeacherDefaultMusicGroupSalary;
+
+public interface TeacherDefaultMusicGroupSalaryService extends BaseService<Long, TeacherDefaultMusicGroupSalary> {
+
+}

+ 7 - 1
mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupRelationServiceImpl.java

@@ -9,6 +9,8 @@ import com.ym.mec.web.dal.dao.ClassGroupRelationDao;
 import com.ym.mec.web.dal.entity.ClassGroupRelation;
 import com.ym.mec.web.service.ClassGroupRelationService;
 
+import java.util.List;
+
 @Service
 public class ClassGroupRelationServiceImpl extends BaseServiceImpl<Integer, ClassGroupRelation>  implements ClassGroupRelationService {
 	
@@ -19,5 +21,9 @@ public class ClassGroupRelationServiceImpl extends BaseServiceImpl<Integer, Clas
 	public BaseDAO<Integer, ClassGroupRelation> getDAO() {
 		return classGroupRelationDao;
 	}
-	
+
+    @Override
+    public int classGroupRelationsInsert(List<ClassGroupRelation> classGroupRelationList) {
+		return classGroupRelationDao.classGroupRelationsInsert(classGroupRelationList);
+    }
 }

+ 103 - 57
mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupServiceImpl.java

@@ -1,7 +1,10 @@
 package com.ym.mec.web.service.impl;
 
+import com.ym.mec.web.dal.entity.ClassGroupRelation;
 import com.ym.mec.web.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.web.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.web.dal.enums.ClassGroupTypeEnum;
+import com.ym.mec.web.service.ClassGroupRelationService;
 import com.ym.mec.web.service.ClassGroupStudentMapperService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -16,75 +19,118 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.*;
 
 @Service
-public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>  implements ClassGroupService {
-	
-	@Autowired
-	private ClassGroupDao classGroupDao;
+public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> implements ClassGroupService {
 
-	@Autowired
-	private ClassGroupStudentMapperService classGroupStudentMapperService;
+    @Autowired
+    private ClassGroupDao classGroupDao;
+    @Autowired
+    private ClassGroupRelationService classGroupRelationService;
 
-	@Override
-	public BaseDAO<Integer, ClassGroup> getDAO() {
-		return classGroupDao;
-	}
+    @Autowired
+    private ClassGroupStudentMapperService classGroupStudentMapperService;
 
-	@Override
+    @Override
+    public BaseDAO<Integer, ClassGroup> getDAO() {
+        return classGroupDao;
+    }
+
+    @Override
     public List<ClassGroup> findClassGroup4Teacher(Integer teacherId) {
         return classGroupDao.findClassGroup4Teacher(teacherId);
     }
 
-	@Override
-	public List<ClassGroup> findClassGroup(Integer musicGroupId,Integer mixClassGroupId) {
-		if(null==mixClassGroupId){
-			return classGroupDao.findAllMixClassGroup(musicGroupId);
-		}else{
-			return classGroupDao.findMixClassChildClassGroup(mixClassGroupId);
-		}
-	}
+    @Override
+    public List<ClassGroup> findClassGroup(Integer musicGroupId, Integer mixClassGroupId) {
+        if (null == mixClassGroupId) {
+            return classGroupDao.findAllMixClassGroup(musicGroupId);
+        } else {
+            return classGroupDao.findMixClassChildClassGroup(mixClassGroupId);
+        }
+    }
 
     @Override
     public List<ClassGroup> findAllNormalClassGroupByMusicGroupId(int musicGroupId) {
-		return classGroupDao.findAllNormalClassGroupByMusicGroupId(musicGroupId);
+        return classGroupDao.findAllNormalClassGroupByMusicGroupId(musicGroupId);
     }
 
-	@Override
-	public List<ClassGroup> findAllMixClassGroupByMusicGroupId(int musicGroupId) {
-		List<ClassGroup> allMixClassGroup = classGroupDao.findAllMixClassGroup(musicGroupId);
-		for (ClassGroup mixClassGroup:allMixClassGroup){
-			mixClassGroup.setClassNames(classGroupDao.findMixClassChildClassGroupNames(mixClassGroup.getId()).getName());
-		}
-		return allMixClassGroup;
-	}
+    @Override
+    public List<ClassGroup> findAllMixClassGroupByMusicGroupId(int musicGroupId) {
+        List<ClassGroup> allMixClassGroup = classGroupDao.findAllMixClassGroup(musicGroupId);
+        for (ClassGroup mixClassGroup : allMixClassGroup) {
+            mixClassGroup.setClassNames(classGroupDao.findMixClassChildClassGroupNames(mixClassGroup.getId()).getName());
+        }
+        return allMixClassGroup;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ClassGroup addClassGroup(ClassGroup classGroup) throws Exception {
+        Date date;
+        date = new Date();
+        classGroup.setCreateTime(date);
+        classGroup.setUpdateTime(date);
+        classGroup.setType(ClassGroupTypeEnum.NORMAL);
+        String userIds = classGroup.getUserIds();
+        String[] userIdArr = userIds.split(",");
+
+        classGroup.setStudentNum(userIdArr.length);
+        Long classGroupId = this.insert(classGroup);
+
+        //2、插入班级学生关联关系
+        List<ClassGroupStudentMapper> classGroupStudentList = new ArrayList<>();
+        for (String userId : userIdArr) {
+            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+            classGroupStudentMapper.setClassGroupId(classGroupId.intValue());
+            classGroupStudentMapper.setUserId(Integer.getInteger(userId));
+            classGroupStudentMapper.setCreateTime(date);
+            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+            classGroupStudentList.add(classGroupStudentMapper);
+        }
+        classGroupStudentMapperService.classGroupStudentsInsert(classGroupStudentList);
 
-	@Override
+        return classGroup;
+    }
+
+    @Override
 	@Transactional(rollbackFor = Exception.class)
-	public ClassGroup addClassGroup(ClassGroup classGroup) throws Exception {
-		Date date;
-		date = new Date();
-		classGroup.setCreateTime(date);
-		classGroup.setUpdateTime(date);
-		String userIds = classGroup.getUserIds();
-		String[] userIdArr = userIds.split(",");
-
-		classGroup.setStudentNum(userIdArr.length);
-		long classGroupId = this.insert(classGroup);
-		List<ClassGroupStudentMapper> classGroupStudentList = new ArrayList<>();
-		for (String userId:userIdArr) {
-			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-			classGroupStudentMapper.setClassGroupId(classGroupId);
-			classGroupStudentMapper.setUserId(Integer.getInteger(userId));
-			classGroupStudentMapper.setCreateTime(date);
-			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-			classGroupStudentList.add(classGroupStudentMapper);
-		}
-		classGroupStudentMapperService.classGroupStudentsInsert(classGroupStudentList);
-
-		return classGroup;
-	}
-
-	@Override
-	public ClassGroup addMixClassGroup(String classGroupIds) throws Exception {
-		return null;
-	}
+	public ClassGroup addMixClassGroup(int musicGroupId,String name, String classGroupIds) throws Exception {
+        Date date;
+        date = new Date();
+
+        List<ClassGroup> classGroups = findClassGroupByIds(classGroupIds);
+        int studentNum = 0; //学生数
+        String subjectIds = "";
+        for (ClassGroup classGroup : classGroups) {
+            studentNum += classGroup.getStudentNum();
+            subjectIds += subjectIds.isEmpty() ? classGroup.getSubjectIdList() : "," + classGroup.getSubjectIdList();
+        }
+
+        //1、插入班级
+        ClassGroup classGroup = new ClassGroup();
+        classGroup.setMusicGroupId(musicGroupId);
+        classGroup.setSubjectIdList(subjectIds);
+        classGroup.setName(name);
+        classGroup.setType(ClassGroupTypeEnum.MIX);
+        classGroup.setCreateTime(date);
+        classGroup.setUpdateTime(date);
+        Long classGroupId = this.insert(classGroup);
+
+        //2、插入班级关联关系
+        List<ClassGroupRelation> classGroupRelationList = new ArrayList<>();
+        for (ClassGroup cGroup : classGroups) {
+            ClassGroupRelation classGroupRelation = new ClassGroupRelation();
+            classGroupRelation.setClassGroupId(classGroupId.intValue());
+            classGroupRelation.setSubClassGroupId(cGroup.getId());
+            classGroupRelation.setCreateTime(date);
+            classGroupRelationList.add(classGroupRelation);
+        }
+		classGroupRelationService.classGroupRelationsInsert(classGroupRelationList);
+        return classGroup;
+    }
+
+    @Override
+    public List<ClassGroup> findClassGroupByIds(String ids) {
+        return classGroupDao.findClassGroupByIds(ids);
+    }
+
 }

+ 23 - 0
mec-web/src/main/java/com/ym/mec/web/service/impl/ClassGroupTeacherMapperServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.web.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.web.dal.dao.ClassGroupTeacherMapperDao;
+import com.ym.mec.web.dal.entity.ClassGroupTeacherMapper;
+import com.ym.mec.web.service.ClassGroupTeacherMapperService;
+
+@Service
+public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, ClassGroupTeacherMapper>  implements ClassGroupTeacherMapperService {
+	
+	@Autowired
+	private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
+
+	@Override
+	public BaseDAO<Long, ClassGroupTeacherMapper> getDAO() {
+		return classGroupTeacherMapperDao;
+	}
+	
+}

+ 23 - 0
mec-web/src/main/java/com/ym/mec/web/service/impl/TeacherDefaultMusicGroupSalaryServiceImpl.java

@@ -0,0 +1,23 @@
+package com.ym.mec.web.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.web.dal.dao.TeacherDefaultMusicGroupSalaryDao;
+import com.ym.mec.web.dal.entity.TeacherDefaultMusicGroupSalary;
+import com.ym.mec.web.service.TeacherDefaultMusicGroupSalaryService;
+
+@Service
+public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<Long, TeacherDefaultMusicGroupSalary>  implements TeacherDefaultMusicGroupSalaryService {
+	
+	@Autowired
+	private TeacherDefaultMusicGroupSalaryDao teacherDefaultMusicGroupSalaryDao;
+
+	@Override
+	public BaseDAO<Long, TeacherDefaultMusicGroupSalary> getDAO() {
+		return teacherDefaultMusicGroupSalaryDao;
+	}
+	
+}

+ 5 - 0
mec-web/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -164,4 +164,9 @@
         LEFT JOIN class_group cg ON cgr.sub_class_group_id_=cg.id_
         WHERE cgr.class_group_id_=#{classGroupId} AND del_flag_='0'
     </select>
+
+    <!-- 根据ids查询班级列表 -->
+    <select id="findClassGroupByIds" resultMap="ClassGroup">
+        SELECT * FROM class_group WHERE FIND_IN_SET(id_,#{ids})
+    </select>
 </mapper>

+ 19 - 8
mec-web/src/main/resources/config/mybatis/ClassGroupRelationMapper.xml

@@ -15,13 +15,15 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="ClassGroupRelation">
-		SELECT * FROM class_group_relation WHERE id_ = #{id} 
-	</select>
+        SELECT * FROM class_group_relation WHERE id_ = #{id}
+    </select>
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="ClassGroupRelation">
-		SELECT * FROM class_group_relation ORDER BY id_
-	</select>
+        SELECT *
+        FROM class_group_relation
+        ORDER BY id_
+    </select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.web.dal.entity.ClassGroupRelation" useGeneratedKeys="true"
@@ -51,8 +53,8 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-		DELETE FROM class_group_relation WHERE id_ = #{id} 
-	</delete>
+        DELETE FROM class_group_relation WHERE id_ = #{id}
+    </delete>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ClassGroupRelation" parameterType="map">
@@ -62,6 +64,15 @@
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM class_group_relation
-	</select>
+        SELECT COUNT(*)
+        FROM class_group_relation
+    </select>
+
+    <!-- 班级关系批量插入 -->
+    <insert id="classGroupRelationsInsert" parameterType="java.util.List">
+        INSERT INTO class_group_relation (id_,class_group_id_,sub_class_group_id_,create_time_)
+        <foreach collection="classGroupRelationList" item="item" index="index" separator=",">
+            (#{item.id},#{item.classGroupId},#{item.subClassGroupId},#{item.createTime})
+        </foreach>
+    </insert>
 </mapper>

+ 90 - 0
mec-web/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml

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

+ 91 - 0
mec-web/src/main/resources/config/mybatis/TeacherDefaultMusicGroupSalaryMapper.xml

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