Files
Api/DouyinApi.Model/Models/SplitDemo.cs
2025-11-04 21:09:16 +08:00

28 lines
979 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace DouyinApi.Model.Models
{
[SplitTable(SplitType.Day)]//按天分表 (自带分表支持 年、季、月、周、日)
[SugarTable("SplitDemo_{year}{month}{day}")]//3个变量必须要有这么设计为了兼容开始按年后面改成按月、按日
public class SplitDemo
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public string Name { get; set; }
[SugarColumn(IsNullable = true)]//设置为可空字段 (更多用法看文档 迁移)
public DateTime UpdateTime { get; set; }
[SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表,在更新删除的时候用这个字段找出相关表
public DateTime CreateTime { get; set; }
}
}