Merge remote-tracking branch 'origin/master'

pull/1/head
xiaoCJ 2 years ago
commit 43048f4a66

@ -2,7 +2,9 @@ package com.sztzjy.forex.trading_trading;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication @SpringBootApplication
public class ForeignExchangeTradingApplication { public class ForeignExchangeTradingApplication {

@ -1,5 +1,8 @@
package com.sztzjy.forex.trading_trading.config.security; package com.sztzjy.forex.trading_trading.config.security;
import com.sztzjy.forex.trading_trading.util.file.IFileUtil;
import com.sztzjy.forex.trading_trading.util.file.LocalFileUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.context.support.ReloadableResourceBundleMessageSource;
@ -25,7 +28,10 @@ public class WebConfigurerAdapter implements WebMvcConfigurer {
@Resource @Resource
private StringHttpMessageConverter stringHttpMessageConverter; private StringHttpMessageConverter stringHttpMessageConverter;
@Value("${file.type}")
private String fileType;
@Value("${file.path}")
private String filePath;
@Bean @Bean
public CorsFilter corsFilter() { public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
@ -60,4 +66,13 @@ public class WebConfigurerAdapter implements WebMvcConfigurer {
} }
} }
} }
@Bean
public IFileUtil getFileUtil() {
if (fileType.equals("local")) {
return new LocalFileUtil(filePath);
} else {
throw new IllegalArgumentException("未知文件工具类注入类型");
}
}
} }

@ -1,13 +1,20 @@
package com.sztzjy.forex.trading_trading.controller; package com.sztzjy.forex.trading_trading.controller;
import com.github.pagehelper.PageInfo;
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess; import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
import com.sztzjy.forex.trading_trading.annotation.Permission;
import com.sztzjy.forex.trading_trading.annotation.aspect.PermissionType;
import com.sztzjy.forex.trading_trading.dto.MemberVO;
import com.sztzjy.forex.trading_trading.entity.Member; import com.sztzjy.forex.trading_trading.entity.Member;
import com.sztzjy.forex.trading_trading.service.MemberService; import com.sztzjy.forex.trading_trading.service.MemberService;
import com.sztzjy.forex.trading_trading.util.ResultEntity;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RestController; import java.io.FileNotFoundException;
@RestController @RestController
@ -19,8 +26,31 @@ public class MemberController {
@AnonymousAccess @AnonymousAccess
@PostMapping("getMember") @PostMapping("getMember")
public Member getMember(@RequestBody String memberId){ public Member getMember(@RequestBody String memberId) {
Member member = memberService.selectByPrimaryKey(memberId); Member member = memberService.selectByPrimaryKey(memberId);
return member; return member;
} }
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH)
@ApiOperation("教师端----首页用户操作数据展示(分页)")
@GetMapping("pagedListMembers")
public ResultEntity<PageInfo<MemberVO>> pagedListMembers(@ApiParam("班级名称") String className,
@ApiParam("实训名称") String trainingName,
@ApiParam("评分状态") Integer markStatus,
@ApiParam("查询关键字:学号或学生名称") String keyword) {
PageInfo<MemberVO> pageInfo = memberService.pagedListMembers(className, trainingName, markStatus, keyword);
return new ResultEntity<PageInfo<MemberVO>>(pageInfo);
}
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH)
@ApiOperation("教师端首页排行榜数据导出")
@GetMapping("exportMembers")
public void exportMembers(@ApiParam("班级名称") String className,
@ApiParam("实训名称") String trainingName,
@ApiParam("评分状态") Integer markStatus,
@ApiParam("查询关键字:学号或学生名称") String keyword,
HttpServletResponse response) throws FileNotFoundException {
memberService.exportMembers(className, trainingName, markStatus, keyword, response);
}
} }

@ -64,12 +64,14 @@ public class TrainingController {
} }
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_DEL) @Permission(codes = PermissionType.TRAINING_MANAGEMENT_DEL)
@ApiOperation("教师端----删除一条实训记录") @ApiOperation("教师端----删除指定实训记录")
@PostMapping("deleteById") @PostMapping("deleteById")
public ResultEntity deleteById(@ApiParam("实训记录id") @RequestParam String trainingId) { public ResultEntity deleteById(@ApiParam("实训记录id") @RequestParam String trainingId) {
trainingService.delete(trainingId); trainingService.delete(trainingId);
//TODO 同步删除member表数据 //TODO 同步删除member表数据
// memberService
return new ResultEntity(HttpStatus.OK); return new ResultEntity(HttpStatus.OK);
} }
@ -87,7 +89,7 @@ public class TrainingController {
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH) @Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH)
@ApiOperation("教师端----根据实训记录id查询实训记录") @ApiOperation("教师端----根据实训记录id查询实训记录")
@GetMapping("training/{id}") @GetMapping
public ResultEntity<Training> get(@ApiParam("实训记录id") public ResultEntity<Training> get(@ApiParam("实训记录id")
@PathVariable String id) { @PathVariable String id) {
//TODO 后续还有根据实训id查看排行榜等需求待实现 //TODO 后续还有根据实训id查看排行榜等需求待实现
@ -115,7 +117,7 @@ public class TrainingController {
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_ADD) @Permission(codes = PermissionType.TRAINING_MANAGEMENT_ADD)
@ApiOperation("教师端----添加实训成员时用:获取班级列表") @ApiOperation("教师端----添加实训成员时用:获取班级列表")
@GetMapping("findClassNameList") @GetMapping("findClassNameList")
public ResultEntity<List<Map<String, Object>>> findClassNameList(Integer majorId) { public ResultEntity<List<Map<String, Object>>> findClassNameList(@ApiParam("专业Id") Integer majorId) {
JwtUser currentUser = TokenProvider.getJWTUser(request); JwtUser currentUser = TokenProvider.getJWTUser(request);
List<Map<String, Object>> mapList; List<Map<String, Object>> mapList;
if (majorId == null || majorId == 0) { if (majorId == null || majorId == 0) {
@ -219,4 +221,19 @@ public class TrainingController {
String username = currentUser.getUsername(); String username = currentUser.getUsername();
return new ResultEntity<PageInfo<Training>>(HttpStatus.OK, trainingService.findTrainingList(index,size,schoolId, username)); return new ResultEntity<PageInfo<Training>>(HttpStatus.OK, trainingService.findTrainingList(index,size,schoolId, username));
} }
// @Permission(codes = PermissionType.TRAINING_MANAGEMENT_ADD)
// @ApiOperation("设置成绩权重")
// @PostMapping("/setScoreWeight")
// public ResultEntity setScoreWeight(@ApiParam("成绩权重") @RequestParam String scoreWeight) {
// Assert.notNull(trainingId, "实训记录不存在");
// Assert.notNull(scoreWeight, "成绩权重不能为空");
// Training training = trainingService.findById(trainingId);
// Assert.notNull(training, "实训记录不存在");
// training.setScoreWeight(scoreWeight);
// trainingService.updateById(training);
// return new ResultEntity(HttpStatus.OK);
// }
} }

@ -0,0 +1,40 @@
package com.sztzjy.forex.trading_trading.dto;
import com.sztzjy.forex.trading_trading.entity.Member;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@ApiModel("教师端用户操作数据出参")
@Getter
@Setter
@Data
public class MemberVO {
@ApiModelProperty("实训名称")
public String trainingName;
@ApiModelProperty("班级名称")
public String classGrade;
@ApiModelProperty("学生姓名")
public String name;
@ApiModelProperty("学生学号")
public String studentNumber;
@ApiModelProperty("累计收益")
public Double cumulativeProfitLoss;
@ApiModelProperty("收益率")
public Double yield;
@ApiModelProperty("交易实训成绩")
public Double tradeTrainingScore;
@ApiModelProperty("实训报告成绩")
public Double trainingReportScore;
@ApiModelProperty("总成绩")
public Double totalScore;
@ApiModelProperty("排名")
public Integer stuRank;
}

@ -1,5 +1,6 @@
package com.sztzjy.forex.trading_trading.mappers; package com.sztzjy.forex.trading_trading.mappers;
import com.sztzjy.forex.trading_trading.dto.MemberVO;
import com.sztzjy.forex.trading_trading.entity.Member; import com.sztzjy.forex.trading_trading.entity.Member;
import com.sztzjy.forex.trading_trading.entity.MemberExample; import com.sztzjy.forex.trading_trading.entity.MemberExample;
import java.util.List; import java.util.List;
@ -60,6 +61,10 @@ public interface MemberMapper {
*/ */
List<Member> selectByExample(MemberExample example); List<Member> selectByExample(MemberExample example);
List<MemberVO> pagedListMembers(MemberExample example);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_member * This method corresponds to the database table sys_member

@ -10,6 +10,7 @@ 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; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@Mapper @Mapper
public interface TrainingMapper { public interface TrainingMapper {
@ -110,4 +111,23 @@ public interface TrainingMapper {
@Select("select training_id,training_name from sys_training where school_id=#{schoolId}") @Select("select training_id,training_name from sys_training where school_id=#{schoolId}")
List<Map<String, Object>> selectTrainingNameList(@Param("schoolId") Integer schoolId); List<Map<String, Object>> selectTrainingNameList(@Param("schoolId") Integer schoolId);
@Update("UPDATE sys_training " +
"SET status = " +
"CASE " +
" WHEN NOW() > end_time AND status <> 'FINISHED' THEN 'FINISHED' " +
" WHEN NOW() < start_time AND status <> 'NOT_STARTED' THEN 'NOT_STARTED' " +
" WHEN NOW() >= start_time AND NOW() <= end_time AND status <> 'ONGOING' THEN 'ONGOING' " +
" ELSE status limit 1" +
" END")
void updateTrainingStatus();
@Update("UPDATE sys_training " +
"SET status = 'FINISHED' " +
"WHERE NOW() > end_time AND status <> 'FINISHED'")
void updateTrainingStatusToEnd();
@Update("UPDATE sys_training " +
"SET status = 'ONGOING' " +
"WHERE NOW() >= start_time AND NOW() <= end_time AND status <> 'ONGOING'")
void updateTrainingStatusToInProgress();
} }

@ -1,17 +1,32 @@
package com.sztzjy.forex.trading_trading.service; package com.sztzjy.forex.trading_trading.service;
import com.github.pagehelper.PageInfo;
import com.sztzjy.forex.trading_trading.dto.MemberVO;
import com.sztzjy.forex.trading_trading.entity.Member; import com.sztzjy.forex.trading_trading.entity.Member;
import com.sztzjy.forex.trading_trading.entity.MemberExample; import com.sztzjy.forex.trading_trading.entity.MemberExample;
import com.sztzjy.forex.trading_trading.mappers.MemberMapper; import com.sztzjy.forex.trading_trading.mappers.MemberMapper;
import com.sztzjy.forex.trading_trading.util.excel.ExcelData;
import com.sztzjy.forex.trading_trading.util.excel.ExcelProvider;
import com.sztzjy.forex.trading_trading.util.file.IFileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Service @Service
public class MemberService { public class MemberService {
@Autowired @Autowired
MemberMapper memberMapper; MemberMapper memberMapper;
@Autowired
IFileUtil fileUtil;
public Member getMemberByMemberIdAndTrainingId(String memberId, String trainingId) { public Member getMemberByMemberIdAndTrainingId(String memberId, String trainingId) {
MemberExample example = new MemberExample(); MemberExample example = new MemberExample();
@ -37,11 +52,84 @@ public class MemberService {
} }
} }
public void insert(Member member){ public void insert(Member member) {
memberMapper.insert(member); memberMapper.insert(member);
} }
public void deleteById(String memberId){ public void deleteById(String memberId) {
memberMapper.deleteByPrimaryKey(memberId); memberMapper.deleteByPrimaryKey(memberId);
} }
public PageInfo<MemberVO> pagedListMembers(String className,
String trainingName,
Integer markStatus,
String keyword) {
MemberExample example = new MemberExample();
MemberExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(className)) {
criteria.andClassGradeEqualTo(className);
}
if (StringUtils.hasText(trainingName)) {
criteria.andTrainingNameEqualTo(trainingName);
}
if (markStatus != null) {
//TODO 待确定评分状态
}
if (StringUtils.hasText(keyword)) {
criteria.andNameLike("%" + keyword + "%");
MemberExample.Criteria orCriteria = example.createCriteria();
orCriteria.andStudentNumberEqualTo("%" + keyword + "%");
example.or(orCriteria);
}
return new PageInfo<>(memberMapper.pagedListMembers(example));
}
public void exportMembers(String className,
String trainingName,
Integer markStatus,
String keyword,
HttpServletResponse response) throws FileNotFoundException {
MemberExample example = new MemberExample();
MemberExample.Criteria criteria = example.createCriteria();
if (StringUtils.hasText(className)) {
criteria.andClassGradeEqualTo(className);
}
if (StringUtils.hasText(trainingName)) {
criteria.andTrainingNameEqualTo(trainingName);
}
if (markStatus != null) {
//TODO 待确定评分状态
}
if (StringUtils.hasText(keyword)) {
criteria.andNameLike("%" + keyword + "%");
MemberExample.Criteria orCriteria = example.createCriteria();
orCriteria.andStudentNumberEqualTo("%" + keyword + "%");
example.or(orCriteria);
}
List<MemberVO> members = memberMapper.pagedListMembers(example);
Assert.notNull(members, "没有可导出数据");
List<String> titles = Arrays.asList("实训任务名称", "班级", "学号", "姓名", "排名", "累计盈亏", "收益率", "模拟交易实训成绩", "实训报告成绩", "总成绩");
ExcelData excelData = ExcelData.create(titles);
for (MemberVO member : members) {
List<Object> rows = new ArrayList<>();
rows.add(member.getTrainingName());
rows.add(member.getClassGrade());
rows.add(member.getStudentNumber());
rows.add(member.getName());
rows.add(member.getStuRank());
rows.add(member.getCumulativeProfitLoss());
rows.add(member.getYield());
rows.add(member.getTradeTrainingScore());
rows.add(member.getTrainingReportScore());
rows.add(member.getTotalScore());
excelData.addRow(rows) ;
}
String fileName = "学生排行榜数据.xlsx";
String file = fileUtil.getFullPath(fileName);
FileOutputStream fileOut = new FileOutputStream(file);
ExcelProvider.SimpleExcelExport(excelData, fileOut);
fileUtil.download(response, fileName);
fileUtil.remove(file);
}
} }

@ -0,0 +1,24 @@
package com.sztzjy.forex.trading_trading.service;
import com.sztzjy.forex.trading_trading.mappers.TrainingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class ScheduledTask {
@Autowired
TrainingMapper trainingMapper;
@Scheduled(cron = "0 * * * * *") // 修改实训状态 每分钟执行一次
public void updateTrainingStatus() {
trainingMapper.updateTrainingStatusToInProgress();
trainingMapper.updateTrainingStatusToEnd();
}
}

@ -0,0 +1,45 @@
package com.sztzjy.forex.trading_trading.util.excel;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Excel
*
*/
@Getter
public class ExcelData {
private List<List<String>> contents;
private ExcelData(){
this.contents = new ArrayList<>();
}
public ExcelData addRow(List<Object> rowData){
List<String> dataList = rowData.stream().map(i -> i==null?null:i.toString()).collect(Collectors.toList());
this.contents.add(dataList);
return this;
}
/**
*
*
* @return /
*/
public static ExcelData create(){
return ExcelData.create(null);
}
/**
*
* @param titleList |
* @return
*/
public static ExcelData create(List<String> titleList){
ExcelData excelData = new ExcelData();
if(titleList!=null && !titleList.isEmpty())
excelData.contents.add(titleList);
return excelData;
}
}

@ -0,0 +1,39 @@
package com.sztzjy.forex.trading_trading.util.excel;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Arrays;
public class ExcelProvider {
private static Logger logger = LoggerFactory.getLogger(ExcelProvider.class);
/**
* excel
* excel
*
* @param data
*/
public static void SimpleExcelExport(ExcelData data, OutputStream out){
Assert.notNull(data, "无可导出的数据");
Assert.notEmpty(data.getContents(), "无可导出的数据");
ExcelWriter bigWriter = ExcelUtil.getBigWriter();
bigWriter.write(data.getContents());
bigWriter.flush(out,true);
}
public static void main(String[] args) throws Exception {
ExcelData excelData = ExcelData.create(Arrays.asList("t1","t2"))
.addRow(Arrays.asList("11","12"))
.addRow(Arrays.asList("21","22"));
FileOutputStream fileOut = new FileOutputStream("D:/111.xlsx");
ExcelProvider.SimpleExcelExport(excelData,fileOut);
fileOut.close();
}
}

@ -0,0 +1,87 @@
package com.sztzjy.forex.trading_trading.util.file;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
/**
*
*
* @author
*/
public interface IFileUtil {
/**
* http
*
* @param file formhttp
* @return
*/
String upload(MultipartFile file);
/**
*
*
* @param objectName
* @param fileIn
* @return
*/
String upload(String objectName, InputStream fileIn);
/**
*
*
* @param path
* @return true
*/
boolean remove(String path);
/**
*
*
* @param response
* @param fileName
* @param filePath
*/
void download(HttpServletResponse response, String fileName, String filePath);
/**
*
*
* @param response
* @param filePath
*/
void download(HttpServletResponse response, String filePath);
/**
*
*
* @param relativePath
* @return
*/
String getFullPath(String relativePath);
/**
*
*
* @param fileName
* @return suffix
*/
String getSuffix(String fileName);
/**
*
*
* @param fileName
* @param suffix
* @return
*/
String getDiskRelativePath(String fileName, String suffix);
}

@ -0,0 +1,175 @@
package com.sztzjy.forex.trading_trading.util.file;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.IdUtil;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class LocalFileUtil implements IFileUtil{
private final static List<String> excludeSp = Arrays.asList("exe", "bin", "sh");
private final String localPath;
public LocalFileUtil(String localPath) {
this.localPath = localPath;
}
@Override
public String upload(MultipartFile file) {
return upload(null, file);
}
@Override
public String upload(String objectName, InputStream fileIn) {
Assert.notNull(fileIn, "文件不能为空");
Assert.hasText(objectName, "文件名为空");
Assert.isTrue(objectName.lastIndexOf(".") > 0, "文件名称需携带扩展后缀");
FileOutputStream out = null;
try {
String relativePath = getDiskRelativePath(objectName, null);
File file = new File(getFullPath(relativePath));
file.getParentFile().mkdirs();
out = new FileOutputStream(file);
byte[] buff = new byte[4096];
int len;
while ((len = fileIn.read(buff)) != -1) {
out.write(buff, 0, len);
}
out.flush();
return relativePath;
} catch (IOException e) {
e.printStackTrace();
throw new IllegalArgumentException("上传文件失败,IO错误");
} finally {
try {
fileIn.close();
if (out != null) out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public boolean remove(String path) {
if (!StringUtils.hasText(path)) return false;
File file = new File(getFullPath(path));
Assert.isTrue(file.exists(), "文件已被删除或不存在该文件");
return file.delete();
}
@Override
public void download(HttpServletResponse response, String fileName, String relativePath) {
Assert.hasText(relativePath, "路径为空");
System.out.println("------------------------------------" + getFullPath(relativePath));
File file = new File(getFullPath(relativePath));
Assert.isTrue(file.exists(), "附件不存在");
String sp = relativePath.substring(relativePath.lastIndexOf(".") + 1);
Assert.isTrue(!excludeSp.contains(sp.toLowerCase()), "文件类型错误");
if (!StringUtils.hasText(fileName)) {
fileName = file.getName().substring(0, file.getName().lastIndexOf("."));
}
InputStream fis = null;
try {
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode((fileName + "." + sp), CharsetUtil.UTF_8));
fis = new BufferedInputStream(Files.newInputStream(file.toPath()));
response.addHeader("Content-Length", String.valueOf(fis.available()));
byte[] buff = new byte[4096];
int len;
while ((len = fis.read(buff)) != -1) {
response.getOutputStream().write(buff, 0, len);
}
} catch (Exception e) {
throw new IllegalArgumentException("下载文件失败: " + e.getMessage());
} finally {
try {
if (fis != null) fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void download(HttpServletResponse response, String relativePath) {
download(response, null, relativePath);
}
@Override
public String getFullPath(String relativePath) {
if (!relativePath.startsWith("/")) {
relativePath = "/" + relativePath;
}
return localPath + relativePath;
}
@Override
public String getSuffix(String fileName) {
Assert.hasText(fileName, "文件名不存在!");
if (fileName.lastIndexOf(".") < 0) {
return null;
}
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
public String upload(String fileName, MultipartFile file) {
return upload(fileName, file, null);
}
@Override
public String getDiskRelativePath(String fileName, String suffix) {
Calendar c = Calendar.getInstance();
Date d = new Date();
c.setTime(d);
String year = Integer.toString(c.get(Calendar.YEAR));
String month = Integer.toString(c.get(Calendar.MONTH) + 1);
String day = Integer.toString(c.get(Calendar.DATE));
StringBuilder path = new StringBuilder();
path.append("/").append(year)
.append("/").append(month)
.append("/").append(day)
.append("/").append(fileName);
if (StringUtils.hasText(suffix)) path.append(".").append(suffix);
return path.toString();
}
private String upload(String fileName, MultipartFile file, String relativePath) {
Assert.isTrue(!file.isEmpty(), "文件不存在");
String originalFilename = file.getOriginalFilename();
if (fileName == null) fileName = IdUtil.simpleUUID();
String sp = getSuffix(originalFilename);
Assert.notNull(sp, "文件类型错误");
Assert.isTrue(!excludeSp.contains(sp.toLowerCase()), "文件类型错误");
try {
String filePath;
if (relativePath == null) {
filePath = getDiskRelativePath(fileName, sp);
} else {
relativePath = relativePath.endsWith("/") ? relativePath : relativePath + "/";
filePath = relativePath + fileName + "." + sp;
}
File destFile = new File(getFullPath(filePath));
destFile.getParentFile().mkdirs();
file.transferTo(destFile);
return filePath;
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("上传文件失败,FileNotFound错误");
} catch (IOException e) {
throw new IllegalArgumentException("上传文件失败,IO错误");
}
}
}

@ -5,4 +5,10 @@ spring:
url: jdbc:mysql://${DB_HOST:118.31.7.2}:${DB_PORT:3306}/${DB_NAME:foreign_exchange_trading}?useSSL=false&serverTimezone=UTC url: jdbc:mysql://${DB_HOST:118.31.7.2}:${DB_PORT:3306}/${DB_NAME:foreign_exchange_trading}?useSSL=false&serverTimezone=UTC
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:sztzjy2017} password: ${DB_PWD:sztzjy2017}
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# 文件存储
file:
type: local
path: D:/home/planting_inspect/file

@ -5,4 +5,10 @@ spring:
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:foreign_exchange_trading}?useSSL=false&serverTimezone=UTC url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:foreign_exchange_trading}?useSSL=false&serverTimezone=UTC
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:sztzjy2017} password: ${DB_PWD:sztzjy2017}
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# 文件存储
file:
type: local
path: /home/foreignExchangeTrading/file

@ -26,7 +26,8 @@
<!-- 需要生成的表 --> <!-- 需要生成的表 -->
<!-- <table tableName="sys_member" domainObjectName="Member" />--> <!-- <table tableName="sys_member" domainObjectName="Member" />-->
<!-- <table tableName="sys_take_stash" domainObjectName="TakeStash" />--> <!-- <table tableName="sys_take_stash" domainObjectName="TakeStash" />-->
<table tableName="sys_pending_order" domainObjectName="PendingOrder" /> <!-- <table tableName="sys_pending_order" domainObjectName="PendingOrder" />-->
<table tableName="sys_grade_weight" domainObjectName="GradeWeight" />
</context> </context>

@ -127,6 +127,25 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="pagedListMembers" parameterType="com.sztzjy.forex.trading_trading.entity.MemberExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 30 14:15:42 CST 2023.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_member
<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.String" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated

@ -1,411 +1,429 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="com.sztzjy.forex.trading_trading.mappers.TrainingMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.forex.trading_trading.entity.Training"> <resultMap id="BaseResultMap" type="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 18:43:01 CST 2023. This element was generated on Thu Jun 29 18:43:01 CST 2023.
--> -->
<id column="training_id" jdbcType="VARCHAR" property="trainingId" /> <id column="training_id" jdbcType="VARCHAR" 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="creator_id" jdbcType="INTEGER" property="creatorId" /> <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="creator_name" jdbcType="VARCHAR" property="creatorName"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="school_id" jdbcType="INTEGER" property="schoolId" /> <result column="school_id" jdbcType="INTEGER" property="schoolId"/>
</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 18:43:01 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">
<if test="criteria.valid"> <if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")"> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion"> <foreach collection="criteria.criteria" item="criterion">
<choose> <choose>
<when test="criterion.noValue"> <when test="criterion.noValue">
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
#{listItem} separator=",">
</foreach> #{listItem}
</when> </foreach>
</choose> </when>
</choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</trim> </where>
</if> </sql>
</foreach> <sql id="Update_By_Example_Where_Clause">
</where> <!--
</sql> WARNING - @mbg.generated
<sql id="Update_By_Example_Where_Clause"> This element is automatically generated by MyBatis Generator, do not modify.
<!-- This element was generated on Thu Jun 29 18:43:01 CST 2023.
WARNING - @mbg.generated -->
This element is automatically generated by MyBatis Generator, do not modify. <where>
This element was generated on Thu Jun 29 18:43:01 CST 2023. <foreach collection="example.oredCriteria" item="criteria" separator="or">
--> <if test="criteria.valid">
<where> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="criteria.criteria" item="criterion">
<if test="criteria.valid"> <choose>
<trim prefix="(" prefixOverrides="and" suffix=")"> <when test="criterion.noValue">
<foreach collection="criteria.criteria" item="criterion"> and ${criterion.condition}
<choose> </when>
<when test="criterion.noValue"> <when test="criterion.singleValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.listValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition}
</when> <foreach close=")" collection="criterion.value" item="listItem" open="("
<when test="criterion.listValue"> separator=",">
and ${criterion.condition} #{listItem}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> </foreach>
#{listItem} </when>
</foreach> </choose>
</when> </foreach>
</choose> </trim>
</if>
</foreach> </foreach>
</trim> </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, 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.String" 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=VARCHAR}
</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, school_id
)
values (#{trainingId,jdbcType=VARCHAR}, #{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="schoolId != null">
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="schoolId != null">
#{schoolId,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> </if>
</foreach> </select>
</where> <update id="updateByExampleSelective" parameterType="map">
</sql> <!--
<sql id="Base_Column_List"> WARNING - @mbg.generated
<!-- This element is automatically generated by MyBatis Generator, do not modify.
WARNING - @mbg.generated This element was generated on Thu Jun 29 18:43:01 CST 2023.
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, people_count, start_time, end_time, status, creator_id, create_school, <if test="record.trainingId != null">
training_name, creator_name, create_time, update_time, school_id training_id = #{record.trainingId,jdbcType=VARCHAR},
</sql> </if>
<select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultMap="BaseResultMap"> <if test="record.peopleCount != null">
<!-- people_count = #{record.peopleCount,jdbcType=INTEGER},
WARNING - @mbg.generated </if>
This element is automatically generated by MyBatis Generator, do not modify. <if test="record.startTime != null">
This element was generated on Thu Jun 29 18:43:01 CST 2023. start_time = #{record.startTime,jdbcType=VARCHAR},
--> </if>
select <if test="record.endTime != null">
<if test="distinct"> end_time = #{record.endTime,jdbcType=TIMESTAMP},
distinct </if>
</if> <if test="record.status != null">
<include refid="Base_Column_List" /> status = #{record.status,jdbcType=VARCHAR},
from sys_training </if>
<if test="_parameter != null"> <if test="record.creatorId != null">
<include refid="Example_Where_Clause" /> creator_id = #{record.creatorId,jdbcType=INTEGER},
</if> </if>
<if test="orderByClause != null"> <if test="record.createSchool != null">
order by ${orderByClause} create_school = #{record.createSchool,jdbcType=VARCHAR},
</if> </if>
</select> <if test="record.trainingName != null">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> training_name = #{record.trainingName,jdbcType=VARCHAR},
<!-- </if>
WARNING - @mbg.generated <if test="record.creatorName != null">
This element is automatically generated by MyBatis Generator, do not modify. creator_name = #{record.creatorName,jdbcType=VARCHAR},
This element was generated on Thu Jun 29 18:43:01 CST 2023. </if>
--> <if test="record.createTime != null">
select create_time = #{record.createTime,jdbcType=TIMESTAMP},
<include refid="Base_Column_List" /> </if>
from sys_training <if test="record.updateTime != null">
where training_id = #{trainingId,jdbcType=VARCHAR} update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</select> </if>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <if test="record.schoolId != null">
<!-- school_id = #{record.schoolId,jdbcType=INTEGER},
WARNING - @mbg.generated </if>
This element is automatically generated by MyBatis Generator, do not modify. </set>
This element was generated on Thu Jun 29 18:43:01 CST 2023. <if test="_parameter != null">
--> <include refid="Update_By_Example_Where_Clause"/>
delete from sys_training </if>
where training_id = #{trainingId,jdbcType=INTEGER} </update>
</delete> <update id="updateByExample" parameterType="map">
<delete id="deleteByExample" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample"> <!--
<!-- 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 18:43:01 CST 2023.
This element was generated on Thu Jun 29 18:43:01 CST 2023. -->
--> update sys_training
delete from sys_training set training_id = #{record.trainingId,jdbcType=INTEGER},
<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, school_id
)
values (#{trainingId,jdbcType=VARCHAR}, #{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="schoolId != null">
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="schoolId != null">
#{schoolId,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=VARCHAR},
</if>
<if test="record.peopleCount != null">
people_count = #{record.peopleCount,jdbcType=INTEGER}, people_count = #{record.peopleCount,jdbcType=INTEGER},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=VARCHAR}, start_time = #{record.startTime,jdbcType=VARCHAR},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR}, status = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=INTEGER}, creator_id = #{record.creatorId,jdbcType=INTEGER},
</if>
<if test="record.createSchool != null">
create_school = #{record.createSchool,jdbcType=VARCHAR}, create_school = #{record.createSchool,jdbcType=VARCHAR},
</if>
<if test="record.trainingName != null">
training_name = #{record.trainingName,jdbcType=VARCHAR}, training_name = #{record.trainingName,jdbcType=VARCHAR},
</if>
<if test="record.creatorName != null">
creator_name = #{record.creatorName,jdbcType=VARCHAR}, creator_name = #{record.creatorName,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if> school_id = #{record.schoolId,jdbcType=INTEGER}
<if test="record.schoolId != null"> <if test="_parameter != null">
school_id = #{record.schoolId,jdbcType=INTEGER}, <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</set> </update>
<if test="_parameter != null"> <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training">
<include refid="Update_By_Example_Where_Clause" /> <!--
</if> WARNING - @mbg.generated
</update> This element is automatically generated by MyBatis Generator, do not modify.
<update id="updateByExample" parameterType="map"> This element was generated on Thu Jun 29 18:43:01 CST 2023.
<!-- -->
WARNING - @mbg.generated update sys_training
This element is automatically generated by MyBatis Generator, do not modify. <set>
This element was generated on Thu Jun 29 18:43:01 CST 2023. <if test="peopleCount != null">
--> people_count = #{peopleCount,jdbcType=INTEGER},
update sys_training </if>
set training_id = #{record.trainingId,jdbcType=INTEGER}, <if test="startTime != null">
people_count = #{record.peopleCount,jdbcType=INTEGER}, start_time = #{startTime,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=VARCHAR}, </if>
end_time = #{record.endTime,jdbcType=TIMESTAMP}, <if test="endTime != null">
status = #{record.status,jdbcType=VARCHAR}, end_time = #{endTime,jdbcType=TIMESTAMP},
creator_id = #{record.creatorId,jdbcType=INTEGER}, </if>
create_school = #{record.createSchool,jdbcType=VARCHAR}, <if test="status != null">
training_name = #{record.trainingName,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
creator_name = #{record.creatorName,jdbcType=VARCHAR}, </if>
create_time = #{record.createTime,jdbcType=TIMESTAMP}, <if test="creatorId != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, creator_id = #{creatorId,jdbcType=INTEGER},
school_id = #{record.schoolId,jdbcType=INTEGER} </if>
<if test="_parameter != null"> <if test="createSchool != null">
<include refid="Update_By_Example_Where_Clause" /> create_school = #{createSchool,jdbcType=VARCHAR},
</if> </if>
</update> <if test="trainingName != null">
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.forex.trading_trading.entity.Training"> training_name = #{trainingName,jdbcType=VARCHAR},
<!-- </if>
WARNING - @mbg.generated <if test="creatorName != null">
This element is automatically generated by MyBatis Generator, do not modify. creator_name = #{creatorName,jdbcType=VARCHAR},
This element was generated on Thu Jun 29 18:43:01 CST 2023. </if>
--> <if test="createTime != null">
update sys_training create_time = #{createTime,jdbcType=TIMESTAMP},
<set> </if>
<if test="peopleCount != null"> <if test="updateTime != null">
people_count = #{peopleCount,jdbcType=INTEGER}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="startTime != null"> <if test="schoolId != null">
school_id = #{schoolId,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}, start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=INTEGER}, creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createSchool != null">
create_school = #{createSchool,jdbcType=VARCHAR}, create_school = #{createSchool,jdbcType=VARCHAR},
</if>
<if test="trainingName != null">
training_name = #{trainingName,jdbcType=VARCHAR}, training_name = #{trainingName,jdbcType=VARCHAR},
</if>
<if test="creatorName != null">
creator_name = #{creatorName,jdbcType=VARCHAR}, creator_name = #{creatorName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> school_id = #{schoolId,jdbcType=INTEGER}
<if test="schoolId != null"> where training_id = #{trainingId,jdbcType=INTEGER}
school_id = #{schoolId,jdbcType=INTEGER}, </update>
</if> <select id="selectByPage" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample"
</set> resultMap="BaseResultMap">
where training_id = #{trainingId,jdbcType=INTEGER} select * from training
</update> <where>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.forex.trading_trading.entity.Training"> <!--待确认过滤条件-->
<!-- </where>
WARNING - @mbg.generated <if test="orderByClause != null and orderByClause != ''">
This element is automatically generated by MyBatis Generator, do not modify. <bind name="safeOrderByClause" value="${orderByClause}"/>
This element was generated on Thu Jun 29 18:43:01 CST 2023. ORDER BY ${safeOrderByClause}
--> </if>
update sys_training
set people_count = #{peopleCount,jdbcType=INTEGER}, limit #{offset}, #{pageSize}
start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=TIMESTAMP}, </select>
status = #{status,jdbcType=VARCHAR}, <update id="updateTrainingStatus">
creator_id = #{creatorId,jdbcType=INTEGER}, <![CDATA[
create_school = #{createSchool,jdbcType=VARCHAR}, UPDATE training
training_name = #{trainingName,jdbcType=VARCHAR}, SET status =
creator_name = #{creatorName,jdbcType=VARCHAR}, CASE
create_time = #{createTime,jdbcType=TIMESTAMP}, WHEN NOW() > end_time THEN 'FINISHED'
update_time = #{updateTime,jdbcType=TIMESTAMP}, WHEN NOW() < start_time THEN 'NOT_STARTED'
school_id = #{schoolId,jdbcType=INTEGER} ELSE 'ONGOING'
where training_id = #{trainingId,jdbcType=INTEGER} END
</update> ]]>
<select id="selectByPage" parameterType="com.sztzjy.forex.trading_trading.entity.TrainingExample" resultMap="BaseResultMap"> </update>
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