| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using SqlSugar;
- namespace EasyTemplate.Tool.Entity;
- /// <summary>
- /// 商品
- /// </summary>
- [SugarTable(null, "商品")]
- [SugarIndex("CreateTime", nameof(CreateTime), OrderByType.Desc)]
- public partial class TProduct: EntityBase
- {
- /// <summary>
- /// 商品名称
- /// </summary>
- [SugarColumn(ColumnDescription = "商品名称", IsNullable = true)]
- public string Name { get; set; }
- /// <summary>
- /// 总库存
- /// </summary>
- [SugarColumn(ColumnDescription = "商品编码", IsNullable = true)]
- public string Code { get; set; }
- /// <summary>
- /// 预览图
- /// </summary>
- [SugarColumn(ColumnDataType = "text", ColumnDescription = "预览图", IsNullable = true)]
- public string Preview { get; set; }
- /// <summary>
- /// 是否可用
- /// </summary>
- [SugarColumn(ColumnDescription = "是否可用", DefaultValue = "0", IsNullable = true)]
- public bool Available { get; set; }
- /// <summary>
- /// 描述
- /// </summary>
- [SugarColumn(ColumnDescription = "描述", Length = 500, IsNullable = true)]
- public string Description { get; set; }
- /// <summary>
- /// 商品文案
- /// </summary>
- [SugarColumn(ColumnDataType ="longtext", ColumnDescription = "商品文案", IsNullable = true)]
- public string Content { get; set; }
- /// <summary>
- /// 总库存
- /// </summary>
- [SugarColumn(ColumnDescription = "总库存", DefaultValue = "0", IsNullable = true)]
- public int TotalStock { get; set; }
- /// <summary>
- /// 商品规格
- /// </summary>
- [SqlSugar.SugarColumn(IsIgnore = true)]
- public List<TProductSku> Skus { get; set; }
- /// <summary>
- /// 预览图
- /// </summary>
- [SqlSugar.SugarColumn(IsIgnore = true)]
- public List<string> Images { get {
- if (!string.IsNullOrWhiteSpace(Preview))
- {
- return Preview.Split(',').ToList();
- }
- return null;
- } }
- /// <summary>
- /// 主图
- /// </summary>
- [SqlSugar.SugarColumn(IsIgnore = true)]
- public string MainImage { get {
- if (!string.IsNullOrWhiteSpace(Preview))
- {
- return Preview.Split(',')[0];
- }
- return null;
- } }
- }
- public class TProductSeedData : ISeedData<TProduct>
- {
- public IEnumerable<TProduct> Generate()
- =>
- [
- new TProduct() { Id = 1, Name="小熊软糖", Code="F20250213573548", TotalStock=999, Available = true, Content="<article class=\"s_card article_box\">\r\n <section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/3c2c-ixeeirz0407000.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">1 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ </p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/9fb0-ixeeirz0409381.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">2 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ </p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/de2e-ixeeirz0409397.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">3 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ </p>\r\n </section><section class=\"section-item\">\r\n <figure class=\"hd_img_box i_bg\">\r\n <img class=\"img_width j_ph\" src=\"//k.sinaimg.cn/n/sinakd20108/320/w960h960/20200801/278a-ixeeirz0409411.jpg/w700d1q75cms.jpg\" data-pid=\"\" onload=\"window.STO=window.STO||{};window.STO.fiE=new Date().getTime();\">\r\n <i class=\"ic_zoom faiz_zoom\"></i>\r\n </figure>\r\n <p class=\"hd_img_info\"> <em class=\"hd_img_info_n\"> <strong class=\"hd_img_info_b\">4 </strong>/ 4 </em>HARIBO小熊软糖玩偶~~好可爱~适合爱吃小熊软糖的你们~ </p>\r\n </section>\r\n </article>", Description="小熊软糖多种口味新鲜上架", CreateUserId=1, CreateTime = DateTime.Now, Preview = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png,https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" },
- ];
- }
|