开课班级展示、新增开课班级、未开课班级下拉框、查看开课学生名单

main
@t2652009480 8 months ago
parent b4ceb5c865
commit 6977042cc8

@ -1,15 +1,21 @@
package com.sztzjy.trade.controller.tch;
import cn.hutool.core.date.DateTime;
import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.TchStartCourseManage;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.service.TchTeachingManagementService;
import com.sztzjy.trade.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.HttpStatus;
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 javax.annotation.Resource;
import java.util.List;
/**
@ -20,6 +26,50 @@ import java.util.List;
@RequestMapping("api/tch/teachingManagement")
@RestController
public class TchTeachingManagementController {
@Resource
TchTeachingManagementService teachingManagementService;
@ApiOperation("开课班级展示")
@PostMapping("/getStartCourseList")
@AnonymousAccess
public ResultEntity getStartCourseList(String userId) {
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.getStartCourseList(userId));
}
@ApiOperation("新增开课班级--下拉框查看")
@PostMapping("/getSelect")
@AnonymousAccess
public ResultEntity getSelect(String userId,String schoolId) {
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.getSelect(userId,schoolId));
}
@ApiOperation("新增开课班级")
@PostMapping("/addStartCourseList")
@AnonymousAccess
public ResultEntity addStartCourse(@RequestBody TchStartCourseDTO dto) {
Integer result=teachingManagementService.addStartCourse(dto);
if(result>0){
return new ResultEntity<>(HttpStatus.OK,"新增成功");
}else {
return new ResultEntity<>(HttpStatus.OK,"新增失败");
}
}
@ApiOperation("开课学生名单--查看")
@PostMapping("/getStartCourseNameList")
@AnonymousAccess
public ResultEntity getStartCourseNameList(@ApiParam("开课ID") String startCourseId,
@ApiParam("当前页") Integer index,
@ApiParam("每页条数") Integer size) {
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.getStartCourseNameList(startCourseId,index,size));
}
}

@ -2,7 +2,10 @@ package com.sztzjy.trade.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
* @author whb
@ -15,18 +18,26 @@ public class TchStartCourseManage {
@ApiModelProperty("开课班级名称(多个班级逗号隔开)")
private String startCourseClassName;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@ApiModelProperty("开课起始时间")
private Date startCourseStartingTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@ApiModelProperty("开课结束时间")
private Date startCourseEndTime;
@ApiModelProperty("开课人数")
private Integer startCoursePeoples;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty("更新时间")
private Date updateTime;

@ -0,0 +1,97 @@
package com.sztzjy.trade.entity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @author whb
* tch_start_course_name_list
*/
public class TchStartCourseNameList {
@ApiModelProperty("开课学生名单ID")
private String id;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("学号")
private String studentId;
@ApiModelProperty("班级名称")
private String className;
@ApiModelProperty("专业")
private String major;
@ApiModelProperty("开课ID")
private String startCourseId;
private Date createTime;
private Date updateTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getStudentId() {
return studentId;
}
public void setStudentId(String studentId) {
this.studentId = studentId == null ? null : studentId.trim();
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className == null ? null : className.trim();
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major == null ? null : major.trim();
}
public String getStartCourseId() {
return startCourseId;
}
public void setStartCourseId(String startCourseId) {
this.startCourseId = startCourseId == null ? null : startCourseId.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

@ -0,0 +1,740 @@
package com.sztzjy.trade.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TchStartCourseNameListExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TchStartCourseNameListExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andStudentIdIsNull() {
addCriterion("student_id is null");
return (Criteria) this;
}
public Criteria andStudentIdIsNotNull() {
addCriterion("student_id is not null");
return (Criteria) this;
}
public Criteria andStudentIdEqualTo(String value) {
addCriterion("student_id =", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdNotEqualTo(String value) {
addCriterion("student_id <>", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdGreaterThan(String value) {
addCriterion("student_id >", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdGreaterThanOrEqualTo(String value) {
addCriterion("student_id >=", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdLessThan(String value) {
addCriterion("student_id <", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdLessThanOrEqualTo(String value) {
addCriterion("student_id <=", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdLike(String value) {
addCriterion("student_id like", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdNotLike(String value) {
addCriterion("student_id not like", value, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdIn(List<String> values) {
addCriterion("student_id in", values, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdNotIn(List<String> values) {
addCriterion("student_id not in", values, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdBetween(String value1, String value2) {
addCriterion("student_id between", value1, value2, "studentId");
return (Criteria) this;
}
public Criteria andStudentIdNotBetween(String value1, String value2) {
addCriterion("student_id not between", value1, value2, "studentId");
return (Criteria) this;
}
public Criteria andClassNameIsNull() {
addCriterion("class_name is null");
return (Criteria) this;
}
public Criteria andClassNameIsNotNull() {
addCriterion("class_name is not null");
return (Criteria) this;
}
public Criteria andClassNameEqualTo(String value) {
addCriterion("class_name =", value, "className");
return (Criteria) this;
}
public Criteria andClassNameNotEqualTo(String value) {
addCriterion("class_name <>", value, "className");
return (Criteria) this;
}
public Criteria andClassNameGreaterThan(String value) {
addCriterion("class_name >", value, "className");
return (Criteria) this;
}
public Criteria andClassNameGreaterThanOrEqualTo(String value) {
addCriterion("class_name >=", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLessThan(String value) {
addCriterion("class_name <", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLessThanOrEqualTo(String value) {
addCriterion("class_name <=", value, "className");
return (Criteria) this;
}
public Criteria andClassNameLike(String value) {
addCriterion("class_name like", value, "className");
return (Criteria) this;
}
public Criteria andClassNameNotLike(String value) {
addCriterion("class_name not like", value, "className");
return (Criteria) this;
}
public Criteria andClassNameIn(List<String> values) {
addCriterion("class_name in", values, "className");
return (Criteria) this;
}
public Criteria andClassNameNotIn(List<String> values) {
addCriterion("class_name not in", values, "className");
return (Criteria) this;
}
public Criteria andClassNameBetween(String value1, String value2) {
addCriterion("class_name between", value1, value2, "className");
return (Criteria) this;
}
public Criteria andClassNameNotBetween(String value1, String value2) {
addCriterion("class_name not between", value1, value2, "className");
return (Criteria) this;
}
public Criteria andMajorIsNull() {
addCriterion("major is null");
return (Criteria) this;
}
public Criteria andMajorIsNotNull() {
addCriterion("major is not null");
return (Criteria) this;
}
public Criteria andMajorEqualTo(String value) {
addCriterion("major =", value, "major");
return (Criteria) this;
}
public Criteria andMajorNotEqualTo(String value) {
addCriterion("major <>", value, "major");
return (Criteria) this;
}
public Criteria andMajorGreaterThan(String value) {
addCriterion("major >", value, "major");
return (Criteria) this;
}
public Criteria andMajorGreaterThanOrEqualTo(String value) {
addCriterion("major >=", value, "major");
return (Criteria) this;
}
public Criteria andMajorLessThan(String value) {
addCriterion("major <", value, "major");
return (Criteria) this;
}
public Criteria andMajorLessThanOrEqualTo(String value) {
addCriterion("major <=", value, "major");
return (Criteria) this;
}
public Criteria andMajorLike(String value) {
addCriterion("major like", value, "major");
return (Criteria) this;
}
public Criteria andMajorNotLike(String value) {
addCriterion("major not like", value, "major");
return (Criteria) this;
}
public Criteria andMajorIn(List<String> values) {
addCriterion("major in", values, "major");
return (Criteria) this;
}
public Criteria andMajorNotIn(List<String> values) {
addCriterion("major not in", values, "major");
return (Criteria) this;
}
public Criteria andMajorBetween(String value1, String value2) {
addCriterion("major between", value1, value2, "major");
return (Criteria) this;
}
public Criteria andMajorNotBetween(String value1, String value2) {
addCriterion("major not between", value1, value2, "major");
return (Criteria) this;
}
public Criteria andStartCourseIdIsNull() {
addCriterion("start_course_id is null");
return (Criteria) this;
}
public Criteria andStartCourseIdIsNotNull() {
addCriterion("start_course_id is not null");
return (Criteria) this;
}
public Criteria andStartCourseIdEqualTo(String value) {
addCriterion("start_course_id =", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdNotEqualTo(String value) {
addCriterion("start_course_id <>", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdGreaterThan(String value) {
addCriterion("start_course_id >", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdGreaterThanOrEqualTo(String value) {
addCriterion("start_course_id >=", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdLessThan(String value) {
addCriterion("start_course_id <", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdLessThanOrEqualTo(String value) {
addCriterion("start_course_id <=", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdLike(String value) {
addCriterion("start_course_id like", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdNotLike(String value) {
addCriterion("start_course_id not like", value, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdIn(List<String> values) {
addCriterion("start_course_id in", values, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdNotIn(List<String> values) {
addCriterion("start_course_id not in", values, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdBetween(String value1, String value2) {
addCriterion("start_course_id between", value1, value2, "startCourseId");
return (Criteria) this;
}
public Criteria andStartCourseIdNotBetween(String value1, String value2) {
addCriterion("start_course_id not between", value1, value2, "startCourseId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,26 @@
package com.sztzjy.trade.entity.dto.tch;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author tz
* @date 2024/8/1 14:06
*/
@Data
public class TchStartCourseDTO {
@ApiModelProperty("用户ID")
private String userId;
@ApiModelProperty("开课班级名称集合")
private List<String> startCourseName;
@ApiModelProperty("起始时间")
private String startingTime;
@ApiModelProperty("结束时间")
private String endTime;
}

@ -0,0 +1,20 @@
package com.sztzjy.trade.entity.dto.tch;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author tz
* @date 2024/8/1 14:38
*/
@Data
public class TchStartCourseNameListDTO {
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("学号")
private String studentId;
@ApiModelProperty("班级名称")
private String className;
@ApiModelProperty("专业")
private String major;
}

@ -29,4 +29,12 @@ public interface StuUserMapper {
int updateByPrimaryKeySelective(StuUser record);
int updateByPrimaryKey(StuUser record);
List<StuUser> getStartCourseNameList(@Param("classNames")List<String> classNames);
List<StuUser> selectByCourseName(String startCourseName);
List<String> selectByClassName(String schoolId);
List<String> selectByNoClassName(@Param("strings") List<String> strings,String schoolId);
}

@ -0,0 +1,20 @@
package com.sztzjy.trade.mapper;
import com.sztzjy.trade.entity.StuUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author tz
* @date 2024/8/1 14:22
*/
@Mapper
public interface TchClassAndStuMapper {
List<StuUser> getClassNameByPeoples(String startCourseName);
}

@ -0,0 +1,35 @@
package com.sztzjy.trade.mapper;
import com.sztzjy.trade.entity.TchStartCourseNameList;
import com.sztzjy.trade.entity.TchStartCourseNameListExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TchStartCourseNameListMapper {
long countByExample(TchStartCourseNameListExample example);
int deleteByExample(TchStartCourseNameListExample example);
int deleteByPrimaryKey(String id);
int insert(TchStartCourseNameList record);
int insertSelective(TchStartCourseNameList record);
List<TchStartCourseNameList> selectByExample(TchStartCourseNameListExample example);
TchStartCourseNameList selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TchStartCourseNameList record, @Param("example") TchStartCourseNameListExample example);
int updateByExample(@Param("record") TchStartCourseNameList record, @Param("example") TchStartCourseNameListExample example);
int updateByPrimaryKeySelective(TchStartCourseNameList record);
int updateByPrimaryKey(TchStartCourseNameList record);
int addList(@Param("courseNameLists")List<TchStartCourseNameList> courseNameLists);
}

@ -0,0 +1,22 @@
package com.sztzjy.trade.service;
import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.entity.TchStartCourseManage;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO;
import java.util.List;
/**
* @author tz
* @date 2024/8/1 13:36
*/
public interface TchTeachingManagementService {
List<TchStartCourseManage> getStartCourseList(String userId);
Integer addStartCourse(TchStartCourseDTO dto);
PageInfo<TchStartCourseNameListDTO> getStartCourseNameList(String startCourseId, Integer index, Integer size);
List<String> getSelect(String userId,String schoolId);
}

@ -0,0 +1,183 @@
package com.sztzjy.trade.service.impl;
import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO;
import com.sztzjy.trade.mapper.StuUserMapper;
import com.sztzjy.trade.mapper.TchClassAndStuMapper;
import com.sztzjy.trade.mapper.TchStartCourseManageMapper;
import com.sztzjy.trade.mapper.TchStartCourseNameListMapper;
import com.sztzjy.trade.service.TchTeachingManagementService;
import com.sztzjy.trade.util.ConvertUtil;
import com.sztzjy.trade.util.PageUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Date;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
* @author tz
* @date 2024/8/1 13:36
*/
@Service
public class TchTeachingManagementServiceImpl implements TchTeachingManagementService {
@Resource
TchStartCourseManageMapper startCourseManageMapper;
@Resource
TchClassAndStuMapper classAndStuMapper;
@Resource
StuUserMapper stuUserMapper;
@Resource
ConvertUtil convertUtil;
@Resource
TchStartCourseNameListMapper courseNameListMapper;
/**
*
*/
@Override
public List<TchStartCourseManage> getStartCourseList(String userId) {
TchStartCourseManageExample startCourseManageExample=new TchStartCourseManageExample();
startCourseManageExample.createCriteria().andUserIdEqualTo(userId);
return startCourseManageMapper.selectByExample(startCourseManageExample);
}
/**
*
*/
@Override
public Integer addStartCourse(TchStartCourseDTO dto) {
//根据班级名称查询班级人数再累加,最后添加
TchStartCourseManage startCourseManage=new TchStartCourseManage();
String string = UUID.randomUUID().toString();
startCourseManage.setStartCourseId(string);
String className="";
int classPeoples=0;
int a=0;
for (int i = 0; i < dto.getStartCourseName().size(); i++) {
//取到班级名称
String startCourseName = dto.getStartCourseName().get(i);
//查询班级人数
List<StuUser> stuUsers=stuUserMapper.selectByCourseName(startCourseName);
//添加到开课学生名单中
List<TchStartCourseNameList> courseNameLists=new ArrayList<>();
for (StuUser stu : stuUsers) {
TchStartCourseNameList courseNameList=new TchStartCourseNameList();
courseNameList.setId(UUID.randomUUID().toString());
courseNameList.setName(stu.getName());
courseNameList.setStudentId(stu.getStudentId());
courseNameList.setClassName(stu.getClassName());
courseNameList.setMajor(stu.getMajor());
courseNameList.setStartCourseId(string);
courseNameList.setCreateTime(new java.util.Date());
courseNameLists.add(courseNameList);
}
courseNameListMapper.addList(courseNameLists);
classPeoples=classPeoples+stuUsers.size();
if (i==dto.getStartCourseName().size()-1){
className=className+startCourseName;
}else {
className=className+startCourseName+",";
}
}
startCourseManage.setStartCourseClassName(className);
startCourseManage.setUserId(dto.getUserId());
startCourseManage.setStartCoursePeoples(classPeoples);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//转为时间格式
LocalDate startingTime = LocalDate.parse(dto.getStartingTime(), formatter);
LocalDate endTime = LocalDate.parse(dto.getEndTime(), formatter);
startCourseManage.setStartCourseStartingTime(Date.valueOf(startingTime));
startCourseManage.setStartCourseEndTime(Date.valueOf(endTime));
startCourseManage.setCreateTime(new java.util.Date());
return startCourseManageMapper.insert(startCourseManage);
}
/**
* --
*/
@Override
public PageInfo getStartCourseNameList(String startCourseId, Integer index, Integer size) {
// //去掉逗号得到班级名称数组
// String[] split = startCourseNames.split(",");
//
// //将数组转为集合
// List<String> classNames = new ArrayList<>(Arrays.asList(split));
//
// //构建动态sql查询学生信息
// List<StuUser> stuUsers = stuUserMapper.getStartCourseNameList(classNames);
// List<TchStartCourseNameListDTO> tchStartCourseNameListDTOS = convertUtil.entityToDTOList(stuUsers, TchStartCourseNameListDTO.class);
TchStartCourseNameListExample example=new TchStartCourseNameListExample();
example.createCriteria().andStartCourseIdEqualTo(startCourseId);
List<TchStartCourseNameList> tchStartCourseNameLists = courseNameListMapper.selectByExample(example);
return PageUtil.pageHelper(tchStartCourseNameLists, index, size);
}
@Override
public List<String> getSelect(String userId,String schoolId) {
TchStartCourseManageExample courseManageExample=new TchStartCourseManageExample();
courseManageExample.createCriteria().andUserIdEqualTo(userId);
List<TchStartCourseManage> startCourseManages = startCourseManageMapper.selectByExample(courseManageExample);
if(startCourseManages.isEmpty()){
//直接返回所有班级名称
return stuUserMapper.selectByClassName(schoolId);
}else {
List<String> strings=new ArrayList<>();
for (TchStartCourseManage courseManage : startCourseManages) {
//取到开课班级名称
String[] split = courseManage.getStartCourseClassName().split(",");
strings.addAll(Arrays.asList(split));
}
//再用动态sql查询出本次开课未添加的班级名称
List<String> list = stuUserMapper.selectByNoClassName(strings,schoolId);
return list;
}
}
}

@ -348,7 +348,7 @@
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<update id="updateByExampleSelective" parameterType="map">
update stu_user
<set>
<if test="record.userId != null">
@ -608,4 +608,30 @@
total_score = #{totalScore,jdbcType=DECIMAL}
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<select id="getStartCourseNameList" resultType="com.sztzjy.trade.entity.StuUser" resultMap="BaseResultMap">
SELECT * FROM stu_user
<where>
<!-- 使用foreach标签遍历传入的className列表 -->
<foreach item="className" collection="classNames" separator="OR">
class_name = #{className}
</foreach>
</where>
</select>
<select id="selectByCourseName" resultType="com.sztzjy.trade.entity.StuUser" resultMap="BaseResultMap">
SELECT * FROM `stu_user` WHERE class_name=#{startCourseName}
</select>
<select id="selectByClassName" resultType="java.lang.String" resultMap="BaseResultMap">
select DISTINCT(class_name) from stu_user where school_id=#{schoolId} and class_name!=null
</select>
<select id="selectByNoClassName" resultType="java.lang.String">
select DISTINCT(class_name) from stu_user
<where>
school_id=#{schoolId} and
<foreach collection="strings" item="string" separator="and">
class_name!=#{string}
</foreach>
</where>
</select>
</mapper>

@ -0,0 +1,9 @@
<?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.sztzjy.trade.mapper.TchClassAndStuMapper">
<select id="getClassNameByPeoples" resultType="com.sztzjy.trade.entity.StuUser">
SELECT * FROM `stu_user` WHERE class_name=#{startCourseName}
</select>
</mapper>

@ -0,0 +1,266 @@
<?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.sztzjy.trade.mapper.TchStartCourseNameListMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.trade.entity.TchStartCourseNameList">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="student_id" jdbcType="VARCHAR" property="studentId" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
<result column="major" jdbcType="VARCHAR" property="major" />
<result column="start_course_id" jdbcType="VARCHAR" property="startCourseId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, name, student_id, class_name, major, start_course_id, create_time, update_time
</sql>
<select id="selectByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from tch_start_course_name_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tch_start_course_name_list
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tch_start_course_name_list
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample">
delete from tch_start_course_name_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
insert into tch_start_course_name_list (id, name, student_id,
class_name, major, start_course_id,
create_time, update_time)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR},
#{className,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{startCourseId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
insert into tch_start_course_name_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="studentId != null">
student_id,
</if>
<if test="className != null">
class_name,
</if>
<if test="major != null">
major,
</if>
<if test="startCourseId != null">
start_course_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
#{studentId,jdbcType=VARCHAR},
</if>
<if test="className != null">
#{className,jdbcType=VARCHAR},
</if>
<if test="major != null">
#{major,jdbcType=VARCHAR},
</if>
<if test="startCourseId != null">
#{startCourseId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultType="java.lang.Long">
select count(*) from tch_start_course_name_list
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update tch_start_course_name_list
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.studentId != null">
student_id = #{record.studentId,jdbcType=VARCHAR},
</if>
<if test="record.className != null">
class_name = #{record.className,jdbcType=VARCHAR},
</if>
<if test="record.major != null">
major = #{record.major,jdbcType=VARCHAR},
</if>
<if test="record.startCourseId != null">
start_course_id = #{record.startCourseId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update tch_start_course_name_list
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
student_id = #{record.studentId,jdbcType=VARCHAR},
class_name = #{record.className,jdbcType=VARCHAR},
major = #{record.major,jdbcType=VARCHAR},
start_course_id = #{record.startCourseId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
update tch_start_course_name_list
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="studentId != null">
student_id = #{studentId,jdbcType=VARCHAR},
</if>
<if test="className != null">
class_name = #{className,jdbcType=VARCHAR},
</if>
<if test="major != null">
major = #{major,jdbcType=VARCHAR},
</if>
<if test="startCourseId != null">
start_course_id = #{startCourseId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
update tch_start_course_name_list
set name = #{name,jdbcType=VARCHAR},
student_id = #{studentId,jdbcType=VARCHAR},
class_name = #{className,jdbcType=VARCHAR},
major = #{major,jdbcType=VARCHAR},
start_course_id = #{startCourseId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="addList" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
INSERT INTO tch_start_course_name_list (id, name, student_id, class_name, major, start_course_id, create_time)
VALUES
<foreach collection="courseNameLists" item="courseNameList" separator=",">
(#{courseNameList.id}, #{courseNameList.name}, #{courseNameList.studentId}, #{courseNameList.className}, #{courseNameList.major}, #{courseNameList.startCourseId}, #{courseNameList.createTime})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save