新增redis工具类 挂单部分功能 交易挂单开仓

pull/1/head
yz 2 years ago
parent 3c90a2b7be
commit f261a8a684

@ -30,6 +30,12 @@
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>2.7.12</version>
</dependency>
<!-- 分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>

@ -0,0 +1,41 @@
package com.sztzjy.forex.trading_trading.config.redis;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String, Object> template(RedisConnectionFactory factory) {
// 创建RedisTemplate<String, Object>对象
RedisTemplate<String, Object> template = new RedisTemplate<>();
// 配置连接工厂
template.setConnectionFactory(factory);
// 定义Jackson2JsonRedisSerializer序列化对象
Jackson2JsonRedisSerializer<Object> jacksonSeial = new Jackson2JsonRedisSerializer<>(Object.class);
ObjectMapper om = new ObjectMapper();
// 指定要序列化的域field,get和set,以及修饰符范围ANY是都有包括private和public
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// 指定序列化输入的类型类必须是非final修饰的final修饰的类比如String,Integer等会报异常
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jacksonSeial.setObjectMapper(om);
StringRedisSerializer stringSerial = new StringRedisSerializer();
// redis key 序列化方式使用stringSerial
template.setKeySerializer(stringSerial);
// redis value 序列化方式使用jackson
template.setValueSerializer(jacksonSeial);
// redis hash key 序列化方式使用stringSerial
template.setHashKeySerializer(stringSerial);
// redis hash value 序列化方式使用jackson
template.setHashValueSerializer(jacksonSeial);
template.afterPropertiesSet();
return template;
}
}

@ -0,0 +1,86 @@
package com.sztzjy.forex.trading_trading.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
import com.sztzjy.forex.trading_trading.entity.PendingOrder;
import com.sztzjy.forex.trading_trading.service.PendingOrderService;
import com.sztzjy.forex.trading_trading.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
import java.util.Set;
@RestController
@RequestMapping("api/pendingOrder")
public class PendingOrderController {
@Autowired
PendingOrderService pendingOrderService;
@Autowired
RedisUtil redisUtil;
//查询挂单数据
@AnonymousAccess
@PostMapping("getPendingOrder")
public List<PendingOrder> getPendingOrder(@RequestBody JSONObject jsonObject){
String trainingId = String.valueOf(jsonObject.get("trainingId"));
String memberId = String.valueOf(jsonObject.get("memberId"));
PendingOrder pendingOrder=new PendingOrder();
pendingOrder.setStatus(0);
pendingOrder.setTrainingId(trainingId);
pendingOrder.setMemberId(memberId);
List<PendingOrder> pendingOrders = pendingOrderService.selectByExample(pendingOrder);
return pendingOrders;
}
//撤单 撤单成功后 根据pendingOrderId删除redis键
public JSONObject cancelOrder(@RequestBody String pendingOrderId){
PendingOrder pendingOrder=new PendingOrder();
pendingOrder.setPendingOrderId(pendingOrderId);
pendingOrder.setStatus(0);
pendingOrderService.cancelOrder(pendingOrder);
redisUtil.del("pengingOrder_"+pendingOrder.getPendingOrderId());
return JSONObject.parseObject("撤单成功");
}
//挂单自动撤单(到期自动撤单) 扫描redis pengingOrder_id 进行自动撤单
public void pendingOrderQuest(){
Set<String> pendingOrderSet = redisUtil.keys("pengingOrder_" + "*"); //获取所有挂单键
for(String key : pendingOrderSet){
// System.out.print(value+" ");
}
}
//返回挂单对象
public PendingOrder returnPendingOrder(String memberId, String trainingId, String tradingCode, String buySellType, Double transactionVolume, Double priceCommission, Double stopLoss, Double stopWin,Date validityTime) {
Date now = new Date();
String commissionNumber = DateUtil.format(now, "yyyyMMddHHmmss") + System.currentTimeMillis();
PendingOrder pendingOrder=new PendingOrder();
pendingOrder.setMemberId(memberId);
pendingOrder.setTrainingId(trainingId);
pendingOrder.setCommissionTime(now);
pendingOrder.setTradingCode(tradingCode);
pendingOrder.setCommissionNumber(commissionNumber);
pendingOrder.setBuySellType(buySellType);
pendingOrder.setVolumeTransaction(transactionVolume);
pendingOrder.setPriceCommission(priceCommission);
pendingOrder.setStopLoss(stopLoss);
pendingOrder.setStopWin(stopWin);
pendingOrder.setValidityTime(validityTime);
pendingOrder.setStatus(0);
return pendingOrder;
}
//保存挂单 挂单保存后 将挂单ID和有效期存入redis
public void insertPendingOrder(PendingOrder pendingOrder){
pendingOrderService.insert(pendingOrder);
redisUtil.set("pengingOrder_"+pendingOrder.getPendingOrderId(),pendingOrder.getValidityTime());
}
}

@ -5,15 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import com.sztzjy.forex.trading_trading.annotation.AnonymousAccess;
import com.sztzjy.forex.trading_trading.common.mql5API.Mql5API;
import com.sztzjy.forex.trading_trading.entity.Member;
import com.sztzjy.forex.trading_trading.entity.PendingOrder;
import com.sztzjy.forex.trading_trading.entity.TakeStash;
import com.sztzjy.forex.trading_trading.entity.mql5Entity.ForexData;
import com.sztzjy.forex.trading_trading.service.MemberService;
import com.sztzjy.forex.trading_trading.service.TakeStashService;
import com.sztzjy.forex.trading_trading.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
@ -28,6 +31,12 @@ public class TradingController {
@Autowired
TakeStashService takeStashService;
@Autowired
PendingOrderController pendingOrderController;
@Autowired
RedisUtil redisUtil;
//获取市场报价
@AnonymousAccess
@PostMapping("getMarketQuotation")
@ -61,7 +70,8 @@ public class TradingController {
Member member = memberService.getMemberByMemberIdAndTrainingId(memberId, trainingId);
Double availableFunds = member.getAvailableFunds(); //获取账户可用资金
ForexData forexData = getMarketQuotationByCode(tradingCode); //获取当前买卖价格
Double buyPic = Double.valueOf(forexData.getBuyPic()); //当前买价
Double sellPic = Double.valueOf(forexData.getSellPic());
if (null != stopLoss || null != stopWin) { //判断止损止赢是否合理 如果stopLoss stopWin都为null则跳过
boolean winOrLossStopBoolean = getWinOrLossStop(stopLoss, stopWin, buySellType, forexData);
if (winOrLossStopBoolean == false) {
@ -76,11 +86,9 @@ public class TradingController {
return JSONObject.parseObject("可用资金不足");
}
if ("buy".equals(buySellType)) {
Double buyPic = Double.valueOf(forexData.getBuyPic());
TakeStash takeStash = returnTakeStash(memberId, trainingId, tradingCode, buySellType, transactionVolume, buyPic, stopLoss, stopWin);
takeStashService.insertTakeStash(takeStash);
} else if ("sell".equals(buySellType)) {
Double sellPic = Double.valueOf(forexData.getSellPic());
TakeStash takeStash = returnTakeStash(memberId, trainingId, tradingCode, buySellType, transactionVolume, sellPic, stopLoss, stopWin);
takeStashService.insertTakeStash(takeStash);
}
@ -88,7 +96,6 @@ public class TradingController {
updateMemberAvailableFundsAndMarginUsed(member, availableFunds);
} else { //美元在后 使用可用资金表达式为 买卖手*1000*卖/买价 判断可用资金是否足够 先判断是买还是卖
if ("buy".equals(buySellType)) {
Double buyPic = Double.valueOf(forexData.getBuyPic());
if (availableFunds < transactionVolume * 1000 * buyPic) {
return JSONObject.parseObject("可用资金不足");
}
@ -96,7 +103,6 @@ public class TradingController {
takeStashService.insertTakeStash(takeStash);
availableFunds = availableFunds - transactionVolume * 1000 * buyPic;
} else if ("sell".equals(buySellType)) {
Double sellPic = Double.valueOf(forexData.getSellPic());
if (availableFunds < transactionVolume * 1000 * sellPic) {
return JSONObject.parseObject("可用资金不足");
}
@ -106,25 +112,41 @@ public class TradingController {
}
updateMemberAvailableFundsAndMarginUsed(member, availableFunds);
}
} else if (transactionType.equals("gdkc")) {//挂单开仓
//限价买进
//限价卖出
//止损买进
//止损卖出
} else {
JSONObject returnJson = JSONObject.parseObject("error");
return returnJson;
} else if (transactionType.equals("gdkc")) {//挂单开仓 生成的数据为挂单数据 挂单数据生效 判断可用资金是否充足
Double priceCommission = (Double) jsonObject.get("priceCommission"); //获取用户输入的价位
Date validityTime = (Date) jsonObject.get("validityTime"); //获取挂单有效期
if ("buyLimit".equals(buySellType)) { //限价买进(低价买进) 下单时买入价低于当前买价
if (priceCommission >= buyPic) {
return JSONObject.parseObject("限价买进价位不能高于当前买价");
}
}
if ("sellLimit".equals(buySellType)) {//限价卖出(高价卖出) 下单时卖出价高于当前卖价
if (priceCommission <= sellPic) {
return JSONObject.parseObject("限价卖出价位不能低于当前卖价");
}
}
if ("buyStop".equals(buySellType)) {//止损买进(高价买进) 下单时买入价格高于当前买价
if (priceCommission <= buyPic) {
return JSONObject.parseObject("止损买进价位不能低于当前买价");
}
}
if ("sellStop".equals(buySellType)) {//止损卖出(低价卖出)下单时卖出价格低于当前卖价
if (priceCommission >= sellPic) {
return JSONObject.parseObject("止损卖出价位不能高于当前卖价");
}
}
PendingOrder pendingOrder = pendingOrderController.returnPendingOrder(memberId, trainingId, tradingCode, buySellType, transactionVolume, priceCommission, stopLoss, stopWin, validityTime);
pendingOrderController.insertPendingOrder(pendingOrder);//保存挂单
}
return null;
JSONObject returnJson = JSONObject.parseObject("error");
return returnJson;
}
//修改当前持仓
@AnonymousAccess
@PostMapping("updateTakeStash")
public JSONObject updateTakeStash(@RequestBody JSONObject jsonObject){
String stashId= String.valueOf(jsonObject.get("stashId"));
public JSONObject updateTakeStash(@RequestBody JSONObject jsonObject) {
String stashId = String.valueOf(jsonObject.get("stashId"));
Double stopLoss = (Double) jsonObject.get("stopLoss");
Double stopWin = (Double) jsonObject.get("stopWin");
String tradingCode = String.valueOf(jsonObject.get("tradingCode"));
@ -136,7 +158,7 @@ public class TradingController {
return JSONObject.parseObject("止损或获利输入错误");
}
}
TakeStash takeStash=new TakeStash();
TakeStash takeStash = new TakeStash();
takeStash.setStashId(stashId);
takeStash.setStopLoss(stopLoss);
takeStashService.updateByPrimaryKey(takeStash);
@ -144,7 +166,7 @@ public class TradingController {
}
//当前持仓平仓 status设置为2
public JSONObject pingcangTakeStash(@RequestBody JSONObject jsonObject){
public JSONObject pingcangTakeStash(@RequestBody JSONObject jsonObject) {
return null;
@ -183,7 +205,7 @@ public class TradingController {
if ("buy".equals(buySellType)) {
Double buyPic = Double.valueOf(forexData.getBuyPic());
//判断stopLoss 和stopWin 是否为空
if(null!=stopLoss && null!=stopWin){
if (null != stopLoss && null != stopWin) {
if (stopLoss < buyPic && stopWin > buyPic) {
return true;
}
@ -204,20 +226,20 @@ public class TradingController {
} else if ("sell".equals(buySellType)) {
Double sellPic = Double.valueOf(forexData.getSellPic());
if(null!=stopLoss && null!=stopWin){
if (null != stopLoss && null != stopWin) {
if (stopLoss > sellPic && stopWin < sellPic) {
return true;
}
return false;
}
if (null == stopLoss) {
if(stopWin<sellPic){
if (stopWin < sellPic) {
return true;
}
return false;
}
if (null == stopWin) {
if(stopLoss > sellPic){
if (stopLoss > sellPic) {
return true;
}
return false;
@ -225,5 +247,4 @@ public class TradingController {
}
return false;
}
}

@ -0,0 +1,434 @@
package com.sztzjy.forex.trading_trading.entity;
import java.util.Date;
public class PendingOrder {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.pending_order_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String pendingOrderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.member_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String memberId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.training_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String trainingId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.commission_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Date commissionTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.trading_code
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String tradingCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.commission_number
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String commissionNumber;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.buy_sell_type
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private String buySellType;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.volume_transaction
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Double volumeTransaction;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.price_commission
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Double priceCommission;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.stop_loss
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Double stopLoss;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.stop_win
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Double stopWin;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.validity_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Date validityTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_pending_order.status
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
private Integer status;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.pending_order_id
*
* @return the value of sys_pending_order.pending_order_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getPendingOrderId() {
return pendingOrderId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.pending_order_id
*
* @param pendingOrderId the value for sys_pending_order.pending_order_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setPendingOrderId(String pendingOrderId) {
this.pendingOrderId = pendingOrderId == null ? null : pendingOrderId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.member_id
*
* @return the value of sys_pending_order.member_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getMemberId() {
return memberId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.member_id
*
* @param memberId the value for sys_pending_order.member_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setMemberId(String memberId) {
this.memberId = memberId == null ? null : memberId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.training_id
*
* @return the value of sys_pending_order.training_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getTrainingId() {
return trainingId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.training_id
*
* @param trainingId the value for sys_pending_order.training_id
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setTrainingId(String trainingId) {
this.trainingId = trainingId == null ? null : trainingId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.commission_time
*
* @return the value of sys_pending_order.commission_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Date getCommissionTime() {
return commissionTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.commission_time
*
* @param commissionTime the value for sys_pending_order.commission_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setCommissionTime(Date commissionTime) {
this.commissionTime = commissionTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.trading_code
*
* @return the value of sys_pending_order.trading_code
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getTradingCode() {
return tradingCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.trading_code
*
* @param tradingCode the value for sys_pending_order.trading_code
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setTradingCode(String tradingCode) {
this.tradingCode = tradingCode == null ? null : tradingCode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.commission_number
*
* @return the value of sys_pending_order.commission_number
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getCommissionNumber() {
return commissionNumber;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.commission_number
*
* @param commissionNumber the value for sys_pending_order.commission_number
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setCommissionNumber(String commissionNumber) {
this.commissionNumber = commissionNumber == null ? null : commissionNumber.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.buy_sell_type
*
* @return the value of sys_pending_order.buy_sell_type
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public String getBuySellType() {
return buySellType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.buy_sell_type
*
* @param buySellType the value for sys_pending_order.buy_sell_type
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setBuySellType(String buySellType) {
this.buySellType = buySellType == null ? null : buySellType.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.volume_transaction
*
* @return the value of sys_pending_order.volume_transaction
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Double getVolumeTransaction() {
return volumeTransaction;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.volume_transaction
*
* @param volumeTransaction the value for sys_pending_order.volume_transaction
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setVolumeTransaction(Double volumeTransaction) {
this.volumeTransaction = volumeTransaction;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.price_commission
*
* @return the value of sys_pending_order.price_commission
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Double getPriceCommission() {
return priceCommission;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.price_commission
*
* @param priceCommission the value for sys_pending_order.price_commission
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setPriceCommission(Double priceCommission) {
this.priceCommission = priceCommission;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.stop_loss
*
* @return the value of sys_pending_order.stop_loss
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Double getStopLoss() {
return stopLoss;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.stop_loss
*
* @param stopLoss the value for sys_pending_order.stop_loss
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setStopLoss(Double stopLoss) {
this.stopLoss = stopLoss;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.stop_win
*
* @return the value of sys_pending_order.stop_win
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Double getStopWin() {
return stopWin;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.stop_win
*
* @param stopWin the value for sys_pending_order.stop_win
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setStopWin(Double stopWin) {
this.stopWin = stopWin;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.validity_time
*
* @return the value of sys_pending_order.validity_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Date getValidityTime() {
return validityTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.validity_time
*
* @param validityTime the value for sys_pending_order.validity_time
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setValidityTime(Date validityTime) {
this.validityTime = validityTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_pending_order.status
*
* @return the value of sys_pending_order.status
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public Integer getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_pending_order.status
*
* @param status the value for sys_pending_order.status
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
public void setStatus(Integer status) {
this.status = status;
}
}

@ -0,0 +1,98 @@
package com.sztzjy.forex.trading_trading.mappers;
import com.sztzjy.forex.trading_trading.entity.PendingOrder;
import com.sztzjy.forex.trading_trading.entity.PendingOrderExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface PendingOrderMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
long countByExample(PendingOrderExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int deleteByExample(PendingOrderExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int deleteByPrimaryKey(String pendingOrderId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int insert(PendingOrder record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int insertSelective(PendingOrder record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
List<PendingOrder> selectByExample(PendingOrderExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
PendingOrder selectByPrimaryKey(String pendingOrderId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int updateByExampleSelective(@Param("record") PendingOrder record, @Param("example") PendingOrderExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int updateByExample(@Param("record") PendingOrder record, @Param("example") PendingOrderExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int updateByPrimaryKeySelective(PendingOrder record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_pending_order
*
* @mbg.generated Mon Jul 03 11:02:06 CST 2023
*/
int updateByPrimaryKey(PendingOrder record);
}

@ -0,0 +1,31 @@
package com.sztzjy.forex.trading_trading.service;
import com.sztzjy.forex.trading_trading.entity.PendingOrder;
import com.sztzjy.forex.trading_trading.entity.PendingOrderExample;
import com.sztzjy.forex.trading_trading.mappers.PendingOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PendingOrderService {
@Autowired
PendingOrderMapper pendingOrderMapper;
public void insert(PendingOrder pendingOrder){
pendingOrderMapper.insert(pendingOrder);
}
public List<PendingOrder> selectByExample(PendingOrder pendingOrder){
PendingOrderExample pendingOrderExample = new PendingOrderExample();
PendingOrderExample.Criteria criteria = pendingOrderExample.createCriteria();
criteria.andMemberIdEqualTo(pendingOrder.getMemberId()).andTrainingIdEqualTo(pendingOrder.getTrainingId());
List<PendingOrder> pendingOrders = pendingOrderMapper.selectByExample(pendingOrderExample);
return pendingOrders;
}
public void cancelOrder(PendingOrder pendingOrder){
pendingOrderMapper.updateByPrimaryKey(pendingOrder);
}
}

@ -0,0 +1,572 @@
package com.sztzjy.forex.trading_trading.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Component
public class RedisUtil {
@Autowired
private RedisTemplate redisTemplate;
public Set<String> keys(String pattern) {
return redisTemplate.keys(pattern);
}
/**
*
*
* @param key
* @param time ()
* @return
*/
public boolean expire(String key, long time) {
try {
if (time > 0) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* key
*
* @param key null
* @return () 0
*/
public long getExpire(String key) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
/**
* key
*
* @param key
* @return true false
*/
public boolean hasKey(String key) {
try {
return redisTemplate.hasKey(key);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
*
*
* @param key
*/
@SuppressWarnings("unchecked")
public void del(String... key) {
if (key != null && key.length > 0) {
if (key.length == 1) {
redisTemplate.delete(key[0]);
} else {
redisTemplate.delete(CollectionUtils.arrayToList(key));
}
}
}
// ============================String=============================
/**
*
*
* @param key
* @return
*/
public <T> T get(String key) {
if (key == null) return null;
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
*
*
* @param key
* @param value
* @return true false
*/
public boolean set(String key, Object value) {
try {
redisTemplate.opsForValue().set(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
*
*
* @param key
* @param value
* @param time () time0 time0
* @return true false
*/
public boolean set(String key, Object value, long time) {
try {
if (time > 0) {
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
*
*
* @param key
* @param delta (0)
* @return
*/
public long incr(String key, long delta) {
if (delta < 0) {
throw new RuntimeException("递增因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, delta);
}
/**
*
*
* @param key
* @param delta (0)
* @return
*/
public long decr(String key, long delta) {
if (delta < 0) {
throw new RuntimeException("递减因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, -delta);
}
// ================================Map=================================
/**
* HashGet
*
* @param key null
* @param item null
* @return
*/
public Object hget(String key, String item) {
return redisTemplate.opsForHash().get(key, item);
}
/**
* hashKey
*
* @param key
* @return
*/
public Map<Object, Object> hmget(String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* HashSet
*
* @param key
* @param map
* @return true false
*/
public boolean hmset(String key, Map<String, Object> map) {
try {
redisTemplate.opsForHash().putAll(key, map);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* HashSet
*
* @param key
* @param map
* @param time ()
* @return true false
*/
public boolean hmset(String key, Map<String, Object> map, long time) {
try {
redisTemplate.opsForHash().putAll(key, map);
if (time > 0) {
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* hash,
*
* @param key
* @param item
* @param value
* @return true false
*/
public boolean hset(String key, String item, Object value) {
try {
redisTemplate.opsForHash().put(key, item, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* hash,
*
* @param key
* @param item
* @param value
* @param time () :hash,
* @return true false
*/
public boolean hset(String key, String item, Object value, long time) {
try {
redisTemplate.opsForHash().put(key, item, value);
if (time > 0) {
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* hash
*
* @param key null
* @param item 使 null
*/
public void hdel(String key, Object... item) {
redisTemplate.opsForHash().delete(key, item);
}
/**
* hash
*
* @param key null
* @param item null
* @return true false
*/
public boolean hHasKey(String key, String item) {
return redisTemplate.opsForHash().hasKey(key, item);
}
/**
* hash ,
*
* @param key
* @param item
* @param by (0)
* @return
*/
public double hincr(String key, String item, double by) {
return redisTemplate.opsForHash().increment(key, item, by);
}
/**
* hash
*
* @param key
* @param item
* @param by (0)
* @return
*/
public double hdecr(String key, String item, double by) {
return redisTemplate.opsForHash().increment(key, item, -by);
}
// ============================set=============================
/**
* keySet
*
* @param key
* @return
*/
public Set<Object> sGet(String key) {
try {
return redisTemplate.opsForSet().members(key);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* valueset,
*
* @param key
* @param value
* @return true false
*/
public boolean sHasKey(String key, Object value) {
try {
return redisTemplate.opsForSet().isMember(key, value);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* set
*
* @param key
* @param values
* @return
*/
public long sSet(String key, Object... values) {
try {
return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* set
*
* @param key
* @param time ()
* @param values
* @return
*/
public long sSetAndTime(String key, long time, Object... values) {
try {
Long count = redisTemplate.opsForSet().add(key, values);
if (time > 0)
expire(key, time);
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* set
*
* @param key
* @return
*/
public long sGetSetSize(String key) {
try {
return redisTemplate.opsForSet().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* value
*
* @param key
* @param values
* @return
*/
public long setRemove(String key, Object... values) {
try {
Long count = redisTemplate.opsForSet().remove(key, values);
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
// ===============================list=================================
/**
* list
*
* @param key
* @param start
* @param end 0 -1
* @return
*/
public List<Object> lGet(String key, long start, long end) {
try {
return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* list
*
* @param key
* @return
*/
public long lGetListSize(String key) {
try {
return redisTemplate.opsForList().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* list
*
* @param key
* @param index index>=0 0 1 index<0-1-2
* @return
*/
public Object lGetIndex(String key, long index) {
try {
return redisTemplate.opsForList().index(key, index);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* list
*
* @param key
* @param value
* @return
*/
public boolean lSet(String key, Object value) {
try {
redisTemplate.opsForList().rightPush(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* list
*
* @param key
* @param value
* @param time ()
* @return
*/
public boolean lSet(String key, Object value, long time) {
try {
redisTemplate.opsForList().rightPush(key, value);
if (time > 0)
expire(key, time);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* list
*
* @param key
* @param value
* @return
*/
public boolean lSet(String key, List<Object> value) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* list
*
* @param key
* @param value
* @param time ()
* @return
*/
public boolean lSet(String key, List<Object> value, long time) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
if (time > 0)
expire(key, time);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* list
*
* @param key
* @param index
* @param value
* @return
*/
public boolean lUpdateIndex(String key, long index, Object value) {
try {
redisTemplate.opsForList().set(key, index, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* Nvalue
*
* @param key
* @param count
* @param value
* @return
*/
public long lRemove(String key, long count, Object value) {
try {
return redisTemplate.opsForList().remove(key, count, value);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
}

@ -13,6 +13,19 @@ spring:
matching-strategy: ant_path_matcher
jackson:
time-zone: GMT+8
redis:
host: localhost
port: 6379
database: 0
# spring.redis.pool.max-active=8
# # 连接池最大阻塞等待时间(使用负值表示没有限制)
# spring.redis.pool.max-wait=-1
# # 连接池中的最大空闲连接
# spring.redis.pool.max-idle=8
# # 连接池中的最小空闲连接
# spring.redis.pool.min-idle=0
# # 连接超时时间(毫秒)
# spring.redis.timeout=0
datasource:
druid:
# 初始连接数

@ -25,7 +25,8 @@
<!-- 需要生成的表 -->
<!-- <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" />
</context>

@ -0,0 +1,414 @@
<?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.PendingOrderMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.forex.trading_trading.entity.PendingOrder">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
<id column="pending_order_id" jdbcType="VARCHAR" property="pendingOrderId" />
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
<result column="training_id" jdbcType="VARCHAR" property="trainingId" />
<result column="commission_time" jdbcType="TIMESTAMP" property="commissionTime" />
<result column="trading_code" jdbcType="VARCHAR" property="tradingCode" />
<result column="commission_number" jdbcType="VARCHAR" property="commissionNumber" />
<result column="buy_sell_type" jdbcType="VARCHAR" property="buySellType" />
<result column="volume_transaction" jdbcType="DOUBLE" property="volumeTransaction" />
<result column="price_commission" jdbcType="DOUBLE" property="priceCommission" />
<result column="stop_loss" jdbcType="DOUBLE" property="stopLoss" />
<result column="stop_win" jdbcType="DOUBLE" property="stopWin" />
<result column="validity_time" jdbcType="TIMESTAMP" property="validityTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</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 Mon Jul 03 11:02:06 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>
</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 Mon Jul 03 11:02:06 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 Mon Jul 03 11:02:06 CST 2023.
-->
pending_order_id, member_id, training_id, commission_time, trading_code, commission_number,
buy_sell_type, volume_transaction, price_commission, stop_loss, stop_win, validity_time,
status
</sql>
<select id="selectByExample" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrderExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_pending_order
<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 Mon Jul 03 11:02:06 CST 2023.
-->
select
<include refid="Base_Column_List" />
from sys_pending_order
where pending_order_id = #{pendingOrderId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
delete from sys_pending_order
where pending_order_id = #{pendingOrderId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrderExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
delete from sys_pending_order
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrder">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
insert into sys_pending_order (pending_order_id, member_id, training_id,
commission_time, trading_code, commission_number,
buy_sell_type, volume_transaction, price_commission,
stop_loss, stop_win, validity_time,
status)
values (#{pendingOrderId,jdbcType=VARCHAR}, #{memberId,jdbcType=VARCHAR}, #{trainingId,jdbcType=VARCHAR},
#{commissionTime,jdbcType=TIMESTAMP}, #{tradingCode,jdbcType=VARCHAR}, #{commissionNumber,jdbcType=VARCHAR},
#{buySellType,jdbcType=VARCHAR}, #{volumeTransaction,jdbcType=DOUBLE}, #{priceCommission,jdbcType=DOUBLE},
#{stopLoss,jdbcType=DOUBLE}, #{stopWin,jdbcType=DOUBLE}, #{validityTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrder">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
insert into sys_pending_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pendingOrderId != null">
pending_order_id,
</if>
<if test="memberId != null">
member_id,
</if>
<if test="trainingId != null">
training_id,
</if>
<if test="commissionTime != null">
commission_time,
</if>
<if test="tradingCode != null">
trading_code,
</if>
<if test="commissionNumber != null">
commission_number,
</if>
<if test="buySellType != null">
buy_sell_type,
</if>
<if test="volumeTransaction != null">
volume_transaction,
</if>
<if test="priceCommission != null">
price_commission,
</if>
<if test="stopLoss != null">
stop_loss,
</if>
<if test="stopWin != null">
stop_win,
</if>
<if test="validityTime != null">
validity_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pendingOrderId != null">
#{pendingOrderId,jdbcType=VARCHAR},
</if>
<if test="memberId != null">
#{memberId,jdbcType=VARCHAR},
</if>
<if test="trainingId != null">
#{trainingId,jdbcType=VARCHAR},
</if>
<if test="commissionTime != null">
#{commissionTime,jdbcType=TIMESTAMP},
</if>
<if test="tradingCode != null">
#{tradingCode,jdbcType=VARCHAR},
</if>
<if test="commissionNumber != null">
#{commissionNumber,jdbcType=VARCHAR},
</if>
<if test="buySellType != null">
#{buySellType,jdbcType=VARCHAR},
</if>
<if test="volumeTransaction != null">
#{volumeTransaction,jdbcType=DOUBLE},
</if>
<if test="priceCommission != null">
#{priceCommission,jdbcType=DOUBLE},
</if>
<if test="stopLoss != null">
#{stopLoss,jdbcType=DOUBLE},
</if>
<if test="stopWin != null">
#{stopWin,jdbcType=DOUBLE},
</if>
<if test="validityTime != null">
#{validityTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrderExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
select count(*) from sys_pending_order
<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 Mon Jul 03 11:02:06 CST 2023.
-->
update sys_pending_order
<set>
<if test="record.pendingOrderId != null">
pending_order_id = #{record.pendingOrderId,jdbcType=VARCHAR},
</if>
<if test="record.memberId != null">
member_id = #{record.memberId,jdbcType=VARCHAR},
</if>
<if test="record.trainingId != null">
training_id = #{record.trainingId,jdbcType=VARCHAR},
</if>
<if test="record.commissionTime != null">
commission_time = #{record.commissionTime,jdbcType=TIMESTAMP},
</if>
<if test="record.tradingCode != null">
trading_code = #{record.tradingCode,jdbcType=VARCHAR},
</if>
<if test="record.commissionNumber != null">
commission_number = #{record.commissionNumber,jdbcType=VARCHAR},
</if>
<if test="record.buySellType != null">
buy_sell_type = #{record.buySellType,jdbcType=VARCHAR},
</if>
<if test="record.volumeTransaction != null">
volume_transaction = #{record.volumeTransaction,jdbcType=DOUBLE},
</if>
<if test="record.priceCommission != null">
price_commission = #{record.priceCommission,jdbcType=DOUBLE},
</if>
<if test="record.stopLoss != null">
stop_loss = #{record.stopLoss,jdbcType=DOUBLE},
</if>
<if test="record.stopWin != null">
stop_win = #{record.stopWin,jdbcType=DOUBLE},
</if>
<if test="record.validityTime != null">
validity_time = #{record.validityTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,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 Mon Jul 03 11:02:06 CST 2023.
-->
update sys_pending_order
set pending_order_id = #{record.pendingOrderId,jdbcType=VARCHAR},
member_id = #{record.memberId,jdbcType=VARCHAR},
training_id = #{record.trainingId,jdbcType=VARCHAR},
commission_time = #{record.commissionTime,jdbcType=TIMESTAMP},
trading_code = #{record.tradingCode,jdbcType=VARCHAR},
commission_number = #{record.commissionNumber,jdbcType=VARCHAR},
buy_sell_type = #{record.buySellType,jdbcType=VARCHAR},
volume_transaction = #{record.volumeTransaction,jdbcType=DOUBLE},
price_commission = #{record.priceCommission,jdbcType=DOUBLE},
stop_loss = #{record.stopLoss,jdbcType=DOUBLE},
stop_win = #{record.stopWin,jdbcType=DOUBLE},
validity_time = #{record.validityTime,jdbcType=TIMESTAMP},
status = #{record.status,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.PendingOrder">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
update sys_pending_order
<set>
<if test="memberId != null">
member_id = #{memberId,jdbcType=VARCHAR},
</if>
<if test="trainingId != null">
training_id = #{trainingId,jdbcType=VARCHAR},
</if>
<if test="commissionTime != null">
commission_time = #{commissionTime,jdbcType=TIMESTAMP},
</if>
<if test="tradingCode != null">
trading_code = #{tradingCode,jdbcType=VARCHAR},
</if>
<if test="commissionNumber != null">
commission_number = #{commissionNumber,jdbcType=VARCHAR},
</if>
<if test="buySellType != null">
buy_sell_type = #{buySellType,jdbcType=VARCHAR},
</if>
<if test="volumeTransaction != null">
volume_transaction = #{volumeTransaction,jdbcType=DOUBLE},
</if>
<if test="priceCommission != null">
price_commission = #{priceCommission,jdbcType=DOUBLE},
</if>
<if test="stopLoss != null">
stop_loss = #{stopLoss,jdbcType=DOUBLE},
</if>
<if test="stopWin != null">
stop_win = #{stopWin,jdbcType=DOUBLE},
</if>
<if test="validityTime != null">
validity_time = #{validityTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where pending_order_id = #{pendingOrderId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.forex.trading_trading.entity.PendingOrder">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Mon Jul 03 11:02:06 CST 2023.
-->
update sys_pending_order
set member_id = #{memberId,jdbcType=VARCHAR},
training_id = #{trainingId,jdbcType=VARCHAR},
commission_time = #{commissionTime,jdbcType=TIMESTAMP},
trading_code = #{tradingCode,jdbcType=VARCHAR},
commission_number = #{commissionNumber,jdbcType=VARCHAR},
buy_sell_type = #{buySellType,jdbcType=VARCHAR},
volume_transaction = #{volumeTransaction,jdbcType=DOUBLE},
price_commission = #{priceCommission,jdbcType=DOUBLE},
stop_loss = #{stopLoss,jdbcType=DOUBLE},
stop_win = #{stopWin,jdbcType=DOUBLE},
validity_time = #{validityTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where pending_order_id = #{pendingOrderId,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save