zs
2025-04-30 84daa62f7ef6df79419dd01451cd21bb6bc7e091
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace GenerateCode_GEBrilliantFactory
{
    /// <summary>
    /// 生成Services的接口实现文件
    /// </summary>
    public class Services_InterfaceRealize_Generate : BaseGenerate
    {
        public static string CreateText(string Wcf_NameSpacePath, string Modulelogo, string entityName,
            string ChinaComment, string filePrefixName, string primaryKey, string TableAlias, string addEntityParam,
            List<ColumnModel> columnList,string groupName)
        {
            var str = TextHelper.ReadText(@"Templete\Services接口实现模板.txt");
 
            str = str.Replace("$ValidateEmptyStrForPrimaryKey$", StructStrHelper.GetValidateEmptyStrForPrimaryKey(columnList, primaryKey));
            str = str.Replace("$Wcf_NameSpacePath$", Wcf_NameSpacePath);//WCF项目的命名空间
            str = str.Replace("$GroupName$", groupName);//分组名
            str = str.Replace("$ChinaComment$", ChinaComment);//中文注释
            str = str.Replace("$EntityName$", entityName);//实体类名
            str = str.Replace("$EntityName_FirstLetterLower$", CommonHelper.FirstLowercase(entityName));//首字母小写,局部变量名
            str = str.Replace("$Modulelogo$", Modulelogo);//模块简写
            str = str.Replace("$FilePrefixName$", filePrefixName);//模块名
            str = str.Replace("$PrimaryKey$", primaryKey);//主键名
 
            str = str.Replace("$ValidateEmptyForInsert$", StructStrHelper.GetValidateEmptyStr(columnList));
            str = str.Replace("$ValidateEmptyForUpdate$", StructStrHelper.GetValidateEmptyStr(columnList, false));
            str = str.Replace("$WhereQuery$", StructStrHelper.GetStrForWhereQuery(columnList));
            str = str.Replace("$AddEntityParam$", addEntityParam);
 
            str = str.Replace("$TableAlias$", TableAlias);//表别名
 
            CommonReplace(ref str);
 
            return str;
        }
    }
}