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

pull/1/head
陈沅
parent 860680b6be
commit 1dece8a55a

@ -51,8 +51,9 @@ public class IndexController {
@ApiOperation("首页下拉获取实训任务名称") @ApiOperation("首页下拉获取实训任务名称")
@AnonymousAccess @AnonymousAccess
public ResultEntity<List<String>> getTrainingName() { public ResultEntity<List<String>> getTrainingName() {
List<String> trainingName = trainingMapper.selectTrainingName(); // List<String> trainingName = trainingMapper.selectTrainingName();
return new ResultEntity<>(HttpStatus.OK, trainingName); // 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")); String buySellType = String.valueOf(jsonObject.get("buySellType"));
//获取账户资金 调用member表中的 //获取账户资金 调用member表中的
Integer memberId = (Integer) jsonObject.get("memberId"); Integer memberId = (Integer) jsonObject.get("memberId");
Integer trainingId = (Integer) jsonObject.get("trainingId"); String trainingId = jsonObject.get("trainingId").toString();
Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId); Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId);
Double availableFunds = member.getAvailableFunds(); Double availableFunds = member.getAvailableFunds();
if (transactionType.equals("sjkc")) {//市价开仓 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 * @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 * @mbg.generated Thu Jun 29 11:19:15 CST 2023
*/ */
public Integer getTrainingId() { public String getTrainingId() {
return trainingId; return trainingId;
} }
/** public void setTrainingId(String 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) {
this.trainingId = trainingId; this.trainingId = trainingId;
} }

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

@ -1,8 +1,15 @@
package com.sztzjy.forex.trading_trading.entity; 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; import java.util.Date;
public class Training { public class Training extends Base {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
@ -10,25 +17,26 @@ public class Training {
* *
* @mbg.generated Thu Jun 29 16:02:35 CST 2023 * @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 was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.people_count * 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; private Integer peopleCount;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.start_time * 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 * @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
@ApiModelProperty("实训结束时间")
private Date endTime; private Date endTime;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.status * 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; private String status;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.create_by * 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 was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.create_school * 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; private String createSchool;
/** /**
*
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_training.training_name * 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; private String trainingName;
@ApiModelProperty("创建人所属学校id")
private Integer createSchoolId;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_training.training_id * This method returns the value of the database column sys_training.training_id
* *
* @return the value of sys_training.training_id * @return the value of sys_training.training_id
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public Integer getTrainingId() { public String getTrainingId() {
return trainingId; return trainingId;
} }
@ -92,10 +107,9 @@ public class Training {
* This method sets the value of the database column sys_training.training_id * This method sets the value of the database column sys_training.training_id
* *
* @param trainingId the value for sys_training.training_id * @param trainingId the value for sys_training.training_id
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setTrainingId(Integer trainingId) { public void setTrainingId(String trainingId) {
this.trainingId = trainingId; this.trainingId = trainingId;
} }
@ -104,8 +118,7 @@ public class Training {
* This method returns the value of the database column sys_training.people_count * This method returns the value of the database column sys_training.people_count
* *
* @return the value of sys_training.people_count * @return the value of sys_training.people_count
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public Integer getPeopleCount() { public Integer getPeopleCount() {
return peopleCount; return peopleCount;
@ -116,8 +129,7 @@ public class Training {
* This method sets the value of the database column sys_training.people_count * This method sets the value of the database column sys_training.people_count
* *
* @param peopleCount the value for sys_training.people_count * @param peopleCount the value for sys_training.people_count
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setPeopleCount(Integer peopleCount) { public void setPeopleCount(Integer peopleCount) {
this.peopleCount = peopleCount; this.peopleCount = peopleCount;
@ -128,10 +140,9 @@ public class Training {
* This method returns the value of the database column sys_training.start_time * This method returns the value of the database column sys_training.start_time
* *
* @return the value of sys_training.start_time * @return the value of sys_training.start_time
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public String getStartTime() { public Date getStartTime() {
return startTime; return startTime;
} }
@ -140,11 +151,10 @@ public class Training {
* This method sets the value of the database column sys_training.start_time * This method sets the value of the database column sys_training.start_time
* *
* @param startTime the value for sys_training.start_time * @param startTime the value for sys_training.start_time
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setStartTime(String startTime) { public void setStartTime(Date startTime) {
this.startTime = startTime == null ? null : startTime.trim(); this.startTime = startTime;
} }
/** /**
@ -152,8 +162,7 @@ public class Training {
* This method returns the value of the database column sys_training.end_time * This method returns the value of the database column sys_training.end_time
* *
* @return the value of sys_training.end_time * @return the value of sys_training.end_time
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public Date getEndTime() { public Date getEndTime() {
return endTime; return endTime;
@ -164,8 +173,7 @@ public class Training {
* This method sets the value of the database column sys_training.end_time * This method sets the value of the database column sys_training.end_time
* *
* @param endTime the value for sys_training.end_time * @param endTime the value for sys_training.end_time
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setEndTime(Date endTime) { public void setEndTime(Date endTime) {
this.endTime = endTime; this.endTime = endTime;
@ -176,8 +184,7 @@ public class Training {
* This method returns the value of the database column sys_training.status * This method returns the value of the database column sys_training.status
* *
* @return the value of sys_training.status * @return the value of sys_training.status
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public String getStatus() { public String getStatus() {
return status; return status;
@ -188,35 +195,43 @@ public class Training {
* This method sets the value of the database column sys_training.status * This method sets the value of the database column sys_training.status
* *
* @param status the value for sys_training.status * @param status the value for sys_training.status
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setStatus(String status) { public void setStatus(String status) {
this.status = status == null ? null : status.trim(); 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 was generated by MyBatis Generator.
* This method returns the value of the database column sys_training.create_by * This method returns the value of the database column sys_training.create_by
* *
* @return the value of sys_training.create_by * @return the value of sys_training.create_by
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public String getCreateBy() {
return createBy;
public String getCreatorName() {
return creatorName;
} }
/** public void setCreatorName(String creatorName) {
* This method was generated by MyBatis Generator. this.creatorName = creatorName;
* 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();
} }
/** /**
@ -224,8 +239,7 @@ public class Training {
* This method returns the value of the database column sys_training.create_school * This method returns the value of the database column sys_training.create_school
* *
* @return the value of sys_training.create_school * @return the value of sys_training.create_school
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public String getCreateSchool() { public String getCreateSchool() {
return createSchool; return createSchool;
@ -236,8 +250,7 @@ public class Training {
* This method sets the value of the database column sys_training.create_school * This method sets the value of the database column sys_training.create_school
* *
* @param createSchool the value for sys_training.create_school * @param createSchool the value for sys_training.create_school
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setCreateSchool(String createSchool) { public void setCreateSchool(String createSchool) {
this.createSchool = createSchool == null ? null : createSchool.trim(); 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 * This method returns the value of the database column sys_training.training_name
* *
* @return the value of sys_training.training_name * @return the value of sys_training.training_name
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public String getTrainingName() { public String getTrainingName() {
return trainingName; return trainingName;
@ -260,10 +272,35 @@ public class Training {
* This method sets the value of the database column sys_training.training_name * This method sets the value of the database column sys_training.training_name
* *
* @param trainingName the value for sys_training.training_name * @param trainingName the value for sys_training.training_name
* * @mbg.generated Thu Jun 29 16:30:49 CST 2023
* @mbg.generated Thu Jun 29 16:02:35 CST 2023
*/ */
public void setTrainingName(String trainingName) { public void setTrainingName(String trainingName) {
this.trainingName = trainingName == null ? null : trainingName.trim(); 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 was generated by MyBatis Generator.
* This field corresponds to the database table sys_training * 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; protected String orderByClause;
@ -17,7 +17,7 @@ public class TrainingExample {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_training * 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; protected boolean distinct;
@ -25,7 +25,7 @@ public class TrainingExample {
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table sys_training * 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; protected List<Criteria> oredCriteria;
@ -33,7 +33,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public TrainingExample() {
oredCriteria = new ArrayList<>(); oredCriteria = new ArrayList<>();
@ -43,7 +43,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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) { public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause; this.orderByClause = orderByClause;
@ -53,7 +53,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public String getOrderByClause() {
return orderByClause; return orderByClause;
@ -63,7 +63,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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) { public void setDistinct(boolean distinct) {
this.distinct = distinct; this.distinct = distinct;
@ -73,7 +73,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public boolean isDistinct() {
return distinct; return distinct;
@ -83,7 +83,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public List<Criteria> getOredCriteria() {
return oredCriteria; return oredCriteria;
@ -93,7 +93,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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) { public void or(Criteria criteria) {
oredCriteria.add(criteria); oredCriteria.add(criteria);
@ -103,7 +103,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public Criteria or() {
Criteria criteria = createCriteriaInternal(); Criteria criteria = createCriteriaInternal();
@ -115,7 +115,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal(); Criteria criteria = createCriteriaInternal();
@ -129,7 +129,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(); Criteria criteria = new Criteria();
@ -140,7 +140,7 @@ public class TrainingExample {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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() { public void clear() {
oredCriteria.clear(); oredCriteria.clear();
@ -152,7 +152,7 @@ public class TrainingExample {
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_training * 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 abstract static class GeneratedCriteria {
protected List<Criterion> criteria; protected List<Criterion> criteria;
@ -515,73 +515,63 @@ public class TrainingExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByIsNull() { public Criteria andCreatorIdIsNull() {
addCriterion("create_by is null"); addCriterion("creator_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByIsNotNull() { public Criteria andCreatorIdIsNotNull() {
addCriterion("create_by is not null"); addCriterion("creator_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByEqualTo(String value) { public Criteria andCreatorIdEqualTo(Integer value) {
addCriterion("create_by =", value, "createBy"); addCriterion("creator_id =", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByNotEqualTo(String value) { public Criteria andCreatorIdNotEqualTo(Integer value) {
addCriterion("create_by <>", value, "createBy"); addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByGreaterThan(String value) { public Criteria andCreatorIdGreaterThan(Integer value) {
addCriterion("create_by >", value, "createBy"); addCriterion("creator_id >", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByGreaterThanOrEqualTo(String value) { public Criteria andCreatorIdGreaterThanOrEqualTo(Integer value) {
addCriterion("create_by >=", value, "createBy"); addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByLessThan(String value) { public Criteria andCreatorIdLessThan(Integer value) {
addCriterion("create_by <", value, "createBy"); addCriterion("creator_id <", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByLessThanOrEqualTo(String value) { public Criteria andCreatorIdLessThanOrEqualTo(Integer value) {
addCriterion("create_by <=", value, "createBy"); addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByLike(String value) { public Criteria andCreatorIdIn(List<Integer> values) {
addCriterion("create_by like", value, "createBy"); addCriterion("creator_id in", values, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByNotLike(String value) { public Criteria andCreatorIdNotIn(List<Integer> values) {
addCriterion("create_by not like", value, "createBy"); addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByIn(List<String> values) { public Criteria andCreatorIdBetween(Integer value1, Integer value2) {
addCriterion("create_by in", values, "createBy"); addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateByNotIn(List<String> values) { public Criteria andCreatorIdNotBetween(Integer value1, Integer value2) {
addCriterion("create_by not in", values, "createBy"); addCriterion("creator_id not between", value1, value2, "creatorId");
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");
return (Criteria) this; return (Criteria) this;
} }
@ -724,13 +714,263 @@ public class TrainingExample {
addCriterion("training_name not between", value1, value2, "trainingName"); addCriterion("training_name not between", value1, value2, "trainingName");
return (Criteria) this; 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 was generated by MyBatis Generator.
* This class corresponds to the database table sys_training * 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 { public static class Criteria extends GeneratedCriteria {
protected Criteria() { protected Criteria() {
@ -742,7 +982,7 @@ public class TrainingExample {
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
* This class corresponds to the database table sys_training * 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 { public static class Criterion {
private String condition; private String condition;

@ -1,20 +1,23 @@
package com.sztzjy.forex.trading_trading.mappers; 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.Training;
import com.sztzjy.forex.trading_trading.entity.TrainingExample; import com.sztzjy.forex.trading_trading.entity.TrainingExample;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface TrainingMapper { public interface TrainingMapper {
List<String> selectTrainingName();
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); long countByExample(TrainingExample example);
@ -22,7 +25,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); int deleteByExample(TrainingExample example);
@ -30,7 +33,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); int deleteByPrimaryKey(Integer trainingId);
@ -38,7 +41,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); int insert(Training record);
@ -46,7 +49,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); int insertSelective(Training record);
@ -54,7 +57,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); List<Training> selectByExample(TrainingExample example);
@ -62,7 +65,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); Training selectByPrimaryKey(Integer trainingId);
@ -70,7 +73,7 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); 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 was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); 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 was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); int updateByPrimaryKeySelective(Training record);
@ -94,7 +97,17 @@ public interface TrainingMapper {
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_training * 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); 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) { for (Training training : trainings) {
MemberExample memberExample = new MemberExample(); MemberExample memberExample = new MemberExample();
MemberExample.Criteria criteria1 = memberExample.createCriteria(); MemberExample.Criteria criteria1 = memberExample.createCriteria();
Integer trainingId = training.getTrainingId(); String trainingId = training.getTrainingId();
if (trainingId != null) { if (trainingId != null) {
criteria1.andTrainingIdEqualTo(trainingId); criteria1.andTrainingIdEqualTo(trainingId);
} }

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

@ -5,22 +5,26 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
<id column="training_id" jdbcType="INTEGER" property="trainingId"/> <id column="training_id" jdbcType="INTEGER" property="trainingId" />
<result column="people_count" jdbcType="INTEGER" property="peopleCount"/> <result column="people_count" jdbcType="INTEGER" property="peopleCount" />
<result column="start_time" jdbcType="VARCHAR" property="startTime"/> <result column="start_time" jdbcType="VARCHAR" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="status" jdbcType="VARCHAR" property="status"/> <result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_by" jdbcType="VARCHAR" property="createBy"/> <result column="creator_id" jdbcType="INTEGER" property="creatorId" />
<result column="create_school" jdbcType="VARCHAR" property="createSchool"/> <result column="create_school" jdbcType="VARCHAR" property="createSchool" />
<result column="training_name" jdbcType="VARCHAR" property="trainingName"/> <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> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
@ -39,8 +43,7 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -55,7 +58,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
<where> <where>
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="example.oredCriteria" item="criteria" separator="or">
@ -74,8 +77,7 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -90,43 +92,38 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
training_id, people_count, start_time, end_time, status, create_by, create_school, training_id, people_count, start_time, end_time, status, creator_id, create_school,
training_name training_name, creator_name, create_time, update_time, create_school_id
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" <select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultMap="BaseResultMap">
resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from sys_training from sys_training
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectTrainingName" resultType="java.lang.String">
select training_nmme
from sys_training
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from sys_training from sys_training
where training_id = #{trainingId,jdbcType=INTEGER} where training_id = #{trainingId,jdbcType=INTEGER}
</select> </select>
@ -134,7 +131,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
delete from sys_training delete from sys_training
where training_id = #{trainingId,jdbcType=INTEGER} where training_id = #{trainingId,jdbcType=INTEGER}
@ -143,31 +140,35 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
delete from sys_training delete from sys_training
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.sztzjy.forex.trading_trading.entity.Training"> <insert id="insert" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
insert into sys_training (training_id, people_count, start_time, insert into sys_training (training_id, people_count, start_time,
end_time, status, create_by, end_time, status, creator_id,
create_school, training_name) create_school, training_name, creator_name,
create_time, update_time, create_school_id
)
values (#{trainingId,jdbcType=INTEGER}, #{peopleCount,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR}, values (#{trainingId,jdbcType=INTEGER}, #{peopleCount,jdbcType=INTEGER}, #{startTime,jdbcType=VARCHAR},
#{endTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{endTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, #{creatorId,jdbcType=INTEGER},
#{createSchool,jdbcType=VARCHAR}, #{trainingName,jdbcType=VARCHAR}) #{createSchool,jdbcType=VARCHAR}, #{trainingName,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createSchoolId,jdbcType=INTEGER}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training"> <insert id="insertSelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
insert into sys_training insert into sys_training
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -186,8 +187,8 @@
<if test="status != null"> <if test="status != null">
status, status,
</if> </if>
<if test="createBy != null"> <if test="creatorId != null">
create_by, creator_id,
</if> </if>
<if test="createSchool != null"> <if test="createSchool != null">
create_school, create_school,
@ -195,6 +196,18 @@
<if test="trainingName != null"> <if test="trainingName != null">
training_name, training_name,
</if> </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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="trainingId != null"> <if test="trainingId != null">
@ -212,8 +225,8 @@
<if test="status != null"> <if test="status != null">
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
</if> </if>
<if test="createBy != null"> <if test="creatorId != null">
#{createBy,jdbcType=VARCHAR}, #{creatorId,jdbcType=INTEGER},
</if> </if>
<if test="createSchool != null"> <if test="createSchool != null">
#{createSchool,jdbcType=VARCHAR}, #{createSchool,jdbcType=VARCHAR},
@ -221,25 +234,36 @@
<if test="trainingName != null"> <if test="trainingName != null">
#{trainingName,jdbcType=VARCHAR}, #{trainingName,jdbcType=VARCHAR},
</if> </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> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" <select id="countByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultType="java.lang.Long">
resultType="java.lang.Long">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
select count(*) from sys_training select count(*) from sys_training
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
update sys_training update sys_training
<set> <set>
@ -258,8 +282,8 @@
<if test="record.status != null"> <if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR}, status = #{record.status,jdbcType=VARCHAR},
</if> </if>
<if test="record.createBy != null"> <if test="record.creatorId != null">
create_by = #{record.createBy,jdbcType=VARCHAR}, creator_id = #{record.creatorId,jdbcType=INTEGER},
</if> </if>
<if test="record.createSchool != null"> <if test="record.createSchool != null">
create_school = #{record.createSchool,jdbcType=VARCHAR}, create_school = #{record.createSchool,jdbcType=VARCHAR},
@ -267,16 +291,28 @@
<if test="record.trainingName != null"> <if test="record.trainingName != null">
training_name = #{record.trainingName,jdbcType=VARCHAR}, training_name = #{record.trainingName,jdbcType=VARCHAR},
</if> </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> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
update sys_training update sys_training
set training_id = #{record.trainingId,jdbcType=INTEGER}, set training_id = #{record.trainingId,jdbcType=INTEGER},
@ -284,18 +320,22 @@
start_time = #{record.startTime,jdbcType=VARCHAR}, start_time = #{record.startTime,jdbcType=VARCHAR},
end_time = #{record.endTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP},
status = #{record.status,jdbcType=VARCHAR}, status = #{record.status,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR}, creator_id = #{record.creatorId,jdbcType=INTEGER},
create_school = #{record.createSchool,jdbcType=VARCHAR}, create_school = #{record.createSchool,jdbcType=VARCHAR},
training_name = #{record.trainingName,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"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training"> <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
update sys_training update sys_training
<set> <set>
@ -311,8 +351,8 @@
<if test="status != null"> <if test="status != null">
status = #{status,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
</if> </if>
<if test="createBy != null"> <if test="creatorId != null">
create_by = #{createBy,jdbcType=VARCHAR}, creator_id = #{creatorId,jdbcType=INTEGER},
</if> </if>
<if test="createSchool != null"> <if test="createSchool != null">
create_school = #{createSchool,jdbcType=VARCHAR}, create_school = #{createSchool,jdbcType=VARCHAR},
@ -320,6 +360,18 @@
<if test="trainingName != null"> <if test="trainingName != null">
training_name = #{trainingName,jdbcType=VARCHAR}, training_name = #{trainingName,jdbcType=VARCHAR},
</if> </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> </set>
where training_id = #{trainingId,jdbcType=INTEGER} where training_id = #{trainingId,jdbcType=INTEGER}
</update> </update>
@ -327,16 +379,33 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 29 16:02:35 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
update sys_training update sys_training
set people_count = #{peopleCount,jdbcType=INTEGER}, set people_count = #{peopleCount,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=VARCHAR}, start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR}, creator_id = #{creatorId,jdbcType=INTEGER},
create_school = #{createSchool,jdbcType=VARCHAR}, create_school = #{createSchool,jdbcType=VARCHAR},
training_name = #{trainingName,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} where training_id = #{trainingId,jdbcType=INTEGER}
</update> </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> </mapper>
Loading…
Cancel
Save