【实训草稿存档功能】

This commit is contained in:
weizhihong 2022-11-14 18:07:59 +08:00
parent 26d8683e76
commit 55abfd21b2
9 changed files with 1141 additions and 0 deletions

View File

@ -0,0 +1,12 @@
CREATE TABLE `rts_draft_training2_progress` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`training_id` bigint DEFAULT NULL COMMENT '实训ID',
`description` text COMMENT '描述',
`create_time` datetime DEFAULT NULL,
`map_location_json` text COMMENT '地图定位',
`bg_scene_json` text COMMENT '背景JSON',
`step_json` text COMMENT '步骤列表json',
`scoring_rule_json` text COMMENT '打分规则列表json',
`creator_id` bigint DEFAULT NULL COMMENT '创建人',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='实训草稿存档表';

View File

@ -0,0 +1,56 @@
package club.joylink.rtss.controller.training2;
import club.joylink.rtss.services.training2.Training2DraftProgressService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.training2.draft.DraftTraining2ProgressVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 实训草稿存档功能
*/
@Slf4j
@RestController
@RequestMapping("/api/v2/draft/training/{trainingId}/progress")
public class TrainingDraftProgressController {
@Autowired
private Training2DraftProgressService training2DraftProgressService;
/**
* 存档
*/
@PostMapping("{group}/save")
public void saveProgress(@RequestBody DraftTraining2ProgressVo progressVo
,@PathVariable Long trainingId, @PathVariable String group, @RequestAttribute AccountVO user){
training2DraftProgressService.saveProgress(progressVo, trainingId, group, user);
}
/**
* 读档
*/
@PostMapping("{group}/read/{id}")
public DraftTraining2ProgressVo readProgress(@PathVariable String group, @PathVariable Long trainingId, @PathVariable Long id){
return training2DraftProgressService.readProgress(id, trainingId, group);
}
@GetMapping("/list")
public PageVO<DraftTraining2ProgressVo> queryProgressList(@PathVariable Long trainingId, PageVO<DraftTraining2ProgressVo> pageVO){
return training2DraftProgressService.queryProgressList(trainingId, pageVO);
}
@DeleteMapping("/delete/{id}")
public void deleteProgress(@PathVariable Long trainingId,@PathVariable Long id){
training2DraftProgressService.deleteProgressById(trainingId, id);
}
@DeleteMapping("/deleteAll")
public void deleteAllProgress(@PathVariable Long trainingId){
training2DraftProgressService.deleteAllProgress(trainingId);
}
}

View File

@ -0,0 +1,36 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.training2.DraftTraining2Progress;
import club.joylink.rtss.entity.training2.DraftTraining2ProgressExample;
import club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DraftTraining2ProgressDao {
int deleteByPrimaryKey(Long id);
int deleteByTrainingId(Long trainingId);
int insert(DraftTraining2ProgressWithBLOBs record);
int insertSelective(DraftTraining2ProgressWithBLOBs record);
List<DraftTraining2ProgressWithBLOBs> selectByExampleWithBLOBs(DraftTraining2ProgressExample example);
List<DraftTraining2Progress> selectByExample(DraftTraining2ProgressExample example);
DraftTraining2ProgressWithBLOBs selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DraftTraining2ProgressWithBLOBs record, @Param("example") DraftTraining2ProgressExample example);
int updateByExampleWithBLOBs(@Param("record") DraftTraining2ProgressWithBLOBs record, @Param("example") DraftTraining2ProgressExample example);
int updateByExample(@Param("record") DraftTraining2Progress record, @Param("example") DraftTraining2ProgressExample example);
int updateByPrimaryKeySelective(DraftTraining2ProgressWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(DraftTraining2ProgressWithBLOBs record);
int updateByPrimaryKey(DraftTraining2Progress record);
}

View File

@ -0,0 +1,45 @@
package club.joylink.rtss.entity.training2;
import java.util.Date;
public class DraftTraining2Progress {
private Long id;
private Long trainingId;
private Date createTime;
private Long creatorId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTrainingId() {
return trainingId;
}
public void setTrainingId(Long trainingId) {
this.trainingId = trainingId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreatorId() {
return creatorId;
}
public void setCreatorId(Long creatorId) {
this.creatorId = creatorId;
}
}

View File

@ -0,0 +1,441 @@
package club.joylink.rtss.entity.training2;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DraftTraining2ProgressExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public DraftTraining2ProgressExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTrainingIdIsNull() {
addCriterion("training_id is null");
return (Criteria) this;
}
public Criteria andTrainingIdIsNotNull() {
addCriterion("training_id is not null");
return (Criteria) this;
}
public Criteria andTrainingIdEqualTo(Long value) {
addCriterion("training_id =", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdNotEqualTo(Long value) {
addCriterion("training_id <>", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdGreaterThan(Long value) {
addCriterion("training_id >", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdGreaterThanOrEqualTo(Long value) {
addCriterion("training_id >=", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdLessThan(Long value) {
addCriterion("training_id <", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdLessThanOrEqualTo(Long value) {
addCriterion("training_id <=", value, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdIn(List<Long> values) {
addCriterion("training_id in", values, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdNotIn(List<Long> values) {
addCriterion("training_id not in", values, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdBetween(Long value1, Long value2) {
addCriterion("training_id between", value1, value2, "trainingId");
return (Criteria) this;
}
public Criteria andTrainingIdNotBetween(Long value1, Long value2) {
addCriterion("training_id not between", value1, value2, "trainingId");
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 andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,53 @@
package club.joylink.rtss.entity.training2;
public class DraftTraining2ProgressWithBLOBs extends DraftTraining2Progress {
private String description;
private String mapLocationJson;
private String bgSceneJson;
private String stepJson;
private String scoringRuleJson;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getMapLocationJson() {
return mapLocationJson;
}
public void setMapLocationJson(String mapLocationJson) {
this.mapLocationJson = mapLocationJson == null ? null : mapLocationJson.trim();
}
public String getBgSceneJson() {
return bgSceneJson;
}
public void setBgSceneJson(String bgSceneJson) {
this.bgSceneJson = bgSceneJson == null ? null : bgSceneJson.trim();
}
public String getStepJson() {
return stepJson;
}
public void setStepJson(String stepJson) {
this.stepJson = stepJson == null ? null : stepJson.trim();
}
public String getScoringRuleJson() {
return scoringRuleJson;
}
public void setScoringRuleJson(String scoringRuleJson) {
this.scoringRuleJson = scoringRuleJson == null ? null : scoringRuleJson.trim();
}
}

View File

@ -0,0 +1,144 @@
package club.joylink.rtss.services.training2;
import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.dao.DraftTraining2ProgressDao;
import club.joylink.rtss.entity.Training;
import club.joylink.rtss.entity.training2.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.member.SimulationMemberPO;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.vo.client.training.TrainingNewVO;
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
import club.joylink.rtss.vo.client.training2.Step2VO;
import club.joylink.rtss.vo.training2.draft.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 实训草稿存档功能
*/
@Service
@Slf4j
public class Training2DraftProgressService {
@Autowired
private DraftTraining2DAO trainingDao;
@Autowired
private DraftTraining2ProgressDao training2ProgressDao;
@Autowired
private GroupSimulationService groupSimulationService;
@Autowired
private SimulationLifeCycleService simulationLifeCycleService;
/**
* 存档操作
*/
public void saveProgress(DraftTraining2ProgressVo progressVo, Long trainingId, String group, AccountVO user) {
DraftTraining2WithBLOBs draftTraining2 = trainingDao.selectByPrimaryKey(progressVo.getTrainingId());
if (draftTraining2 == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
}
DraftTraining2ProgressExample example = new DraftTraining2ProgressExample();
example.createCriteria().andTrainingIdEqualTo(progressVo.getTrainingId());
example.setOrderByClause("create_time desc limit 1");
List<DraftTraining2ProgressWithBLOBs> progressesList = training2ProgressDao.selectByExampleWithBLOBs(example);
boolean saveFlag = !CollectionUtils.isEmpty(progressesList);
if (saveFlag) {
long lastTime = progressesList.get(0).getCreateTime().getTime();
long nowTime = new Date().getTime();
saveFlag = (lastTime + 5000) > nowTime; // 5s内的重复点击直接返回
if (saveFlag) {
return;
}
}
DraftTraining2ProgressWithBLOBs progressWithBLOBs = new DraftTraining2ProgressWithBLOBs();
progressWithBLOBs.setTrainingId(progressVo.getTrainingId());
progressWithBLOBs.setDescription(progressVo.getDescription());
progressWithBLOBs.setCreateTime(new Date());
// 地图定位
progressWithBLOBs.setMapLocationJson(progressVo.getMapLocationJson());
// 背景
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
StorageSimulation scenesSaving = new StorageSimulation(simulation, false);
progressWithBLOBs.setBgSceneJson(JsonUtils.writeValueAsString(scenesSaving));
progressWithBLOBs.setStepJson(JsonUtils.writeValueAsString(draftTraining2.getStepJson()));
progressWithBLOBs.setScoringRuleJson(draftTraining2.getScoringRuleJson());
progressWithBLOBs.setCreatorId(user.getId());
training2ProgressDao.insertSelective(progressWithBLOBs);
}
/**
* 读档操作
*/
public DraftTraining2ProgressVo readProgress(Long id, Long trainingId, String group) {
DraftTraining2ProgressWithBLOBs progresses = training2ProgressDao.selectByPrimaryKey(id);
if (!trainingId.equals(progresses.getTrainingId())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "非实训存档");
}
if (!StringUtils.isEmpty(progresses.getBgSceneJson())) {
groupSimulationService.loadScenes(group, progresses.getBgSceneJson());
} else {
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
// 重置仿真状态
simulationLifeCycleService.reset(simulation);
}
return DraftTraining2ProgressVo.convert2Vo(progresses);
}
/**
* 存档列表
*/
public PageVO<DraftTraining2ProgressVo> queryProgressList(Long trainingId, PageVO<DraftTraining2ProgressVo> pageVO) {
PageHelper.startPage(pageVO.getPageNum(), pageVO.getPageSize());
DraftTraining2ProgressExample example = new DraftTraining2ProgressExample();
example.createCriteria().andTrainingIdEqualTo(trainingId);
example.setOrderByClause("create_time desc");
Page<DraftTraining2ProgressWithBLOBs> pageInfo = (Page<DraftTraining2ProgressWithBLOBs>) training2ProgressDao.selectByExampleWithBLOBs(example);
return PageVO.convert(pageInfo, pageInfo.getResult().stream().map(p -> DraftTraining2ProgressVo.convert2Vo(p)).collect(Collectors.toList()));
}
/**
* 根据ID删除存档
*/
public void deleteProgressById(Long trainingId, Long id) {
DraftTraining2ProgressExample example = new DraftTraining2ProgressExample();
example.createCriteria().andTrainingIdEqualTo(trainingId).andIdEqualTo(id);
List<DraftTraining2ProgressWithBLOBs> list = training2ProgressDao.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(list)) {
return;
}
training2ProgressDao.deleteByPrimaryKey(id);
}
/**
* 删除该实训下所有的存档
*/
public void deleteAllProgress(Long trainingId) {
training2ProgressDao.deleteByTrainingId(trainingId);
}
}

View File

@ -0,0 +1,45 @@
package club.joylink.rtss.vo.training2.draft;
import club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.training2.Step2VO;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
/**
* 存档时
*/
@Data
public class DraftTraining2ProgressVo {
private Long id;
private Long trainingId;
private Date createTime;
private String description;
private String mapLocationJson;
private List<Step2VO> step2List;
public static DraftTraining2ProgressVo convert2Vo(DraftTraining2ProgressWithBLOBs progress){
if (progress == null) {
return null;
}
DraftTraining2ProgressVo vo = new DraftTraining2ProgressVo();
vo.setId(progress.getId());
vo.setTrainingId(progress.getTrainingId());
vo.setMapLocationJson(progress.getMapLocationJson());
if (StringUtils.isEmpty(progress.getStepJson())) {
vo.setStep2List(JsonUtils.readCollection(progress.getStepJson(),List.class,Step2VO.class));
}
vo.setDescription(progress.getDescription());
vo.setCreateTime(progress.getCreateTime());
return vo;
}
}

View File

@ -0,0 +1,309 @@
<?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="club.joylink.rtss.dao.DraftTraining2ProgressDao" >
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.training2.DraftTraining2Progress" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="training_id" property="trainingId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="creator_id" property="creatorId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs" extends="BaseResultMap" >
<result column="description" property="description" jdbcType="LONGVARCHAR" />
<result column="map_location_json" property="mapLocationJson" jdbcType="LONGVARCHAR" />
<result column="bg_scene_json" property="bgSceneJson" jdbcType="LONGVARCHAR" />
<result column="step_json" property="stepJson" jdbcType="LONGVARCHAR" />
<result column="scoring_rule_json" property="scoringRuleJson" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, training_id, create_time, creator_id
</sql>
<sql id="Blob_Column_List" >
description, map_location_json, bg_scene_json, step_json, scoring_rule_json
</sql>
<select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressExample" >
select
<if test="distinct" >
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_draft_training2_progress
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressExample" >
select
<if test="distinct" >
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from rts_draft_training2_progress
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from rts_draft_training2_progress
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from rts_draft_training2_progress
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByTrainingId" parameterType="java.lang.Long" >
delete from rts_draft_training2_progress
where training_id = #{trainingId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs" >
insert into rts_draft_training2_progress (id, training_id, create_time,
creator_id, description, map_location_json,
bg_scene_json, step_json, scoring_rule_json
)
values (#{id,jdbcType=BIGINT}, #{trainingId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{creatorId,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{mapLocationJson,jdbcType=LONGVARCHAR},
#{bgSceneJson,jdbcType=LONGVARCHAR}, #{stepJson,jdbcType=LONGVARCHAR}, #{scoringRuleJson,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs" >
insert into rts_draft_training2_progress
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="trainingId != null" >
training_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="creatorId != null" >
creator_id,
</if>
<if test="description != null" >
description,
</if>
<if test="mapLocationJson != null" >
map_location_json,
</if>
<if test="bgSceneJson != null" >
bg_scene_json,
</if>
<if test="stepJson != null" >
step_json,
</if>
<if test="scoringRuleJson != null" >
scoring_rule_json,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="trainingId != null" >
#{trainingId,jdbcType=BIGINT},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null" >
#{creatorId,jdbcType=BIGINT},
</if>
<if test="description != null" >
#{description,jdbcType=LONGVARCHAR},
</if>
<if test="mapLocationJson != null" >
#{mapLocationJson,jdbcType=LONGVARCHAR},
</if>
<if test="bgSceneJson != null" >
#{bgSceneJson,jdbcType=LONGVARCHAR},
</if>
<if test="stepJson != null" >
#{stepJson,jdbcType=LONGVARCHAR},
</if>
<if test="scoringRuleJson != null" >
#{scoringRuleJson,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByExampleSelective" parameterType="map" >
update rts_draft_training2_progress
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.trainingId != null" >
training_id = #{record.trainingId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.creatorId != null" >
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.description != null" >
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
<if test="record.mapLocationJson != null" >
map_location_json = #{record.mapLocationJson,jdbcType=LONGVARCHAR},
</if>
<if test="record.bgSceneJson != null" >
bg_scene_json = #{record.bgSceneJson,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepJson != null" >
step_json = #{record.stepJson,jdbcType=LONGVARCHAR},
</if>
<if test="record.scoringRuleJson != null" >
scoring_rule_json = #{record.scoringRuleJson,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map" >
update rts_draft_training2_progress
set id = #{record.id,jdbcType=BIGINT},
training_id = #{record.trainingId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT},
description = #{record.description,jdbcType=LONGVARCHAR},
map_location_json = #{record.mapLocationJson,jdbcType=LONGVARCHAR},
bg_scene_json = #{record.bgSceneJson,jdbcType=LONGVARCHAR},
step_json = #{record.stepJson,jdbcType=LONGVARCHAR},
scoring_rule_json = #{record.scoringRuleJson,jdbcType=LONGVARCHAR}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update rts_draft_training2_progress
set id = #{record.id,jdbcType=BIGINT},
training_id = #{record.trainingId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=BIGINT}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs" >
update rts_draft_training2_progress
<set >
<if test="trainingId != null" >
training_id = #{trainingId,jdbcType=BIGINT},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="description != null" >
description = #{description,jdbcType=LONGVARCHAR},
</if>
<if test="mapLocationJson != null" >
map_location_json = #{mapLocationJson,jdbcType=LONGVARCHAR},
</if>
<if test="bgSceneJson != null" >
bg_scene_json = #{bgSceneJson,jdbcType=LONGVARCHAR},
</if>
<if test="stepJson != null" >
step_json = #{stepJson,jdbcType=LONGVARCHAR},
</if>
<if test="scoringRuleJson != null" >
scoring_rule_json = #{scoringRuleJson,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.training2.DraftTraining2ProgressWithBLOBs" >
update rts_draft_training2_progress
set training_id = #{trainingId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT},
description = #{description,jdbcType=LONGVARCHAR},
map_location_json = #{mapLocationJson,jdbcType=LONGVARCHAR},
bg_scene_json = #{bgSceneJson,jdbcType=LONGVARCHAR},
step_json = #{stepJson,jdbcType=LONGVARCHAR},
scoring_rule_json = #{scoringRuleJson,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.training2.DraftTraining2Progress" >
update rts_draft_training2_progress
set training_id = #{trainingId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
creator_id = #{creatorId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>