教师端实训操作。代码调整
parent
860680b6be
commit
1dece8a55a
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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…
Reference in New Issue