添加学生、添加班级、批量导入、批量导入表格下载

main
@t2652009480 8 months ago
parent 6977042cc8
commit 6d7501e7b8

@ -3,19 +3,25 @@ package com.sztzjy.trade.controller.tch;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.sztzjy.trade.annotation.AnonymousAccess; import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.TchStartCourseManage; import com.sztzjy.trade.entity.TchStartCourseManage;
import com.sztzjy.trade.entity.dto.tch.TchAddStuDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO; import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO;
import com.sztzjy.trade.service.TchTeachingManagementService; import com.sztzjy.trade.service.TchTeachingManagementService;
import com.sztzjy.trade.util.ResultEntity; import com.sztzjy.trade.util.ResultEntity;
import com.sztzjy.trade.util.file.IFileUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.util.List; import java.util.List;
/** /**
@ -29,6 +35,12 @@ public class TchTeachingManagementController {
@Resource @Resource
TchTeachingManagementService teachingManagementService; TchTeachingManagementService teachingManagementService;
@Value("${file.path}")
private String filePath;
@Resource
private IFileUtil IFileUtil;
@ApiOperation("开课班级展示") @ApiOperation("开课班级展示")
@PostMapping("/getStartCourseList") @PostMapping("/getStartCourseList")
@AnonymousAccess @AnonymousAccess
@ -72,4 +84,73 @@ public class TchTeachingManagementController {
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.getStartCourseNameList(startCourseId,index,size)); return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.getStartCourseNameList(startCourseId,index,size));
} }
@ApiOperation("开课学生名单--添加学生--回显")
@PostMapping("/addStuEcho")
@AnonymousAccess
public ResultEntity addStuEcho(@ApiParam("开课ID") String startCourseId,
@ApiParam("学校ID") String schoolId,
@ApiParam("当前页") Integer index,
@ApiParam("每页条数") Integer size) {
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.addStuEcho(startCourseId,schoolId,index,size));
}
@ApiOperation("开课学生名单--添加学生")
@PostMapping("/addStu")
@AnonymousAccess
public ResultEntity addStu(@RequestBody TchAddStuDTO dto) {
Integer result=teachingManagementService.addStu(dto);
if(result>0){
return new ResultEntity<>(HttpStatus.OK,"添加成功");
}else {
return new ResultEntity<>(HttpStatus.ACCEPTED,"添加失败,请联系管理处理");
}
}
@ApiOperation("开课学生名单--添加班级")
@PostMapping("/addClass")
@AnonymousAccess
public ResultEntity addClass(List<String> className,String schoolId,String startCourseId) {
Integer result=teachingManagementService.addClass(className,schoolId,startCourseId);
if(result>0){
return new ResultEntity<>(HttpStatus.OK,"添加成功");
}else {
return new ResultEntity<>(HttpStatus.ACCEPTED,"添加失败,请联系管理处理");
}
}
@ApiOperation("开课学生名单--批量导入")
@PostMapping("/batchImport")
@AnonymousAccess
public ResultEntity batchImport(@RequestPart MultipartFile file,
@ApiParam("开课ID")String startCourseId) {
//验证文件类型
if (!file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xls") && !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) {
return new ResultEntity<>(HttpStatus.ACCEPTED, "文件类型有误请上传Excel文件");
}
return new ResultEntity<>(HttpStatus.OK,"成功",teachingManagementService.batchImport(file,startCourseId));
}
@ApiOperation("Excel表格下载")
@GetMapping("/excelDownload")
@AnonymousAccess
public void excelDownload(HttpServletResponse response) {
String path=filePath;
IFileUtil.download(response,path);
}
} }

@ -31,6 +31,9 @@ public class TchStartCourseNameList {
private Date updateTime; private Date updateTime;
@ApiModelProperty("用户ID")
private String userId;
public String getId() { public String getId() {
return id; return id;
} }
@ -94,4 +97,12 @@ public class TchStartCourseNameList {
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
} }

@ -644,6 +644,76 @@ public class TchStartCourseNameListExample {
addCriterion("update_time not between", value1, value2, "updateTime"); addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

@ -0,0 +1,12 @@
package com.sztzjy.trade.entity.dto.tch;
import lombok.Data;
/**
* @author tz
* @date 2024/8/2 10:47
*/
@Data
public class TchAddStuDTO extends TchStartCourseNameListDTO{
private String startCourseId;
}

@ -17,4 +17,6 @@ public class TchStartCourseNameListDTO {
private String className; private String className;
@ApiModelProperty("专业") @ApiModelProperty("专业")
private String major; private String major;
@ApiModelProperty("用户ID")
private String userId;
} }

@ -34,7 +34,27 @@ public interface StuUserMapper {
List<StuUser> selectByCourseName(String startCourseName); List<StuUser> selectByCourseName(String startCourseName);
/**
*
* @param schoolId IDID
* @return
*/
List<String> selectByClassName(String schoolId); List<String> selectByClassName(String schoolId);
/**
*
* @param strings
* @param schoolId ID
* @return
*/
List<String> selectByNoClassName(@Param("strings") List<String> strings,String schoolId); List<String> selectByNoClassName(@Param("strings") List<String> strings,String schoolId);
/**
*
* @param lists
* @param schoolId ID
* @return
*/
List<StuUser> selectStuList(@Param("lists") List<String> lists, String schoolId);
} }

@ -30,6 +30,10 @@ public interface TchStartCourseNameListMapper {
int updateByPrimaryKey(TchStartCourseNameList record); int updateByPrimaryKey(TchStartCourseNameList record);
/**
*
* @param courseNameLists
*/
int addList(@Param("courseNameLists")List<TchStartCourseNameList> courseNameLists); int addList(@Param("courseNameLists")List<TchStartCourseNameList> courseNameLists);
} }

@ -2,8 +2,11 @@ package com.sztzjy.trade.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.entity.TchStartCourseManage; import com.sztzjy.trade.entity.TchStartCourseManage;
import com.sztzjy.trade.entity.TchStartCourseNameList;
import com.sztzjy.trade.entity.dto.tch.TchAddStuDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO; import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO; import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
@ -16,7 +19,15 @@ public interface TchTeachingManagementService {
Integer addStartCourse(TchStartCourseDTO dto); Integer addStartCourse(TchStartCourseDTO dto);
PageInfo<TchStartCourseNameListDTO> getStartCourseNameList(String startCourseId, Integer index, Integer size); PageInfo<TchStartCourseNameList> getStartCourseNameList(String startCourseId, Integer index, Integer size);
List<String> getSelect(String userId,String schoolId); List<String> getSelect(String userId,String schoolId);
PageInfo<TchStartCourseNameListDTO> addStuEcho(String startCourseId, String schoolId, Integer index, Integer size);
Integer addStu(TchAddStuDTO dto);
Integer addClass(List<String> className,String schoolId,String startCourseId);
Integer batchImport(MultipartFile file,String startCourseId);
} }

@ -1,7 +1,9 @@
package com.sztzjy.trade.service.impl; package com.sztzjy.trade.service.impl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.config.exception.handler.ServiceException;
import com.sztzjy.trade.entity.*; import com.sztzjy.trade.entity.*;
import com.sztzjy.trade.entity.dto.tch.TchAddStuDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO; import com.sztzjy.trade.entity.dto.tch.TchStartCourseDTO;
import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO; import com.sztzjy.trade.entity.dto.tch.TchStartCourseNameListDTO;
import com.sztzjy.trade.mapper.StuUserMapper; import com.sztzjy.trade.mapper.StuUserMapper;
@ -9,12 +11,19 @@ import com.sztzjy.trade.mapper.TchClassAndStuMapper;
import com.sztzjy.trade.mapper.TchStartCourseManageMapper; import com.sztzjy.trade.mapper.TchStartCourseManageMapper;
import com.sztzjy.trade.mapper.TchStartCourseNameListMapper; import com.sztzjy.trade.mapper.TchStartCourseNameListMapper;
import com.sztzjy.trade.service.TchTeachingManagementService; import com.sztzjy.trade.service.TchTeachingManagementService;
import com.sztzjy.trade.util.BigDecimalUtils;
import com.sztzjy.trade.util.ConvertUtil; import com.sztzjy.trade.util.ConvertUtil;
import com.sztzjy.trade.util.PageUtil; import com.sztzjy.trade.util.PageUtil;
import com.sztzjy.trade.util.excel.ImportExcelUtil;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Date; import java.sql.Date;
import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,6 +50,9 @@ public class TchTeachingManagementServiceImpl implements TchTeachingManagementSe
@Resource @Resource
TchStartCourseNameListMapper courseNameListMapper; TchStartCourseNameListMapper courseNameListMapper;
@Resource
BigDecimalUtils bigDecimalUtils;
/** /**
* *
*/ */
@ -78,9 +90,19 @@ public class TchTeachingManagementServiceImpl implements TchTeachingManagementSe
//查询班级人数 //查询班级人数
List<StuUser> stuUsers=stuUserMapper.selectByCourseName(startCourseName); List<StuUser> stuUsers=stuUserMapper.selectByCourseName(startCourseName);
//添加到开课学生名单中 //1、添加到开课学生名单中
List<TchStartCourseNameList> courseNameLists=new ArrayList<>(); List<TchStartCourseNameList> courseNameLists=new ArrayList<>();
for (StuUser stu : stuUsers) { for (StuUser stu : stuUsers) {
//2、判断该学生是否被单独添加到开课名单是则不做添加
TchStartCourseNameListExample courseNameListExample=new TchStartCourseNameListExample();
courseNameListExample.createCriteria().andUserIdEqualTo(stu.getUserId());
List<TchStartCourseNameList> tchStartCourseNameLists = courseNameListMapper.selectByExample(courseNameListExample);
if(!tchStartCourseNameLists.isEmpty()){
continue; //跳出本次循环
}
TchStartCourseNameList courseNameList=new TchStartCourseNameList(); TchStartCourseNameList courseNameList=new TchStartCourseNameList();
courseNameList.setId(UUID.randomUUID().toString()); courseNameList.setId(UUID.randomUUID().toString());
courseNameList.setName(stu.getName()); courseNameList.setName(stu.getName());
@ -89,6 +111,7 @@ public class TchTeachingManagementServiceImpl implements TchTeachingManagementSe
courseNameList.setMajor(stu.getMajor()); courseNameList.setMajor(stu.getMajor());
courseNameList.setStartCourseId(string); courseNameList.setStartCourseId(string);
courseNameList.setCreateTime(new java.util.Date()); courseNameList.setCreateTime(new java.util.Date());
courseNameList.setUserId(stu.getUserId());
courseNameLists.add(courseNameList); courseNameLists.add(courseNameList);
} }
@ -150,6 +173,9 @@ public class TchTeachingManagementServiceImpl implements TchTeachingManagementSe
} }
/**
* --
*/
@Override @Override
public List<String> getSelect(String userId,String schoolId) { public List<String> getSelect(String userId,String schoolId) {
TchStartCourseManageExample courseManageExample=new TchStartCourseManageExample(); TchStartCourseManageExample courseManageExample=new TchStartCourseManageExample();
@ -172,11 +198,185 @@ public class TchTeachingManagementServiceImpl implements TchTeachingManagementSe
} }
//再用动态sql查询出本次开课未添加的班级名称 //再用动态sql查询出本次开课未添加的班级名称
List<String> list = stuUserMapper.selectByNoClassName(strings,schoolId); return stuUserMapper.selectByNoClassName(strings,schoolId);
return list;
}
}
/**
* ----
*/
@Override
public PageInfo addStuEcho(String startCourseId, String schoolId, Integer index, Integer size) {
//查询出本次开课已添加了的班级,排除这些班级的学生
TchStartCourseManage startCourseManage = startCourseManageMapper.selectByPrimaryKey(startCourseId);
//取得班级名称,去掉逗号得出班级名称集合
String[] split = startCourseManage.getStartCourseClassName().split(",");
List<String> list = new ArrayList<>(Arrays.asList(split));
List<StuUser> stuUsers=stuUserMapper.selectStuList(list,schoolId);
List<TchStartCourseNameListDTO> tchStartCourseNameListDTOS = convertUtil.entityToDTOList(stuUsers, TchStartCourseNameListDTO.class);
return PageUtil.pageHelper(tchStartCourseNameListDTOS, index, size);
}
/**
* --
*/
@Override
public Integer addStu(TchAddStuDTO dto) {
//查询该学生是否已添加过本次开课
TchStartCourseManageExample courseManageExample=new TchStartCourseManageExample();
courseManageExample.createCriteria().andUserIdEqualTo(dto.getUserId());
List<TchStartCourseManage> startCourseManages = startCourseManageMapper.selectByExample(courseManageExample);
if(startCourseManages.isEmpty()){
//赋值
TchStartCourseNameList startCourseNameList=new TchStartCourseNameList();
startCourseNameList.setId(UUID.randomUUID().toString());
startCourseNameList.setName(dto.getName());
startCourseNameList.setStudentId(dto.getStudentId());
startCourseNameList.setClassName(dto.getClassName());
startCourseNameList.setMajor(dto.getMajor());
startCourseNameList.setStartCourseId(dto.getStartCourseId());
startCourseNameList.setUserId(dto.getUserId());
startCourseNameList.setCreateTime(new java.util.Date());
return courseNameListMapper.insert(startCourseNameList);
}else {
throw new ServiceException(HttpStatus.ACCEPTED,"该学生已存在本次开课");
}
}
@Override
public Integer addClass(List<String> className,String schoolId,String startCourseId) {
//根据班级名称集合查询出所有学生信息
List<StuUser> stuUsers=stuUserMapper.selectStuList(className,schoolId);
//查询本次开课信息
TchStartCourseManage startCourseManage = startCourseManageMapper.selectByPrimaryKey(startCourseId);
//取出班级名称
String startCourseClassName = startCourseManage.getStartCourseClassName();
// TODO: 2024/8/2 更新本次开课信息
//1、将开课班级累加到开课班级后逗号隔开
for (int i = 0; i < className.size(); i++) {
if(i==className.size()-1){
startCourseClassName=startCourseClassName+className.get(i);
}else {
startCourseClassName=startCourseClassName+className.get(i)+",";
}
}
//2、将开课总人数累加
BigDecimal add = bigDecimalUtils.add(String.valueOf(startCourseManage.getStartCoursePeoples()), String.valueOf(stuUsers.size()));
startCourseManage.setStartCoursePeoples(Integer.valueOf(add.toString()));
startCourseManage.setUpdateTime(new java.util.Date());
//更新开课信息
startCourseManageMapper.updateByPrimaryKey(startCourseManage);
// TODO: 2024/8/2 将所查询的班级学生信息添加到开课学生名单中
//1、添加到开课学生名单中
List<TchStartCourseNameList> courseNameLists=new ArrayList<>();
for (StuUser stu : stuUsers) {
//2、判断该学生是否被单独添加到开课名单是则不做添加
TchStartCourseNameListExample courseNameListExample=new TchStartCourseNameListExample();
courseNameListExample.createCriteria().andUserIdEqualTo(stu.getUserId());
List<TchStartCourseNameList> tchStartCourseNameLists = courseNameListMapper.selectByExample(courseNameListExample);
if(!tchStartCourseNameLists.isEmpty()){
continue; //跳出本次循环
}
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(startCourseId);
courseNameList.setCreateTime(new java.util.Date());
courseNameList.setUserId(stu.getUserId());
courseNameLists.add(courseNameList);
}
courseNameListMapper.addList(courseNameLists);
return null;
}
/**
*
* @param file
*/
@Override
public Integer batchImport(MultipartFile file,String startCourseId) {
try {
List<TchStartCourseNameList> startCourseNameLists=new ArrayList<>();
//获取数据
List<List<Object>> listByExcel = ImportExcelUtil.getListByExcel(file.getInputStream(), file.getOriginalFilename());
//封装数据
for (int i = 0; i < listByExcel.size(); i++) {
List<Object> list = listByExcel.get(i);
if (list.get(0) == "" || ("序号").equals(list.get(0))) {
continue;
}
//判断该学是否在学生列表里
StuUser stuUser = stuUserMapper.selectByPrimaryKey(String.valueOf(list.get(0)));
if(stuUser==null){
continue;
}
//判断该学生是否已单独添加到开课名单
TchStartCourseNameListExample courseNameListExample=new TchStartCourseNameListExample();
courseNameListExample.createCriteria().andUserIdEqualTo(String.valueOf(list.get(0)));
List<TchStartCourseNameList> tchStartCourseNameLists = courseNameListMapper.selectByExample(courseNameListExample);
if(!tchStartCourseNameLists.isEmpty()){
continue;
}
TchStartCourseNameList tchStartCourseNameList=new TchStartCourseNameList();
tchStartCourseNameList.setId(UUID.randomUUID().toString());
tchStartCourseNameList.setUserId(String.valueOf(list.get(0)));
tchStartCourseNameList.setName(String.valueOf(list.get(1)));
tchStartCourseNameList.setStudentId(String.valueOf(list.get(2)));
tchStartCourseNameList.setClassName(String.valueOf(list.get(3)));
tchStartCourseNameList.setMajor(String.valueOf(list.get(4)));
tchStartCourseNameList.setStartCourseId(startCourseId);
tchStartCourseNameList.setUpdateTime(new java.util.Date());
startCourseNameLists.add(tchStartCourseNameList);
}
return courseNameListMapper.addList(startCourseNameLists);
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
file.getInputStream().close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
return 0;
} }

@ -11,8 +11,8 @@ spring:
# 文件存储 # 文件存储
file: file:
type: local type: local
# path: D:\home\trade path: D:\home\trade
path: D:\home # path: D:\home
# path: /usr/local/tianzeProject/blockFinance/uploadFile # path: /usr/local/tianzeProject/blockFinance/uploadFile

@ -634,4 +634,13 @@
</foreach> </foreach>
</where> </where>
</select> </select>
<select id="selectStuList" resultType="com.sztzjy.trade.entity.StuUser" resultMap="BaseResultMap">
select * from stu_user
<where>
school_id=#{schoolId} and
<foreach collection="lists" item="list" separator="and">
class_name!=#{list}
</foreach>
</where>
</select>
</mapper> </mapper>

@ -10,6 +10,7 @@
<result column="start_course_id" jdbcType="VARCHAR" property="startCourseId" /> <result column="start_course_id" jdbcType="VARCHAR" property="startCourseId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -70,7 +71,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, name, student_id, class_name, major, start_course_id, create_time, update_time id, name, student_id, class_name, major, start_course_id, create_time, update_time,
user_id
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultMap="BaseResultMap">
select select
@ -105,10 +107,12 @@
<insert id="insert" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList"> <insert id="insert" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
insert into tch_start_course_name_list (id, name, student_id, insert into tch_start_course_name_list (id, name, student_id,
class_name, major, start_course_id, class_name, major, start_course_id,
create_time, update_time) create_time, update_time, user_id
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR},
#{className,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{startCourseId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{startCourseId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{userId,jdbcType=VARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList"> <insert id="insertSelective" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList">
insert into tch_start_course_name_list insert into tch_start_course_name_list
@ -137,6 +141,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="userId != null">
user_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -163,9 +170,12 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.sztzjy.trade.entity.TchStartCourseNameListExample" resultType="java.lang.Long">
select count(*) from tch_start_course_name_list select count(*) from tch_start_course_name_list
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
@ -198,6 +208,9 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -212,7 +225,8 @@
major = #{record.major,jdbcType=VARCHAR}, major = #{record.major,jdbcType=VARCHAR},
start_course_id = #{record.startCourseId,jdbcType=VARCHAR}, start_course_id = #{record.startCourseId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP} update_time = #{record.updateTime,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -241,6 +255,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -252,15 +269,16 @@
major = #{major,jdbcType=VARCHAR}, major = #{major,jdbcType=VARCHAR},
start_course_id = #{startCourseId,jdbcType=VARCHAR}, start_course_id = #{startCourseId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP},
user_id = #{userId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="addList" parameterType="com.sztzjy.trade.entity.TchStartCourseNameList"> <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) INSERT INTO tch_start_course_name_list (id, name, student_id, class_name, major, start_course_id, create_time,user_id)
VALUES VALUES
<foreach collection="courseNameLists" item="courseNameList" separator=","> <foreach collection="courseNameLists" item="courseNameList" separator=",">
(#{courseNameList.id}, #{courseNameList.name}, #{courseNameList.studentId}, #{courseNameList.className}, #{courseNameList.major}, #{courseNameList.startCourseId}, #{courseNameList.createTime}) (#{courseNameList.id}, #{courseNameList.name}, #{courseNameList.studentId}, #{courseNameList.className}, #{courseNameList.major}, #{courseNameList.startCourseId}, #{courseNameList.createTime}, #{courseNameList.userId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
Loading…
Cancel
Save