新增redis工具类 挂单部分功能 交易挂单开仓
parent
3c90a2b7be
commit
f261a8a684
@ -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());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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,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…
Reference in New Issue