教师端实训操作。代码调整

pull/1/head
陈沅 2 years ago
parent 860680b6be
commit 1dece8a55a

@ -51,8 +51,9 @@ public class IndexController {
@ApiOperation("首页下拉获取实训任务名称")
@AnonymousAccess
public ResultEntity<List<String>> getTrainingName() {
List<String> trainingName = trainingMapper.selectTrainingName();
return new ResultEntity<>(HttpStatus.OK, trainingName);
// List<String> trainingName = trainingMapper.selectTrainingName();
// return new ResultEntity<>(HttpStatus.OK, trainingName);
return new ResultEntity<List<String>>(HttpStatus.OK);
}
//首页下拉获取班级

@ -60,7 +60,7 @@ public class TradingController {
String buySellType = String.valueOf(jsonObject.get("buySellType"));
//获取账户资金 调用member表中的
Integer memberId = (Integer) jsonObject.get("memberId");
Integer trainingId = (Integer) jsonObject.get("trainingId");
String trainingId = jsonObject.get("trainingId").toString();
Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId);
Double availableFunds = member.getAvailableFunds();
if (transactionType.equals("sjkc")) {//市价开仓

@ -0,0 +1,85 @@
package com.sztzjy.forex.trading_trading.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.sztzjy.forex.trading_trading.config.security.JwtUser;
import com.sztzjy.forex.trading_trading.config.security.TokenProvider;
import com.sztzjy.forex.trading_trading.dto.TrainingBO;
import com.sztzjy.forex.trading_trading.entity.Training;
import com.sztzjy.forex.trading_trading.service.TrainingService;
import com.sztzjy.forex.trading_trading.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.w3c.dom.stylesheets.LinkStyle;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Api(tags = "实训管理")
@RestController
@RequestMapping("api/training")
@RequiredArgsConstructor
public class TrainingController {
TrainingService trainingService;
HttpServletRequest request;
@ApiOperation("教师端----新增一条实训记录")
@PostMapping("create")
public ResultEntity create(@RequestBody TrainingBO bo) {
JwtUser currentUser = TokenProvider.getJWTUser(request);
trainingService.create(bo, currentUser);
return new ResultEntity(HttpStatus.OK);
}
@ApiOperation("教师端----删除一条实训记录")
@PostMapping("deleteById")
public ResultEntity deleteById(@ApiParam("实训记录id") @RequestParam Integer trainingId) {
trainingService.delete(trainingId);
return new ResultEntity(HttpStatus.OK);
}
@ApiOperation("教师端----修改一条实训记录")
@PostMapping("update")
public ResultEntity update(@ApiParam("实训记录id") @RequestParam Integer trainingId,
@ApiParam("实训记录名字") @RequestParam String trainingName) {
//TODO 暂时只修改实训名字 待后续需求
trainingService.update(trainingId, trainingName);
return new ResultEntity(HttpStatus.OK);
}
@ApiOperation("教师端----根据实训记录id查询实训记录")
@GetMapping("training/{id}")
public ResultEntity<Training> get(@ApiParam("实训记录id")
@PathVariable Integer id) {
//TODO 后续还有根据实训id查看排行榜等需求待实现
return new ResultEntity<Training>(HttpStatus.OK, trainingService.findById(id));
}
@ApiOperation("教师端----根据条件分页获取实训记录数据")
@GetMapping("findByConditions")
public ResultEntity<PageInfo<Training>> findByConditions(@ApiParam("页码") Integer index,
@ApiParam("页量") Integer size) {
//TODO 待确认需过滤参数
return new ResultEntity<PageInfo<Training>>(HttpStatus.OK, trainingService.pagedListTraining(index, size));
}
@ApiOperation("获取实训下拉框列表")
@GetMapping("findTrainingNameList")
public ResultEntity<List<Map<String,Object>>> findTrainingNameList() {
JwtUser currentUser = TokenProvider.getJWTUser(request);
return new ResultEntity<List<Map<String,Object>>>(HttpStatus.OK, trainingService.findTrainingNameList(currentUser));
}
}

@ -0,0 +1,40 @@
package com.sztzjy.forex.trading_trading.dto;
import cn.hutool.core.util.IdUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Transient;
import java.util.Date;
@Data
@Getter
@Setter
@ApiModel("创建实训入参")
public class TrainingBO {
@ApiModelProperty("实训开始时间")
private Date startTime;
@ApiModelProperty("实训结束时间")
private Date endTime;
@ApiModelProperty("创建人")
private String createBy;
@ApiModelProperty("创建学校")
private String createSchool;
@ApiModelProperty("实训名称")
private String trainingName;
@ApiModelProperty("参加实训人数")
@JsonIgnore
private Integer peopleCount;
}

@ -20,7 +20,7 @@ public class Member {
*
* @mbg.generated Thu Jun 29 11:19:15 CST 2023
*/
private Integer trainingId;
private String trainingId;
/**
*
@ -198,19 +198,11 @@ public class Member {
*
* @mbg.generated Thu Jun 29 11:19:15 CST 2023
*/
public Integer getTrainingId() {
public String getTrainingId() {
return trainingId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_member.training_id
*
* @param trainingId the value for sys_member.training_id
*
* @mbg.generated Thu Jun 29 11:19:15 CST 2023
*/
public void setTrainingId(Integer trainingId) {
public void setTrainingId(String trainingId) {
this.trainingId = trainingId;
}

@ -264,7 +264,7 @@ public class MemberExample {
return (Criteria) this;
}
public Criteria andTrainingIdEqualTo(Integer value) {
public Criteria andTrainingIdEqualTo(String value) {
addCriterion("training_id =", value, "trainingId");
return (Criteria) this;
}

@ -1,8 +1,15 @@
package com.sztzjy.forex.trading_trading.entity;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.IdUtil;
import com.sztzjy.forex.trading_trading.config.security.JwtUser;
import com.sztzjy.forex.trading_trading.dto.TrainingBO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.Assert;
import java.util.Date;
public class Training {
public class Training extends Base {
/**
*
* This field was generated by MyBatis Generator.
@ -10,25 +17,26 @@ public class Training {
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/
private Integer trainingId;
@ApiModelProperty("实训Id")
private String trainingId = IdUtil.simpleUUID();
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.people_count
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
@ApiModelProperty("实训人数")
private Integer peopleCount;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.start_time
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
private String startTime;
@ApiModelProperty("实训开始时间")
private Date startTime;
/**
*
@ -37,53 +45,60 @@ public class Training {
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/
@ApiModelProperty("实训结束时间")
private Date endTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.status
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
@ApiModelProperty("实训状态")
private String status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.create_by
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
private String createBy;
@ApiModelProperty("创建人Id")
private Integer creatorId;
@ApiModelProperty("创建人学校")
private String creatorName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.create_school
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
@ApiModelProperty("创建学校")
private String createSchool;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.training_name
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
@ApiModelProperty("实训名称")
private String trainingName;
@ApiModelProperty("创建人所属学校id")
private Integer createSchoolId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_training.training_id
*
* @return the value of sys_training.training_id
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public Integer getTrainingId() {
public String getTrainingId() {
return trainingId;
}
@ -92,10 +107,9 @@ public class Training {
* This method sets the value of the database column sys_training.training_id
*
* @param trainingId the value for sys_training.training_id
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setTrainingId(Integer trainingId) {
public void setTrainingId(String trainingId) {
this.trainingId = trainingId;
}
@ -104,8 +118,7 @@ public class Training {
* This method returns the value of the database column sys_training.people_count
*
* @return the value of sys_training.people_count
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public Integer getPeopleCount() {
return peopleCount;
@ -116,8 +129,7 @@ public class Training {
* This method sets the value of the database column sys_training.people_count
*
* @param peopleCount the value for sys_training.people_count
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setPeopleCount(Integer peopleCount) {
this.peopleCount = peopleCount;
@ -128,10 +140,9 @@ public class Training {
* This method returns the value of the database column sys_training.start_time
*
* @return the value of sys_training.start_time
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public String getStartTime() {
public Date getStartTime() {
return startTime;
}
@ -140,11 +151,10 @@ public class Training {
* This method sets the value of the database column sys_training.start_time
*
* @param startTime the value for sys_training.start_time
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setStartTime(String startTime) {
this.startTime = startTime == null ? null : startTime.trim();
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
/**
@ -152,8 +162,7 @@ public class Training {
* This method returns the value of the database column sys_training.end_time
*
* @return the value of sys_training.end_time
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public Date getEndTime() {
return endTime;
@ -164,8 +173,7 @@ public class Training {
* This method sets the value of the database column sys_training.end_time
*
* @param endTime the value for sys_training.end_time
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
@ -176,8 +184,7 @@ public class Training {
* This method returns the value of the database column sys_training.status
*
* @return the value of sys_training.status
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public String getStatus() {
return status;
@ -188,35 +195,43 @@ public class Training {
* This method sets the value of the database column sys_training.status
*
* @param status the value for sys_training.status
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Integer getCreatorId() {
return creatorId;
}
public void setCreatorId(Integer creatorId) {
this.creatorId = creatorId;
}
public Integer getCreateSchoolId() {
return createSchoolId;
}
public void setCreateSchoolId(Integer createSchoolId) {
this.createSchoolId = createSchoolId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_training.create_by
*
* @return the value of sys_training.create_by
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public String getCreateBy() {
return createBy;
public String getCreatorName() {
return creatorName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_training.create_by
*
* @param createBy the value for sys_training.create_by
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
/**
@ -224,8 +239,7 @@ public class Training {
* This method returns the value of the database column sys_training.create_school
*
* @return the value of sys_training.create_school
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public String getCreateSchool() {
return createSchool;
@ -236,8 +250,7 @@ public class Training {
* This method sets the value of the database column sys_training.create_school
*
* @param createSchool the value for sys_training.create_school
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setCreateSchool(String createSchool) {
this.createSchool = createSchool == null ? null : createSchool.trim();
@ -248,8 +261,7 @@ public class Training {
* This method returns the value of the database column sys_training.training_name
*
* @return the value of sys_training.training_name
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public String getTrainingName() {
return trainingName;
@ -260,10 +272,35 @@ public class Training {
* This method sets the value of the database column sys_training.training_name
*
* @param trainingName the value for sys_training.training_name
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 16:30:49 CST 2023
*/
public void setTrainingName(String trainingName) {
this.trainingName = trainingName == null ? null : trainingName.trim();
}
public static Training buildTraining(TrainingBO bo, JwtUser currentUser) {
Training training = new Training();
Assert.notNull(bo.getStartTime(), "选择开始日期");
Assert.notNull(bo.getEndTime(), "选择结束日期");
Assert.notNull(bo.getTrainingName(), "填写实训名称");
long startTime = bo.getStartTime().getTime();
long endTime = bo.getEndTime().getTime();
long now = DateTime.now().getTime();
Assert.isTrue(endTime > now, "结束日期必须大于当前日期");
Assert.isTrue(endTime > startTime, "结束日期必须大于开始日期");
training.trainingId = IdUtil.simpleUUID();
training.startTime = bo.getStartTime();
training.endTime = bo.getEndTime();
training.trainingName = bo.getTrainingName();
training.creatorId = Integer.valueOf(currentUser.getUserId());
training.creatorName = currentUser.getName();
training.createSchool = currentUser.getSchoolName();
training.createSchoolId = currentUser.getSchoolId();
training.peopleCount = bo.getPeopleCount();
training.status = startTime > now ? "NOT_STARTED" : "ONGOING";
return training;
}
}

@ -9,7 +9,7 @@ public class TrainingExample {
* This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
protected String orderByClause;
@ -17,7 +17,7 @@ public class TrainingExample {
* This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
protected boolean distinct;
@ -25,7 +25,7 @@ public class TrainingExample {
* This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
protected List<Criteria> oredCriteria;
@ -33,7 +33,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public TrainingExample() {
oredCriteria = new ArrayList<>();
@ -43,7 +43,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
@ -53,7 +53,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public String getOrderByClause() {
return orderByClause;
@ -63,7 +63,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
@ -73,7 +73,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public boolean isDistinct() {
return distinct;
@ -83,7 +83,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
@ -93,7 +93,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
@ -103,7 +103,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
@ -115,7 +115,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
@ -129,7 +129,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
@ -140,7 +140,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public void clear() {
oredCriteria.clear();
@ -152,7 +152,7 @@ public class TrainingExample {
* This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
@ -515,73 +515,63 @@ public class TrainingExample {
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreateByIsNotNull() {
addCriterion("create_by is not null");
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreateByEqualTo(String value) {
addCriterion("create_by =", value, "createBy");
public Criteria andCreatorIdEqualTo(Integer value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByNotEqualTo(String value) {
addCriterion("create_by <>", value, "createBy");
public Criteria andCreatorIdNotEqualTo(Integer value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByGreaterThan(String value) {
addCriterion("create_by >", value, "createBy");
public Criteria andCreatorIdGreaterThan(Integer value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByGreaterThanOrEqualTo(String value) {
addCriterion("create_by >=", value, "createBy");
public Criteria andCreatorIdGreaterThanOrEqualTo(Integer value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByLessThan(String value) {
addCriterion("create_by <", value, "createBy");
public Criteria andCreatorIdLessThan(Integer value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByLessThanOrEqualTo(String value) {
addCriterion("create_by <=", value, "createBy");
public Criteria andCreatorIdLessThanOrEqualTo(Integer value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByLike(String value) {
addCriterion("create_by like", value, "createBy");
public Criteria andCreatorIdIn(List<Integer> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByNotLike(String value) {
addCriterion("create_by not like", value, "createBy");
public Criteria andCreatorIdNotIn(List<Integer> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByIn(List<String> values) {
addCriterion("create_by in", values, "createBy");
public Criteria andCreatorIdBetween(Integer value1, Integer value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateByNotIn(List<String> values) {
addCriterion("create_by not in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByBetween(String value1, String value2) {
addCriterion("create_by between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotBetween(String value1, String value2) {
addCriterion("create_by not between", value1, value2, "createBy");
public Criteria andCreatorIdNotBetween(Integer value1, Integer value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
@ -724,13 +714,263 @@ public class TrainingExample {
addCriterion("training_name not between", value1, value2, "trainingName");
return (Criteria) this;
}
public Criteria andCreatorNameIsNull() {
addCriterion("creator_name is null");
return (Criteria) this;
}
public Criteria andCreatorNameIsNotNull() {
addCriterion("creator_name is not null");
return (Criteria) this;
}
public Criteria andCreatorNameEqualTo(String value) {
addCriterion("creator_name =", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameNotEqualTo(String value) {
addCriterion("creator_name <>", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameGreaterThan(String value) {
addCriterion("creator_name >", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameGreaterThanOrEqualTo(String value) {
addCriterion("creator_name >=", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameLessThan(String value) {
addCriterion("creator_name <", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameLessThanOrEqualTo(String value) {
addCriterion("creator_name <=", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameLike(String value) {
addCriterion("creator_name like", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameNotLike(String value) {
addCriterion("creator_name not like", value, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameIn(List<String> values) {
addCriterion("creator_name in", values, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameNotIn(List<String> values) {
addCriterion("creator_name not in", values, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameBetween(String value1, String value2) {
addCriterion("creator_name between", value1, value2, "creatorName");
return (Criteria) this;
}
public Criteria andCreatorNameNotBetween(String value1, String value2) {
addCriterion("creator_name not between", value1, value2, "creatorName");
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 Criteria andCreateSchoolIdIsNull() {
addCriterion("create_school_id is null");
return (Criteria) this;
}
public Criteria andCreateSchoolIdIsNotNull() {
addCriterion("create_school_id is not null");
return (Criteria) this;
}
public Criteria andCreateSchoolIdEqualTo(Integer value) {
addCriterion("create_school_id =", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdNotEqualTo(Integer value) {
addCriterion("create_school_id <>", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdGreaterThan(Integer value) {
addCriterion("create_school_id >", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdGreaterThanOrEqualTo(Integer value) {
addCriterion("create_school_id >=", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdLessThan(Integer value) {
addCriterion("create_school_id <", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdLessThanOrEqualTo(Integer value) {
addCriterion("create_school_id <=", value, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdIn(List<Integer> values) {
addCriterion("create_school_id in", values, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdNotIn(List<Integer> values) {
addCriterion("create_school_id not in", values, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdBetween(Integer value1, Integer value2) {
addCriterion("create_school_id between", value1, value2, "createSchoolId");
return (Criteria) this;
}
public Criteria andCreateSchoolIdNotBetween(Integer value1, Integer value2) {
addCriterion("create_school_id not between", value1, value2, "createSchoolId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_training
*
* @mbg.generated do_not_delete_during_merge Thu Jun 29 16:02:35 CST 2023
* @mbg.generated do_not_delete_during_merge Thu Jun 29 18:43:01 CST 2023
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
@ -742,7 +982,7 @@ public class TrainingExample {
* This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
public static class Criterion {
private String condition;

@ -1,20 +1,23 @@
package com.sztzjy.forex.trading_trading.mappers;
import com.github.pagehelper.Page;
import com.sztzjy.forex.trading_trading.entity.Training;
import com.sztzjy.forex.trading_trading.entity.TrainingExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface TrainingMapper {
List<String> selectTrainingName();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
long countByExample(TrainingExample example);
@ -22,7 +25,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int deleteByExample(TrainingExample example);
@ -30,7 +33,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int deleteByPrimaryKey(Integer trainingId);
@ -38,7 +41,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int insert(Training record);
@ -46,7 +49,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int insertSelective(Training record);
@ -54,7 +57,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
List<Training> selectByExample(TrainingExample example);
@ -62,7 +65,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
Training selectByPrimaryKey(Integer trainingId);
@ -70,7 +73,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int updateByExampleSelective(@Param("record") Training record, @Param("example") TrainingExample example);
@ -78,7 +81,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int updateByExample(@Param("record") Training record, @Param("example") TrainingExample example);
@ -86,7 +89,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int updateByPrimaryKeySelective(Training record);
@ -94,7 +97,17 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training
*
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
* @mbg.generated Thu Jun 29 18:43:01 CST 2023
*/
int updateByPrimaryKey(Training record);
Page<Training> selectByPage(@Param("offset") int offset, @Param("pageSize") int pageSize,
@Param("orderByClause") String orderByClause,
@Param("example") TrainingExample example);
@Select("select training_id,training_name from sys_training where school_id=#{schoolId}")
List<Map<String, Object>> selectTrainingNameList(@Param("schoolId") Integer schoolId);
}

@ -47,7 +47,7 @@ public class IndexService {
for (Training training : trainings) {
MemberExample memberExample = new MemberExample();
MemberExample.Criteria criteria1 = memberExample.createCriteria();
Integer trainingId = training.getTrainingId();
String trainingId = training.getTrainingId();
if (trainingId != null) {
criteria1.andTrainingIdEqualTo(trainingId);
}

@ -13,7 +13,7 @@ public class MemberService {
@Autowired
MemberMapper memberMapper;
public Member getMemberByMemberIdAndTrainingId(Integer memberId,Integer trainingId){
public Member getMemberByMemberIdAndTrainingId(Integer memberId,String trainingId){
MemberExample example = new MemberExample();
MemberExample.Criteria criteria = example.createCriteria();
criteria.andMemberIdEqualTo(memberId);

@ -0,0 +1,83 @@
package com.sztzjy.forex.trading_trading.service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.forex.trading_trading.config.security.JwtUser;
import com.sztzjy.forex.trading_trading.dto.TrainingBO;
import com.sztzjy.forex.trading_trading.entity.Training;
import com.sztzjy.forex.trading_trading.entity.TrainingExample;
import com.sztzjy.forex.trading_trading.mappers.TrainingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class TrainingService {
@Autowired
private TrainingMapper trainingMapper;
public void create(TrainingBO bo, JwtUser currentUser) {
//TODO 待完成通过学校id或者班级id到智云平台获取学生信息并将参与实训学生信息添加到member表中
if (checkTrainingName(bo.getTrainingName(), null)) {
throw new RuntimeException("实训名称已存在");
}
Training training = Training.buildTraining(bo, currentUser);
trainingMapper.insertSelective(training);
}
public Training findById(Integer id) {
return trainingMapper.selectByPrimaryKey(id);
}
public void delete(Integer id) {
//TODO 删除实训还要删除member表中的trainingId相关数据
trainingMapper.deleteByPrimaryKey(id);
}
public Training update(Integer id, String name) {
Training training = findById(id);
Assert.isTrue(StringUtils.hasText(name), "实训名称不能为空");
Assert.notNull(training, "该实训不存在");
Assert.isTrue(!training.getTrainingName().equals(name), "实训名称未发生变化");
if (checkTrainingName(name, id)) {
throw new RuntimeException("实训名称已存在");
}
training.setTrainingName(name);
trainingMapper.updateByPrimaryKeySelective(training);
return training;
}
private Boolean checkTrainingName(String name, Integer id) {
TrainingExample example = new TrainingExample();
example.createCriteria().andTrainingNameEqualTo(name);
if (id != null) {
example.createCriteria().andTrainingIdNotEqualTo(id);
}
List<Training> training = trainingMapper.selectByExample(example);
return training.size() > 0;
}
public PageInfo<Training> pagedListTraining(int pageNo, int pageSize) {
//TODO 待确定过滤参数
TrainingExample example = new TrainingExample();
PageHelper.startPage(pageNo, pageSize);
return new PageInfo<>(trainingMapper.selectByExample(example));
}
public List<Map<String, Object>> findTrainingNameList(JwtUser user) {
return trainingMapper.selectTrainingNameList(user.getSchoolId());
}
}

@ -1,342 +1,411 @@
<?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.forex.trading_trading.mappers.TrainingMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
<id column="training_id" jdbcType="INTEGER" property="trainingId"/>
<result column="people_count" jdbcType="INTEGER" property="peopleCount"/>
<result column="start_time" jdbcType="VARCHAR" property="startTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_school" jdbcType="VARCHAR" property="createSchool"/>
<result column="training_name" jdbcType="VARCHAR" property="trainingName"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
<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>
<resultMap id="BaseResultMap" type="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
<id column="training_id" jdbcType="INTEGER" property="trainingId" />
<result column="people_count" jdbcType="INTEGER" property="peopleCount" />
<result column="start_time" jdbcType="VARCHAR" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="creator_id" jdbcType="INTEGER" property="creatorId" />
<result column="create_school" jdbcType="VARCHAR" property="createSchool" />
<result column="training_name" jdbcType="VARCHAR" property="trainingName" />
<result column="creator_name" jdbcType="VARCHAR" property="creatorName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_school_id" jdbcType="INTEGER" property="createSchoolId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
<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>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
<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">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
training_id, people_count, start_time, end_time, status, create_by, create_school,
training_name
</sql>
<select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from sys_training
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectTrainingName" resultType="java.lang.String">
select training_nmme
from sys_training
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
select
<include refid="Base_Column_List"/>
from sys_training
where training_id = #{trainingId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
delete from sys_training
where training_id = #{trainingId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
delete from sys_training
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</trim>
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
insert into sys_training (training_id, people_count, start_time,
end_time, status, create_by,
create_school, training_name)
values (#{trainingId,jdbcType=INTEGER}, #{peopleCount,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR},
#{endTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createSchool,jdbcType=VARCHAR}, #{trainingName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
insert into sys_training
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="trainingId != null">
training_id,
</if>
<if test="peopleCount != null">
people_count,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="status != null">
status,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createSchool != null">
create_school,
</if>
<if test="trainingName != null">
training_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trainingId != null">
#{trainingId,jdbcType=INTEGER},
</if>
<if test="peopleCount != null">
#{peopleCount,jdbcType=INTEGER},
</if>
<if test="startTime != null">
#{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createSchool != null">
#{createSchool,jdbcType=VARCHAR},
</if>
<if test="trainingName != null">
#{trainingName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
select count(*) from sys_training
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
update sys_training
<set>
<if test="record.trainingId != null">
training_id = #{record.trainingId,jdbcType=INTEGER},
</if>
<if test="record.peopleCount != null">
people_count = #{record.peopleCount,jdbcType=INTEGER},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=VARCHAR},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createSchool != null">
create_school = #{record.createSchool,jdbcType=VARCHAR},
</if>
<if test="record.trainingName != null">
training_name = #{record.trainingName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
<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>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
update sys_training
set training_id = #{record.trainingId,jdbcType=INTEGER},
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
training_id, people_count, start_time, end_time, status, creator_id, create_school,
training_name, creator_name, create_time, update_time, create_school_id
</sql>
<select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_training
<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.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
select
<include refid="Base_Column_List" />
from sys_training
where training_id = #{trainingId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
delete from sys_training
where training_id = #{trainingId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
delete from sys_training
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
insert into sys_training (training_id, people_count, start_time,
end_time, status, creator_id,
create_school, training_name, creator_name,
create_time, update_time, create_school_id
)
values (#{trainingId,jdbcType=INTEGER}, #{peopleCount,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR},
#{endTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, #{creatorId,jdbcType=INTEGER},
#{createSchool,jdbcType=VARCHAR}, #{trainingName,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createSchoolId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
insert into sys_training
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="trainingId != null">
training_id,
</if>
<if test="peopleCount != null">
people_count,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="status != null">
status,
</if>
<if test="creatorId != null">
creator_id,
</if>
<if test="createSchool != null">
create_school,
</if>
<if test="trainingName != null">
training_name,
</if>
<if test="creatorName != null">
creator_name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createSchoolId != null">
create_school_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trainingId != null">
#{trainingId,jdbcType=INTEGER},
</if>
<if test="peopleCount != null">
#{peopleCount,jdbcType=INTEGER},
</if>
<if test="startTime != null">
#{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
#{creatorId,jdbcType=INTEGER},
</if>
<if test="createSchool != null">
#{createSchool,jdbcType=VARCHAR},
</if>
<if test="trainingName != null">
#{trainingName,jdbcType=VARCHAR},
</if>
<if test="creatorName != null">
#{creatorName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createSchoolId != null">
#{createSchoolId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
select count(*) from sys_training
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
update sys_training
<set>
<if test="record.trainingId != null">
training_id = #{record.trainingId,jdbcType=INTEGER},
</if>
<if test="record.peopleCount != null">
people_count = #{record.peopleCount,jdbcType=INTEGER},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=VARCHAR},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=INTEGER},
</if>
<if test="record.createSchool != null">
create_school = #{record.createSchool,jdbcType=VARCHAR},
training_name = #{record.trainingName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
update sys_training
<set>
<if test="peopleCount != null">
people_count = #{peopleCount,jdbcType=INTEGER},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createSchool != null">
create_school = #{createSchool,jdbcType=VARCHAR},
</if>
<if test="trainingName != null">
training_name = #{trainingName,jdbcType=VARCHAR},
</if>
</set>
where training_id = #{trainingId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023.
-->
update sys_training
set people_count = #{peopleCount,jdbcType=INTEGER},
</if>
<if test="record.trainingName != null">
training_name = #{record.trainingName,jdbcType=VARCHAR},
</if>
<if test="record.creatorName != null">
creator_name = #{record.creatorName,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>
<if test="record.createSchoolId != null">
create_school_id = #{record.createSchoolId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
update sys_training
set training_id = #{record.trainingId,jdbcType=INTEGER},
people_count = #{record.peopleCount,jdbcType=INTEGER},
start_time = #{record.startTime,jdbcType=VARCHAR},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
status = #{record.status,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=INTEGER},
create_school = #{record.createSchool,jdbcType=VARCHAR},
training_name = #{record.trainingName,jdbcType=VARCHAR},
creator_name = #{record.creatorName,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
create_school_id = #{record.createSchoolId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
update sys_training
<set>
<if test="peopleCount != null">
people_count = #{peopleCount,jdbcType=INTEGER},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createSchool != null">
create_school = #{createSchool,jdbcType=VARCHAR},
training_name = #{trainingName,jdbcType=VARCHAR}
where training_id = #{trainingId,jdbcType=INTEGER}
</update>
</if>
<if test="trainingName != null">
training_name = #{trainingName,jdbcType=VARCHAR},
</if>
<if test="creatorName != null">
creator_name = #{creatorName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createSchoolId != null">
create_school_id = #{createSchoolId,jdbcType=INTEGER},
</if>
</set>
where training_id = #{trainingId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 18:43:01 CST 2023.
-->
update sys_training
set people_count = #{peopleCount,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=INTEGER},
create_school = #{createSchool,jdbcType=VARCHAR},
training_name = #{trainingName,jdbcType=VARCHAR},
creator_name = #{creatorName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_school_id = #{createSchoolId,jdbcType=INTEGER}
where training_id = #{trainingId,jdbcType=INTEGER}
</update>
<select id="selectByPage" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultMap="BaseResultMap">
select * from training
<where>
<!--待确认过滤条件-->
</where>
<if test="orderByClause != null and orderByClause != ''">
<bind name="safeOrderByClause" value="${orderByClause}" />
ORDER BY ${safeOrderByClause}
</if>
limit #{offset}, #{pageSize}
</select>
</mapper>
Loading…
Cancel
Save