增加 StockStrategy 服务,数据表建立及批量更新方法重写。解决多数据源配置 mapper-locations

无法识别并读取到对应数据源的 mapper.xml 及其 statement 方法的问题
This commit is contained in:
2026-01-10 14:26:04 +08:00
parent 52f4dd5e83
commit b0093ccccb
27 changed files with 653 additions and 280 deletions

View File

@@ -2,6 +2,8 @@ package quant.rich.emoney.entity.postgre;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -10,47 +12,21 @@ import lombok.experimental.Accessors;
*/
@Data
@Accessors(chain=true)
@TableName("stock_strategy")
public class StockStrategy {
private String tsCode;
private Integer goodsId ;
private LocalDateTime date;
private String strategyName;
private Integer strategyId;
private Integer poolId;
private String poolName;
private Integer strategyId;
private String strategyName;
private String type;
private Integer poolId;
public StockStrategy setTsCodeFromGoodsId(Integer goodsId) {
// 自动将益盟 goodsId 转换成 tsCode
// 1301325 -> 301325.SZ
// 600325 -> 600325.SH
// 1920009 -> 920009.BJ
String goodsIdStr = goodsId.toString();
RuntimeException e = new RuntimeException("无法将 goodsId " + goodsIdStr + " 转换为 tsCode");
if (goodsIdStr.length() == 6) {
// SH
return setTsCode(goodsIdStr + ".SH");
}
else if (goodsIdStr.length() == 7) {
if (goodsIdStr.charAt(0) != '1') {
throw e;
}
if (goodsIdStr.charAt(1) == '9') {
// BJ
return setTsCode(goodsIdStr.substring(1) + ".BJ");
}
// SZ
return setTsCode(goodsIdStr.substring(1) + ".SZ");
}
throw e;
}
}