12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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
- {
- /// <summary>
- /// 字串类型分割成double类型数组,在指定位置赋值
- /// </summary>
- /// <param name="source">需要分割的字符</param>
- /// <param name="splitChar">分割字符</param>
- /// <param name="indexes">索引</param>
- /// <param name="num">需要加减数量</param>
- /// <returns></returns>
- public static string SplitStr(string source, char splitChar, int indexes, int num)
- {
- string str = null;
- if (source != null)
- {
- double[] temps = Array.ConvertAll<string, double>(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;
- }
- /// <summary>
- /// 多个拼接in条件
- /// </summary>
- /// <param name="condName"></param>
- /// <param name="scIds"></param>
- /// <returns></returns>
- public static string ManyScSql(string condName, List<string> 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();
- }
- }
- }
|