sunkaixuan
1 year ago
7 changed files with 173 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||||
|
using SqlSugar; |
||||
|
|
||||
|
namespace Demo |
||||
|
{ |
||||
|
///<summary>
|
||||
|
///畜禽分段信息
|
||||
|
///</summary>
|
||||
|
[SugarTable("insurance_section_config")] |
||||
|
public class InsuranceSectionConfig |
||||
|
{ |
||||
|
public InsuranceSectionConfig() |
||||
|
{ |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// Desc:分段ID
|
||||
|
/// Default:
|
||||
|
/// Nullable:False
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "分段ID", IsNullable = false)] |
||||
|
public int insurance_section_id { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:畜种细分编码
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(ColumnDescription = "畜种细分编码", Length = 10, IsNullable = true)] |
||||
|
public string category_code { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
using SqlSugar; |
||||
|
|
||||
|
namespace Demo |
||||
|
{ |
||||
|
///<summary>
|
||||
|
///
|
||||
|
///</summary>
|
||||
|
[SugarTable("shouji")] |
||||
|
public class ShouJi |
||||
|
{ |
||||
|
public ShouJi() |
||||
|
{ |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// Desc:收集单流水号
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(ColumnDescription = "收集单流水号", Length = 16)] |
||||
|
public string shouji_sysno { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:收集单据号,多个逗号分隔
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(ColumnDescription = "收集单据号,多个逗号分隔", Length = 200)] |
||||
|
public string shouji_sn { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:收集单ID
|
||||
|
/// Default:newid()
|
||||
|
/// Nullable:False
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "收集单GUID")] |
||||
|
public string shouji_guid { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:收集单ID
|
||||
|
/// Default:newid()
|
||||
|
/// Nullable:False
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(ColumnDescription = "收集单GUID")] |
||||
|
public string xuqin_name { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
using SqlSugar; |
||||
|
|
||||
|
namespace Demo |
||||
|
{ |
||||
|
///<summary>
|
||||
|
///
|
||||
|
///</summary>
|
||||
|
[SugarTable("shouji_subnum")] |
||||
|
public class ShoujiSubnum |
||||
|
{ |
||||
|
public ShoujiSubnum() |
||||
|
{ |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// Desc:分段ID
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
public int? insurance_section_id { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:收集单ID
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
public string shouji_guid { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:分段数量
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
public decimal? amount { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:预估理赔金额
|
||||
|
/// Default:
|
||||
|
/// Nullable:True
|
||||
|
/// </summary>
|
||||
|
public decimal? total_money { get; set; } |
||||
|
/// <summary>
|
||||
|
/// Desc:收集分段ID
|
||||
|
/// Default:newid()
|
||||
|
/// Nullable:False
|
||||
|
/// </summary>
|
||||
|
[SugarColumn(IsPrimaryKey = true)] |
||||
|
public string sub_shouji_guid { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
namespace Demo |
||||
|
{ |
||||
|
public class ShoujiViewDto |
||||
|
{ |
||||
|
public string shouji_guid { get; set; } |
||||
|
public string xuqin_name { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
using Demo; |
||||
|
using SqlSugar; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace OrmTest |
||||
|
{ |
||||
|
public class Unit23131 |
||||
|
{ |
||||
|
public static void Init() |
||||
|
{ |
||||
|
|
||||
|
//var connStr = "server=192.168.88.190;database=SDWHH2206;uid=whh;pwd=Zowie2023";
|
||||
|
var connStr1 = "Server=192.168.88.180;Port=54321;UID=whh;PWD=whh@123;database=zhsy_whh;searchpath=dbo;"; |
||||
|
//SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = connStr, DbType = DbType.SqlServer });
|
||||
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = connStr1, DbType = DbType.Kdbndp }); |
||||
|
|
||||
|
var list = db.Queryable<ShouJi>().Select(s => new ShoujiViewDto |
||||
|
{ |
||||
|
shouji_guid = s.shouji_guid.SelectAll() |
||||
|
}).MergeTable().Where(w => w.xuqin_name != null) |
||||
|
.Where(w => w.shouji_guid == SqlFunc.Subqueryable<ShoujiSubnum>().Where(ss => ss.amount > 0 |
||||
|
&& ss.insurance_section_id == |
||||
|
SqlFunc.Subqueryable<InsuranceSectionConfig>() |
||||
|
.GroupBy(i => i.insurance_section_id) |
||||
|
.Where(i => i.category_code == "123" && i.insurance_section_id == ss.insurance_section_id) |
||||
|
.Select(i => i.insurance_section_id) |
||||
|
).GroupBy(ss => ss.shouji_guid) |
||||
|
.Select(ss => ss.shouji_guid)).ToSql(); |
||||
|
|
||||
|
if (!list.Key.Contains("\"INSURANCE_SECTION_CONFIG\" \"I\"")) |
||||
|
{ |
||||
|
throw new Exception("unit error"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue