Ver código fonte

作业模板

Joburgess 5 anos atrás
pai
commit
2efb228479
18 arquivos alterados com 241 adições e 96 exclusões
  1. 55 0
      mec-web/src/main/java/com/ym/mec/web/controller/CourseHomeworkTemplateController.java
  2. 3 3
      mec-web/src/main/java/com/ym/mec/web/controller/TeacherAttendanceController.java
  3. 7 0
      mec-web/src/main/java/com/ym/mec/web/dal/dao/CourseHomeworkTemplateDao.java
  4. 0 11
      mec-web/src/main/java/com/ym/mec/web/dal/dto/TeacherAttendanceDto.java
  5. 34 0
      mec-web/src/main/java/com/ym/mec/web/dal/dto/TeacherSignOutDto.java
  6. 8 8
      mec-web/src/main/java/com/ym/mec/web/dal/entity/CourseHomework.java
  7. 31 20
      mec-web/src/main/java/com/ym/mec/web/dal/entity/CourseHomeworkTemplate.java
  8. 0 12
      mec-web/src/main/java/com/ym/mec/web/dal/entity/StudentAttendance.java
  9. 0 13
      mec-web/src/main/java/com/ym/mec/web/dal/entity/TeacherAttendance.java
  10. 33 0
      mec-web/src/main/java/com/ym/mec/web/dal/page/CourseHomeWorkTemplateQueryInfo.java
  11. 2 1
      mec-web/src/main/java/com/ym/mec/web/service/TeacherAttendanceService.java
  12. 12 1
      mec-web/src/main/java/com/ym/mec/web/service/impl/CourseHomeworkTemplateServiceImpl.java
  13. 16 2
      mec-web/src/main/java/com/ym/mec/web/service/impl/TeacherAttendanceServiceImpl.java
  14. 4 4
      mec-web/src/main/resources/config/mybatis/CourseHomeworkMapper.xml
  15. 29 5
      mec-web/src/main/resources/config/mybatis/CourseHomeworkTemplateMapper.xml
  16. 0 2
      mec-web/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  17. 4 8
      mec-web/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  18. 3 6
      mec-web/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

+ 55 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseHomeworkTemplateController.java

@@ -0,0 +1,55 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.web.dal.entity.CourseHomeworkTemplate;
+import com.ym.mec.web.dal.enums.YesOrNoEnum;
+import com.ym.mec.web.dal.page.CourseHomeWorkTemplateQueryInfo;
+import com.ym.mec.web.service.CourseHomeworkTemplateService;
+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.web.bind.annotation.*;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/18
+ */
+@RequestMapping("courseHomeworkTemplate")
+@Api(tags = "作业模板")
+@RestController
+public class CourseHomeworkTemplateController extends BaseController {
+
+
+    @Autowired
+    private CourseHomeworkTemplateService courseHomeworkTemplateService;
+
+    @ApiOperation(value = "新增作业模板")
+    @PostMapping("/add")
+    public Object add(@RequestBody CourseHomeworkTemplate courseHomeworkTemplate){
+        courseHomeworkTemplate.setDelFlag(YesOrNoEnum.NO);
+        courseHomeworkTemplateService.insert(courseHomeworkTemplate);
+        return succeed();
+    }
+
+    @ApiOperation(value = "删除作业模板")
+    @DeleteMapping("/del/{id}")
+    public Object del(@ApiParam(value = "科目编号", required = true) @PathVariable("id") Integer id){
+        courseHomeworkTemplateService.delete(id);
+        return succeed();
+    }
+
+    @ApiOperation(value = "修改作业模板")
+    @PutMapping("/update")
+    public Object update(@RequestBody CourseHomeworkTemplate courseHomeworkTemplate){
+        courseHomeworkTemplateService.update(courseHomeworkTemplate);
+        return succeed();
+    }
+
+    @ApiOperation(value = "分页查询作业模板列表")
+    @PostMapping("/queryPage")
+    public Object queryPage(@RequestBody CourseHomeWorkTemplateQueryInfo queryInfo){
+        return succeed(courseHomeworkTemplateService.queryPage(queryInfo));
+    }
+
+}

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

@@ -1,7 +1,7 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.web.dal.entity.TeacherAttendance;
+import com.ym.mec.web.dal.dto.TeacherSignOutDto;
 import com.ym.mec.web.dal.page.TeacherAttendanceQueryInfo;
 import com.ym.mec.web.service.TeacherAttendanceService;
 import io.swagger.annotations.Api;
@@ -19,8 +19,8 @@ public class TeacherAttendanceController extends BaseController {
 
     @ApiOperation(value = "新增教师签到")
     @PostMapping("/add")
-    public Object add(@RequestBody TeacherAttendance teacherAttendance) {
-        teacherAttendanceService.addTeacherAttendanceRecord(teacherAttendance);
+    public Object add(@RequestBody TeacherSignOutDto teacherSignOutDto) {
+        teacherAttendanceService.addTeacherAttendanceRecord(teacherSignOutDto);
         return succeed();
     }
 

+ 7 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dao/CourseHomeworkTemplateDao.java

@@ -2,8 +2,15 @@ package com.ym.mec.web.dal.dao;
 
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.web.dal.entity.CourseHomeworkTemplate;
+import org.apache.ibatis.annotations.Param;
 
 public interface CourseHomeworkTemplateDao extends BaseDAO<Integer, CourseHomeworkTemplate> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/9/18
+     * 根据课程计划ID获取所属科目ID
+     */
+    String getSubjectIDs(@Param("courseScheduleID") Long courseScheduleID);
 	
 }

+ 0 - 11
mec-web/src/main/java/com/ym/mec/web/dal/dto/TeacherAttendanceDto.java

@@ -33,9 +33,6 @@ public class TeacherAttendanceDto {
     @ApiModelProperty(value = "班级类型",required = false)
     private String classType;
 
-    @ApiModelProperty(value = "科目ID",required = false)
-    private Long subjectId;
-
     @ApiModelProperty(value = "乐团ID",required = false)
     private Long musicGroupId;
 
@@ -61,14 +58,6 @@ public class TeacherAttendanceDto {
     @ApiModelProperty(value = "教师正常签到提前时间(分钟)",required = false)
     private ParamEnum teacherAttendanceTimeGap;
 
-    public Long getSubjectId() {
-        return subjectId;
-    }
-
-    public void setSubjectId(Long subjectId) {
-        this.subjectId = subjectId;
-    }
-
     public ParamEnum getTeacherAttendanceTimeGap() {
         return teacherAttendanceTimeGap;
     }

+ 34 - 0
mec-web/src/main/java/com/ym/mec/web/dal/dto/TeacherSignOutDto.java

@@ -0,0 +1,34 @@
+package com.ym.mec.web.dal.dto;
+
+import com.ym.mec.web.dal.entity.CourseHomework;
+import com.ym.mec.web.dal.entity.TeacherAttendance;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/18
+ */
+public class TeacherSignOutDto {
+
+    @ApiModelProperty(value = "教师签退信息",required = true)
+    private TeacherAttendance teacherAttendanceInfo;
+
+    @ApiModelProperty(value = "课后作业信息")
+    private CourseHomework courseHomeworkInfo;
+
+    public TeacherAttendance getTeacherAttendanceInfo() {
+        return teacherAttendanceInfo;
+    }
+
+    public void setTeacherAttendanceInfo(TeacherAttendance teacherAttendanceInfo) {
+        this.teacherAttendanceInfo = teacherAttendanceInfo;
+    }
+
+    public CourseHomework getCourseHomeworkInfo() {
+        return courseHomeworkInfo;
+    }
+
+    public void setCourseHomeworkInfo(CourseHomework courseHomeworkInfo) {
+        this.courseHomeworkInfo = courseHomeworkInfo;
+    }
+}

+ 8 - 8
mec-web/src/main/java/com/ym/mec/web/dal/entity/CourseHomework.java

@@ -14,7 +14,7 @@ public class CourseHomework {
 	private Long courseScheduleId;
 	
 	/** 图片地址(多个用逗号分隔) */
-	private String images;
+	private String attachments;
 	
 	/** 作业内容 */
 	private String content;
@@ -46,15 +46,15 @@ public class CourseHomework {
 	public Long getCourseScheduleId(){
 		return this.courseScheduleId;
 	}
-			
-	public void setImages(String images){
-		this.images = images;
+
+	public String getAttachments() {
+		return attachments;
 	}
-	
-	public String getImages(){
-		return this.images;
+
+	public void setAttachments(String attachments) {
+		this.attachments = attachments;
 	}
-			
+
 	public void setContent(String content){
 		this.content = content;
 	}

+ 31 - 20
mec-web/src/main/java/com/ym/mec/web/dal/entity/CourseHomeworkTemplate.java

@@ -1,5 +1,8 @@
 package com.ym.mec.web.dal.entity;
 
+import com.ym.mec.web.dal.enums.ClassGroupTypeEnum;
+import com.ym.mec.web.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 /**
@@ -8,27 +11,35 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 public class CourseHomeworkTemplate {
 
 	/**  */
+	@ApiModelProperty(value = "模板ID",required = false)
 	private Integer id;
 	
 	/** 模板名称 */
+	@ApiModelProperty(value = "模板名称",required = true)
 	private String name;
 	
 	/** 模板内容 */
+	@ApiModelProperty(value = "模板内容",required = true)
 	private String content;
+
+	/** 是否删除  -1:已删除  0:正常 */
+	@ApiModelProperty(value = "是否删除  1:已删除  0:正常",required = false)
+	private YesOrNoEnum delFlag;
 	
 	/**  */
-	private String delFlag;
-	
-	/**  */
+	@ApiModelProperty(value = "创建日期",required = false)
 	private java.util.Date createTime;
 	
 	/**  */
+	@ApiModelProperty(value = "更新日期",required = false)
 	private java.util.Date updateTime;
-	
-	/** 班级类型(普通班级、合奏班级、提高课班级、VIP班级) */
-	private String classGroupType;
+
+	/** 班级类型(普通班级、合奏班级) */
+	@ApiModelProperty(value = "班级类型(普通班级、合奏班级、提高课班级、VIP班级)",required = true)
+	private ClassGroupTypeEnum classGroupType;
 	
 	/**  */
+	@ApiModelProperty(value = "声部ID",required = true)
 	private Integer subjectId;
 	
 	public void setId(Integer id){
@@ -54,15 +65,15 @@ public class CourseHomeworkTemplate {
 	public String getContent(){
 		return this.content;
 	}
-			
-	public void setDelFlag(String delFlag){
-		this.delFlag = delFlag;
+
+	public YesOrNoEnum getDelFlag() {
+		return delFlag;
 	}
-	
-	public String getDelFlag(){
-		return this.delFlag;
+
+	public void setDelFlag(YesOrNoEnum delFlag) {
+		this.delFlag = delFlag;
 	}
-			
+
 	public void setCreateTime(java.util.Date createTime){
 		this.createTime = createTime;
 	}
@@ -78,15 +89,15 @@ public class CourseHomeworkTemplate {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
-	public void setClassGroupType(String classGroupType){
-		this.classGroupType = classGroupType;
+
+	public ClassGroupTypeEnum getClassGroupType() {
+		return classGroupType;
 	}
-	
-	public String getClassGroupType(){
-		return this.classGroupType;
+
+	public void setClassGroupType(ClassGroupTypeEnum classGroupType) {
+		this.classGroupType = classGroupType;
 	}
-			
+
 	public void setSubjectId(Integer subjectId){
 		this.subjectId = subjectId;
 	}

+ 0 - 12
mec-web/src/main/java/com/ym/mec/web/dal/entity/StudentAttendance.java

@@ -16,10 +16,6 @@ public class StudentAttendance {
 	@ApiModelProperty(value = "乐团",required = false)
 	private Integer musicGroupId;
 	
-	/** 科目 */
-	@ApiModelProperty(value = "科目",required = false)
-	private Integer subjectId;
-	
 	/** 班级 */
 	@ApiModelProperty(value = "班级",required = false)
 	private Integer classGroupId;
@@ -63,14 +59,6 @@ public class StudentAttendance {
 		return this.musicGroupId;
 	}
 			
-	public void setSubjectId(Integer subjectId){
-		this.subjectId = subjectId;
-	}
-	
-	public Integer getSubjectId(){
-		return this.subjectId;
-	}
-			
 	public void setClassGroupId(Integer classGroupId){
 		this.classGroupId = classGroupId;
 	}

+ 0 - 13
mec-web/src/main/java/com/ym/mec/web/dal/entity/TeacherAttendance.java

@@ -1,7 +1,6 @@
 package com.ym.mec.web.dal.entity;
 
 import com.ym.mec.web.dal.enums.SignStatusEnum;
-import com.ym.mec.web.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
@@ -24,10 +23,6 @@ public class TeacherAttendance {
 	private Long musicGroupId;
 	
 	/**  */
-	@ApiModelProperty(value = "科目编号",required = false)
-	private Long subjectId;
-	
-	/**  */
 	@ApiModelProperty(value = "班级编号",required = false)
 	private Long classGroupId;
 	
@@ -74,14 +69,6 @@ public class TeacherAttendance {
 		this.musicGroupId = musicGroupId;
 	}
 
-	public Long getSubjectId() {
-		return subjectId;
-	}
-
-	public void setSubjectId(Long subjectId) {
-		this.subjectId = subjectId;
-	}
-
 	public Long getClassGroupId() {
 		return classGroupId;
 	}

+ 33 - 0
mec-web/src/main/java/com/ym/mec/web/dal/page/CourseHomeWorkTemplateQueryInfo.java

@@ -0,0 +1,33 @@
+package com.ym.mec.web.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/9/18
+ */
+public class CourseHomeWorkTemplateQueryInfo extends QueryInfo {
+
+    @ApiModelProperty(value = "科目ID集合",required = false)
+    private String[] subjectIDs;
+
+    @ApiModelProperty(value = "课程计划ID",required = false)
+    private Long courseScheduleID;
+
+    public String[] getSubjectIDs() {
+        return subjectIDs;
+    }
+
+    public void setSubjectIDs(String[] subjectIDs) {
+        this.subjectIDs = subjectIDs;
+    }
+
+    public Long getCourseScheduleID() {
+        return courseScheduleID;
+    }
+
+    public void setCourseScheduleID(Long courseScheduleID) {
+        this.courseScheduleID = courseScheduleID;
+    }
+}

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/service/TeacherAttendanceService.java

@@ -2,6 +2,7 @@ package com.ym.mec.web.service;
 
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import com.ym.mec.web.dal.dto.TeacherSignOutDto;
 import com.ym.mec.web.dal.entity.TeacherAttendance;
 import com.ym.mec.web.dal.page.TeacherAttendanceQueryInfo;
 
@@ -12,7 +13,7 @@ public interface TeacherAttendanceService extends BaseService<Long, TeacherAtten
      * @Date: 2019/9/10
      * 添加教师签到记录
      */
-    void addTeacherAttendanceRecord(TeacherAttendance teacherAttendance);
+    void addTeacherAttendanceRecord(TeacherSignOutDto teacherSignOutDto);
 
     /**
      * 获取教师个人的签到记录

+ 12 - 1
mec-web/src/main/java/com/ym/mec/web/service/impl/CourseHomeworkTemplateServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ym.mec.web.service.impl;
 
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.web.dal.page.CourseHomeWorkTemplateQueryInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -19,5 +22,13 @@ public class CourseHomeworkTemplateServiceImpl extends BaseServiceImpl<Integer,
 	public BaseDAO<Integer, CourseHomeworkTemplate> getDAO() {
 		return courseHomeworkTemplateDao;
 	}
-	
+
+	@Override
+	public PageInfo<CourseHomeworkTemplate> queryPage(QueryInfo queryInfo) {
+		CourseHomeWorkTemplateQueryInfo templateQueryInfo= (CourseHomeWorkTemplateQueryInfo) queryInfo;
+		if(null!=templateQueryInfo.getCourseScheduleID()){
+			templateQueryInfo.setSubjectIDs(courseHomeworkTemplateDao.getSubjectIDs(templateQueryInfo.getCourseScheduleID()).split(","));
+		}
+		return super.queryPage(templateQueryInfo);
+	}
 }

+ 16 - 2
mec-web/src/main/java/com/ym/mec/web/service/impl/TeacherAttendanceServiceImpl.java

@@ -8,15 +8,19 @@ import com.ym.mec.web.dal.dao.CourseScheduleDao;
 import com.ym.mec.web.dal.dao.TeacherAttendanceDao;
 import com.ym.mec.web.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.web.dal.dto.TeacherPersonalAttendanceDto;
+import com.ym.mec.web.dal.dto.TeacherSignOutDto;
+import com.ym.mec.web.dal.entity.CourseHomework;
 import com.ym.mec.web.dal.entity.CourseSchedule;
 import com.ym.mec.web.dal.entity.TeacherAttendance;
 import com.ym.mec.web.dal.enums.CourseStatusEnum;
 import com.ym.mec.web.dal.enums.ParamEnum;
 import com.ym.mec.web.dal.enums.SignStatusEnum;
 import com.ym.mec.web.dal.page.TeacherAttendanceQueryInfo;
+import com.ym.mec.web.service.CourseHomeworkService;
 import com.ym.mec.web.service.TeacherAttendanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -29,14 +33,18 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 	private TeacherAttendanceDao teacherAttendanceDao;
 	@Autowired
 	private CourseScheduleDao courseScheduleDao;
+	@Autowired
+	private CourseHomeworkService courseHomeworkService;
 
 	@Override
 	public BaseDAO<Long, TeacherAttendance> getDAO() {
 		return teacherAttendanceDao;
 	}
 
+	@Transactional(rollbackFor = Exception.class)
 	@Override
-	public void addTeacherAttendanceRecord(TeacherAttendance teacherAttendance) {
+	public void addTeacherAttendanceRecord(TeacherSignOutDto teacherSignOutDto) {
+		TeacherAttendance teacherAttendance=teacherSignOutDto.getTeacherAttendanceInfo();
 		CourseSchedule courseSchedule=new CourseSchedule();
 		TeacherAttendanceDto currentCourseDetail = courseScheduleDao.getCurrentCourseDetail(teacherAttendance.getCourseScheduleId());
 		courseSchedule.setId(currentCourseDetail.getCourseScheduleId());
@@ -64,11 +72,17 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		}
 		courseScheduleDao.update(courseSchedule);
 		teacherAttendance.setMusicGroupId(currentCourseDetail.getMusicGroupId());
-		teacherAttendance.setSubjectId(currentCourseDetail.getSubjectId());
 		teacherAttendance.setClassGroupId(currentCourseDetail.getClassId());
 		teacherAttendance.setSignInTime(date);
 		teacherAttendance.setCreateTime(date);
 		teacherAttendanceDao.insert(teacherAttendance);
+		if(teacherAttendance.getStatus()==SignStatusEnum.YES_QUIT){
+			CourseHomework courseHomework=teacherSignOutDto.getCourseHomeworkInfo();
+			courseHomework.setCourseScheduleId(teacherAttendance.getCourseScheduleId());
+			courseHomework.setMusicGroupId(currentCourseDetail.getMusicGroupId().intValue());
+			courseHomework.setClassGroupId(currentCourseDetail.getClassId().intValue());
+			courseHomeworkService.insert(courseHomework);
+		}
 	}
 
 	@Override

+ 4 - 4
mec-web/src/main/resources/config/mybatis/CourseHomeworkMapper.xml

@@ -9,7 +9,7 @@
 	<resultMap type="com.ym.mec.web.dal.entity.CourseHomework" id="CourseHomework">
 		<result column="id_" property="id" />
 		<result column="course_schedule_id_" property="courseScheduleId" />
-		<result column="images_" property="images" />
+		<result column="attachments_" property="attachments" />
 		<result column="content_" property="content" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
@@ -34,14 +34,14 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO course_homework (id_,course_schedule_id_,images_,content_,create_time_,update_time_,music_group_id_,class_group_id_) VALUES(#{id},#{courseScheduleId},#{images},#{content},#{createTime},#{updateTime},#{musicGroupId},#{classGroupId})
+		INSERT INTO course_homework (id_,course_schedule_id_,attachments_,content_,create_time_,update_time_,music_group_id_,class_group_id_) VALUES(#{id},#{courseScheduleId},#{attachments},#{content},now(),now(),#{musicGroupId},#{classGroupId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.web.dal.entity.CourseHomework">
 		UPDATE course_homework <set>
-<if test="images != null">
-images_ = #{images},
+<if test="attachments != null">
+	attachments_ = #{attachments},
 </if>
 <if test="id != null">
 id_ = #{id},

+ 29 - 5
mec-web/src/main/resources/config/mybatis/CourseHomeworkTemplateMapper.xml

@@ -10,10 +10,10 @@
 		<result column="id_" property="id" />
 		<result column="name_" property="name" />
 		<result column="content_" property="content" />
-		<result column="del_flag_" property="delFlag" />
+		<result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
-		<result column="class_group_type_" property="classGroupType" />
+		<result column="class_group_type_" property="classGroupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
 		<result column="subject_id_" property="subjectId" />
 	</resultMap>
 	
@@ -34,7 +34,7 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO course_homework_template (id_,name_,content_,del_flag_,create_time_,update_time_,class_group_type_,subject_id_) VALUES(#{id},#{name},#{content},#{delFlag},#{createTime},#{updateTime},#{classGroupType},#{subjectId})
+		INSERT INTO course_homework_template (id_,name_,content_,del_flag_,create_time_,update_time_,class_group_type_,subject_id_) VALUES(#{id},#{name},#{content},#{delFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subjectId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -50,7 +50,7 @@ subject_id_ = #{subjectId},
 id_ = #{id},
 </if>
 <if test="updateTime != null">
-update_time_ = #{updateTime},
+update_time_ = now(),
 </if>
 <if test="content != null">
 content_ = #{content},
@@ -71,14 +71,38 @@ create_time_ = #{createTime},
 	<delete id="delete" >
 		DELETE FROM course_homework_template WHERE id_ = #{id} 
 	</delete>
+
+	<sql id="queryCondition">
+		<where>
+			<if test="subjectIDs != null">
+				and subject_id_ IN
+				<foreach collection="subjectIDs" item="subjectID" open="(" close=")" separator=",">
+					#{subjectID}
+				</foreach>
+			</if>
+		</where>
+	</sql>
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseHomeworkTemplate" parameterType="map">
-		SELECT * FROM course_homework_template ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM course_homework_template
+		<include refid="queryCondition"/>
+		ORDER BY id_
+		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM course_homework_template
 	</select>
+
+	<select id="getSubjectIDs" resultType="java.lang.String">
+		SELECT
+			cg.subject_id_list_
+		FROM
+			course_schedule cs
+		LEFT JOIN class_group cg ON cs.class_group_id_=cg.id_
+		WHERE cs.id_=#{courseScheduleID}
+	</select>
+
 </mapper>

+ 0 - 2
mec-web/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -135,7 +135,6 @@
         <result property="endClassTime" column="end_class_time_"/>
         <result property="courseStatus" column="course_status_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="classId" column="class_id"/>
-        <result property="subjectId" column="subject_id_"/>
         <result property="className" column="class_name"/>
         <result property="classType" column="class_type"/>
         <result property="musicGroupId" column="music_group_id"/>
@@ -154,7 +153,6 @@
             cs.end_class_time_,
             cs.status_ course_status_,
             cg.id_ class_id,
-            cg.subject_id_,
             cg.name_ class_name,
             cg.type_ class_type,
             mg.id_ music_group_id,

+ 4 - 8
mec-web/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -9,7 +9,6 @@
     <resultMap type="com.ym.mec.web.dal.entity.StudentAttendance" id="StudentAttendance">
         <result column="id_" property="id"/>
         <result column="music_group_id_" property="musicGroupId"/>
-        <result column="subject_id_" property="subjectId"/>
         <result column="class_group_id_" property="classGroupId"/>
         <result column="course_schedule_id_" property="courseScheduleId"/>
         <result column="user_id_" property="userId"/>
@@ -38,15 +37,15 @@
         </selectKey>
         -->
         INSERT INTO student_attendance
-        (id_,music_group_id_,subject_id_,class_group_id_,course_schedule_id_,user_id_,teacher_id_,status_,create_time_,remark_)
-        VALUES(#{id},#{musicGroupId},#{subjectId},#{classGroupId},#{courseScheduleId},#{userId},#{teacherId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{remark})
+        (id_,music_group_id_,class_group_id_,course_schedule_id_,user_id_,teacher_id_,status_,create_time_,remark_)
+        VALUES(#{id},#{musicGroupId},#{classGroupId},#{courseScheduleId},#{userId},#{teacherId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{remark})
     </insert>
 
     <insert id="addStudentAttendances" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
-      INSERT INTO student_attendance ( music_group_id_, subject_id_, class_group_id_, course_schedule_id_, user_id_, teacher_id_, status_, create_time_, remark_ )
+      INSERT INTO student_attendance ( music_group_id_, class_group_id_, course_schedule_id_, user_id_, teacher_id_, status_, create_time_, remark_ )
       VALUES
 	  <foreach collection="list" item="studentAttendance" separator=",">
-          (#{studentAttendance.musicGroupId},#{studentAttendance.subjectId},#{studentAttendance.classGroupId},#{studentAttendance.courseScheduleId},#{studentAttendance.userId},#{studentAttendance.teacherId},#{studentAttendance.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{studentAttendance.remark})
+          (#{studentAttendance.musicGroupId},#{studentAttendance.classGroupId},#{studentAttendance.courseScheduleId},#{studentAttendance.userId},#{studentAttendance.teacherId},#{studentAttendance.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{studentAttendance.remark})
       </foreach>
     </insert>
 
@@ -54,9 +53,6 @@
     <update id="update" parameterType="com.ym.mec.web.dal.entity.StudentAttendance">
         UPDATE student_attendance
         <set>
-            <if test="subjectId != null">
-                subject_id_ = #{subjectId},
-            </if>
             <if test="status != null">
                 status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>

+ 3 - 6
mec-web/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -10,7 +10,6 @@
         <result column="id_" property="id"/>
         <result column="teacher_id_" property="teacherId"/>
         <result column="music_group_id_" property="musicGroupId"/>
-        <result column="subject_id_" property="subjectId"/>
         <result column="class_group_id_" property="classGroupId"/>
         <result column="course_schedule_id_" property="courseScheduleId"/>
         <result column="sign_in_time_" property="signInTime"/>
@@ -38,17 +37,14 @@
         </selectKey>
         -->
         INSERT INTO teacher_attendance
-        (id_,teacher_id_,music_group_id_,subject_id_,class_group_id_,course_schedule_id_,sign_in_time_,status_,remark_,create_time_)
-        VALUES(#{id},#{teacherId},#{musicGroupId},#{subjectId},#{classGroupId},#{courseScheduleId},#{signInTime},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{remark},now())
+        (id_,teacher_id_,music_group_id_,class_group_id_,course_schedule_id_,sign_in_time_,status_,remark_,create_time_)
+        VALUES(#{id},#{teacherId},#{musicGroupId},#{classGroupId},#{courseScheduleId},#{signInTime},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{remark},now())
     </insert>
 
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.web.dal.entity.TeacherAttendance">
         UPDATE teacher_attendance
         <set>
-            <if test="subjectId != null">
-                subject_id_ = #{subjectId},
-            </if>
             <if test="status != null">
                 status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -130,6 +126,7 @@
         LEFT JOIN class_group cg ON ta.class_group_id_=cg.id_
         <include refid="queryCondition"/>
         ORDER BY class_date_ DESC
+        <include refid="global.limit"/>
     </select>
 
     <select id="getTeacherPersonalAttendancesCount" resultType="int">