using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TEAMModelOS.SDK.Models.Service.BI { public static class BICommonWay { /// /// 字串类型分割成double类型数组,在指定位置赋值 /// /// 需要分割的字符 /// 分割字符 /// 索引 /// 需要加减数量 /// public static string SplitStr(string source, char splitChar, int indexes, int num) { string str = null; if (source != null) { double[] temps = Array.ConvertAll(source.Split(splitChar), s => double.Parse(s)); temps[indexes] = temps[indexes] + num; str = string.Join(splitChar, temps); } if (str != null) return str; else return source; } /// /// 多个拼接in条件 /// /// /// /// public static string ManyScSql(string condName, List scIds) { StringBuilder scSql = new(); if (scIds.Count > 0) { scSql.Append($" {condName} in ("); for (int i = 0; i < scIds.Count; i++) { if (i == scIds.Count - 1) scSql.Append($"'{scIds[i]}'"); else scSql.Append($"'{scIds[i]}',"); } scSql.Append($" )"); } return scSql.ToString(); } } }