当前位置: 澳门新濠3559 > 操作系统 > 正文

澳门新濠3559:根据参数创建,保存即可

时间:2019-11-20 22:05来源:操作系统
在/etc/vimrc文件中添加: public class listGageData { public string gcustName { set; get; } public string gcustIdtype { set; get; } public string gcustIdno { set; get; } public string gType { set; get; } 澳门新濠3559:根据参数创

在/etc/vimrc文件中添加:

public class listGageData
{
public string gcustName
{
set;
get;
}
public string gcustIdtype
{
set;
get;
}
public string gcustIdno
{
set;
get;
}
public string gType
{
set;
get;
}
澳门新濠3559:根据参数创建,保存即可。public string gName
{
set;
get;
}
public string gDesc
{
set;
get;
}
public decimal gValue
{
set;
get;
}
public string gLicno
{
set;
get;
}
public string gLicType
{
set;
get;
}
}
public class listComData
{
public string comName
{
set;
get;
}
public string comIdtype
{
set;
get;
}
public string comIdno
{
set;
get;
}
public string comTel
{
set;
get;
}
}
public class listRelData
{
public string relName
{
set;
get;
}
public string relIdtype
{
set;
get;
}
public string relIdno
{
set;
get;
}
public string relTel
{
set;
get;
}
}

set(集合)

Redis 的 set 是 string 类型的无序集合。set 的是通过 hash table 实现的,所以添加、删除和查找的复杂度都是 O(1)。set 集合类型除了基本的添加删除操作,其他有用的操作还包含集合的取并集(union),交集(intersection),差集(difference)。

  set nu

public class IntoPiecesData
{
public string BrNo
{
set;
get;
}
public string BatNo
{
set;
get;
}
public int DataCnt
{
set;
get;
}
public List<IntoData> list
{
set;
get;
}
}
public class IntoData
{
public string PactNo
{
set;
get;
}
public string CustName
{
set;
get;
}
public string IdType
{
set;
get;
}
public string IdNo
{
set;
get;
}
public string CustType
{
set;
get;
}
public string Sex
{
set;
get;
}
public string Birth
{
set;
get;
}
public string Marriage
{
set;
get;
}
public string Children
{
set;
get;
}
public string Edu
{
set;
get;
}
public string Degree
{
set;
get;
}
public string TelNo
{
set;
get;
}
public string PhoneNo
{
set;
get;
}
public string PostCode
{
set;
get;
}
public string PostAddr
{
set;
get;
}
public string HomeArea
{
set;
get;
}
public string HomeTel
{
set;
get;
}
public string HomeCode
{
set;
get;
}
public string HomeAddr
{
set;
get;
}
public string HomeSts
{
set;
get;
}
public double Income
{
set;
get;
}
public string MateName
{
set;
get;
}
public string MateIdtype
{
set;
get;
}
public string MateIdno
{
set;
get;
}
public string MateWork
{
set;
get;
}
public string MateTel
{
set;
get;
}
public string ProjNo
{
set;
get;
}
public string PrdtNo
{
set;
get;
}
public double PactAmt
{
set;
get;
}
public double FeeTotal
{
set;
get;
}
public string PremNo
{
set;
get;
}
public double PremRate
{
set;
get;
}
public decimal LnRate
{
set;
get;
}
public string AppArea
{
set;
get;
}
public string AppUse
{
set;
get;
}
public int TermMon
{
set;
get;
}
public int TermDay
{
set;
get;
}
public string VouType
{
set;
get;
}
public string EndDate
{
set;
get;
}
public string PayType
{
set;
get;
}
public int PayDay
{
set;
get;
}
public decimal VouAmt
{
set;
get;
}
public string WorkType
{
set;
get;
}
public string WorkName
{
set;
get;
}
public string WorkSts
{
set;
get;
}
public string WorkWay
{
set;
get;
}
public string WorkCode
{
set;
get;
}
public string WorkAddr
{
set;
get;
}
public string WorkDuty
{
set;
get;
}
public string WorkTitle
{
set;
get;
}
public string WorkYear
{
set;
get;
}
public string IfCar
{
set;
get;
}
public string IfCarCred
{
set;
get;
}
public string IfRoom
{
set;
get;
}
public string IfMort
{
set;
get;
}
public string IfCard
{
set;
get;
}
public double CardAmt
{
set;
get;
}
public string IfApp
{
set;
get;
}
public string IfId
{
set;
get;
}
public string IfPact
{
set;
get;
}
public string PrePactNo
{
set;
get;
}
public string CzPactNo
{
set;
get;
}
public string CardChn
{
set;
get;
}

  • 直接创建一个空集合

    set_empty = set() print(set_empty) # set()

  • 根据参数创建

    # 根据参数 set_argument = set(42,'345','ry') print(set_argument) # 这样会报错,因为set只允许有一个参数

  • **根据列表来创建

    set_list = set([11,11,'45','11','ee']) print(set_list) # {11, 'ee', '45', '11'} 会自动删除重复对象

  • 根据元组来创建

    set_tuple = set((11,11,'45','11','ee',)) print(set_tuple) # {'ee', 11, '45', '11'} 同样会自动删除重复对象

  • 根据字典来创建

    set_dict = set({'k1':'v1','k2':2,'k3':'v3','k1':'v4'}) print(set_dict) # {'k3', 'k1', 'k2'} 只会存储key值,且不会重复

  • 字符串创建

    set_str = set('Hello Python') print(set_str) # {'y', 'o', 'n', ' ', 'P', 't', 'h', 'H', 'e', 'l'} 同样会删除字符串中重复的字符

  •  add(self, *args, **kwargs) 添加一个新的元素到集合中,如果添加的元素在集合中已经存在就不会有任何操作

    set_init = set([11,11,'45','11','ee']) set_init.add('Hello') print(set_init) # {'Hello', 11, 'ee', '11', '45'}

    set_init_str = set('Python') set_init_str.add('Hello,World') print(set_init_str) # {'Hello,World', 'o', 'P', 't', 'n', 'y', 'h'}

  •  clear(self, *args, **kwargs) 清除集合中元素,可以传参数

    set_init_clear = set([11,11,'45','11','ee']) set_init_clear.clear() print(set_init_clear) # set()

  •  copy(self, *args, **kwargs)  浅拷贝,会返回一个新的集合

    set_init_copy = set([11,11,'45','11','ee']) set_receive_copy = set_init_copy.copy() print(set_receive_copy) # {'ee', 11, '45', '11'}

  •  difference(self, *args, **kwargs)  比较两个集合类的不同,返回的是被主动比较的那个集合与比较集合的交集之外的子集(数学上叫啥给忘了)

    set_init_dif1 = set([11,22,33,44]) set_init_dif2 = set([33,44,55,66]) set_init_rece1 = set_init_dif1.difference(set_init_dif2) print(set_init_rece1) # {11, 22} set_init_rece2 = set_init_dif2.difference(set_init_dif1) print(set_init_rece2) # {66, 55}

  •  difference_update(self, *args, **kwargs)  删除两个集合的交际

    set_init_upd1 = set([11,22,33,44]) set_init_upd2 = set([33,44,55,66]) set_init_upd1.difference_update(set_init_upd2) print(set_init_upd1) # {22, 11}

    set_init_upd3 = set([11,22,33,44]) set_init_upd4 = set([33,44,55,66]) set_init_upd4.difference_update(set_init_upd3) print(set_init_upd4) # {66, 55}

  •  discard(self, *args, **kwargs)  删除集合中存在的元素,如果不存在就什么也不做

    set_init_dis = set([11,22,33,44,55]) set_init_dis.discard(11) print(set_init_dis) # {33, 44, 22, 55} 只能删除一个

  •  intersection(self, *args, **kwargs)  返回两个集合中的交集

    set_init_inter1 = set([11,22,33,44]) set_init_inter2 = set([33,44,55,66]) set_rece_inter1 = set_init_inter1.intersection(set_init_inter2) print(set_rece_inter1) # {33, 44}

  •  intersection_update(self, *args, **kwargs)  取出两个集合的交集,更新一个集合

    set_inter_upd1 = set([111,222,333,444]) set_inter_upd2 = set([333,444,55,66]) set_inter_upd1.intersection_update(set_inter_upd2) print(set_inter_upd1) # {444, 333}

  •  isdisjoint(self, *args, **kwargs)  判断两个集合是否有交集,如果有就返回False,如果没有就返回Ture

    set_isdis1 = set([111,222,333,444]) set_isdis2 = set([222,333]) set_receive_isdis1 = set_isdis1.isdisjoint(set_isdis2) print(set_receive_isdis1) # False 说明有交集

  •  issubset(self, *args, **kwargs)  判断A集合是否是B集合的子集

    set_issub1 = set([111,222,333,444]) set_issub2 = set([222,333]) set_receive_issub1 = set_issub1.issubset(set_issub2) print(set_receive_issub1) # False 说明set_issub1不是set_issub2的子集 set_receive_issub2 = set_issub2.issubset(set_issub1) print(set_receive_issub2) # True 说明set_issub2是set_issub1的子集

  •  issuperset(self, *args, **kwargs)  判断A集合是否是B集合的父类,就是A集合是否包含B集合.结果跟  issubset(self, *args, **kwargs) 相反

  •  pop(self, *args, **kwargs)  移除元素,同时可以定义一个变量来接收移除的元素,如果集合为空会报错

    set_pop = set([111,222,333,444,232]) set_receive_pop = set_pop.pop() print(set_pop) # {444, 333, 222, 111} print(set_receive_pop) # 232

  •  remove(self, *args, **kwargs)  删除元素

    set_remove = set([111,222,333,444,232]) set_remove.remove(111) print(set_remove) # {232, 444, 333, 222}

  •  symmetric_difference(self, *args, **kwargs)  取出两个差,更新到一个集合中,如果同时删除A,B两集合中相同元素删除.

    set_sym1 = set([1,2,3,4,5]) set_sym2 = set([2,3,4,5,6,]) set_receive_sym1 = set_sym1.symmetric_difference(set_sym2) print(set_receive_sym1) # {1, 6}

    set_sym3 = set([1,2,3,4,5]) set_sym4 = set([6,]) set_receive_sym2 = set_sym3.symmetric_difference(set_sym4) print(set_receive_sym2) # {1, 2, 3, 4, 5, 6}

  •  symmetric_difference_update(self, *args, **kwargs)  将B集合中有,而A集合中没有的更新到A集合中

    set_sym_up1 = set([1,2,3,4,5]) set_sym_up2 = set([2,3,4,5,6,]) set_sym_up1.symmetric_difference_update(set_sym_up2) print(set_sym_up1) # {1, 6}

    set_sym_up3 = set([1,2,3,4,5]) set_sym_up4 = set([6,]) set_sym_up3.symmetric_difference_update(set_sym_up4) print(set_sym_up3) # {1, 2, 3, 4, 5, 6}

  •  union(self, *args, **kwargs)  返回A集合和B集合的并集

    set_un1= set([11,22,33,44]) set_un2 = set([22,33,44,55]) set_rec_un = set_un1.union(set_un2) print(set_rec_un) # {33, 11, 44, 22, 55}

  •   update(self, *args, **kwargs)  A和B的并集,并返回A

    set_un_up1 = set([111,222,333,444]) set_un_up2 = set([222,333,444,555]) set_un_up1.update(set_un_up2) print(set_un_up1) # {555, 333, 111, 444, 222}

1 sadd

  set ts=4

public List<listGageData> listGage
{
set;
get;
}

 

向名称为 key 的 set 中添加元素

保存即可

public List<listComData> listCom
{
set;
get;
}

127.0.0.1:6379> sadd set hello

public List<listRelData> listRel
{
set;
get;
}
public List<listAcData> listAc
{
set;
get;
}
}
public class listAcData
{
public String acUse 
{
set;
get;
}
public double acAmt 
{
set;
get;
}
public String acType 
{
set;
get;
}
public String acno // 账户号
{
set;
get;
}
public String acName 
{
set;
get;
}
public String bankCode 
{
set;
get;
}
public String bankProv 
{
set;
get;
}
public String bankCity 
{
set;
get;
}
public String bankSite 
{
set;
get;
}
public String idType 
{
set;
get;
}
public String idNo 
{
set;
get;
}
public String phoneNo 
{
set;
get;
}
public String validDate 
{
set;
get;
}
public String cvvNo 
{
set;
get;
}
}

(integer) 1

public string I2101(string aa)
        {
            string getData = "";
            try
            {
                IntoPiecesData IntoPiecesInfo = new IntoPiecesData();

                IntoPiecesInfo.BrNo = "023";
                IntoPiecesInfo.BatNo = SourceCaseNo.Replace("-", "");
                IntoPiecesInfo.DataCnt = 1;
                DAL.ControllerBase con = DAL.ControllerFactory.GetNewController(DAL.e_ConsType.Main2);

                string sqlIntoData = string.Format(@"  ", aa);
                IntoData IntoDataInfo = new IntoData();
                DataTable dtIntoData = con.GetDataTable(sqlIntoData);
                List<listGageData> GageDataList = new List<listGageData>();

                if (dtIntoData.Rows.Count > 0)
                {
                    GageDataList.AddRange(CConvert.DataTableToList<listGageData>(dtIntoData));
                }
                IntoDataInfo.listGage = GageDataList;

                string sqlAcData = string.Format(@"   ", aa);
                DataTable dtAcData = con.GetDataTable(sqlAcData);
                List<listAcData> AcList = new List<listAcData>();
                if (dtAcData.Rows.Count > 0)
                {
                    AcList.AddRange(CConvert.DataTableToList<listAcData>(dtAcData));
                }
                IntoDataInfo.listAc = AcList;

                string sqlComData = string.Format(@"   ", aa);
                DataTable dtComData = con.GetDataTable(sqlComData);
                List<listComData> ComList = new List<listComData>();
                if (dtComData.Rows.Count > 0)
                {
                    ComList.AddRange(CConvert.DataTableToList<listComData>(dtComData));
                }
                IntoDataInfo.listCom = ComList;

                List<listRelData> RelList = new List<listRelData>();
                IntoDataInfo.listRel = RelList;

                string sql = string.Format(@"   ", aa);

                    DataTable dt = con.GetDataTable(sql);

                    IntoDataInfo.PactNo = SourceCaseNo.Replace("-", "");
                    IntoDataInfo.CustName = dt.Rows[0]["custName"].ToString();
                    IntoDataInfo.IdType = dt.Rows[0]["idType"].ToString();
                    IntoDataInfo.IdNo = dt.Rows[0]["idNo"].ToString();
                    IntoDataInfo.CustType = "03"; 
                    IntoDataInfo.Sex = dt.Rows[0]["sex"].ToString();
                    IntoDataInfo.Birth = dt.Rows[0]["birth"].ToString();
                    IntoDataInfo.Marriage = dt.Rows[0]["marriage"].ToString();
                    IntoDataInfo.Children = dt.Rows[0]["children"].ToString();
                    IntoDataInfo.Edu = dt.Rows[0]["edu"].ToString();
                    IntoDataInfo.Degree = "9"; 
                    IntoDataInfo.TelNo = dt.Rows[0]["telNo"].ToString();
                    IntoDataInfo.PhoneNo = dt.Rows[0]["phoneNo"].ToString();
                    IntoDataInfo.PostCode = "";
                    IntoDataInfo.PostAddr = "";
                    IntoDataInfo.HomeArea = "000000";
                    IntoDataInfo.HomeTel = "";
                    IntoDataInfo.HomeCode = "";
                    IntoDataInfo.HomeAddr = dt.Rows[0]["homeAddr"].ToString();
                    IntoDataInfo.HomeSts = dt.Rows[0]["homeSts"].ToString();
                    IntoDataInfo.Income = dt.Rows[0]["income"].AsTargetType<double>(0);
                    IntoDataInfo.MateName = dt.Rows[0]["mateName"].ToString();
                    IntoDataInfo.MateIdtype = dt.Rows[0]["mateIdtype"].ToString();
                    IntoDataInfo.MateIdno = dt.Rows[0]["mateIdno"].ToString();
                    IntoDataInfo.MateWork = dt.Rows[0]["mateWork"].ToString();
                    IntoDataInfo.MateTel = dt.Rows[0]["mateTel"].ToString();
                    IntoDataInfo.ProjNo = "30856";
                    IntoDataInfo.PrdtNo = "100001";
                    IntoDataInfo.FeeTotal = 0d;
                    IntoDataInfo.PremNo="";
                    IntoDataInfo.PremRate=0d;
                    IntoDataInfo.PactAmt = dt.Rows[0]["pactAmt"].AsTargetType<double>(0);
                    IntoDataInfo.LnRate = Math.Round(dt.Rows[0]["lnRate"].AsTargetType<decimal>(0), 6); //dt.Rows[0]["lnRate"].AsTargetType<double>(0);
                    IntoDataInfo.AppArea = "000000";
                    IntoDataInfo.AppUse = dt.Rows[0]["AppUse"].ToString();
                    IntoDataInfo.TermMon = dt.Rows[0]["termMon"].AsTargetType<int>(0);
                    IntoDataInfo.TermDay = 0;
                    IntoDataInfo.VouType = "2";
                    IntoDataInfo.EndDate = "";
                    IntoDataInfo.PayType = "02";
                    IntoDataInfo.PayDay = dt.Rows[0]["payDay"].AsTargetType<int>(0);
                    IntoDataInfo.VouAmt = Math.Round(dt.Rows[0]["VouAmt"].AsTargetType<decimal>(0), 2);
                    IntoDataInfo.WorkType = "Z";
                    IntoDataInfo.WorkName = "";//dt.Rows[0]["workName"].ToString();
                    IntoDataInfo.WorkSts = "01";
                    IntoDataInfo.WorkWay = dt.Rows[0]["workWay"].ToString();
                    IntoDataInfo.WorkCode = "";
                    IntoDataInfo.WorkAddr = "";//dt.Rows[0]["workAddr"].ToString();
                    IntoDataInfo.WorkDuty = dt.Rows[0]["workDuty"].ToString();
                    IntoDataInfo.WorkTitle = "9";
                    IntoDataInfo.WorkYear = "";
                    IntoDataInfo.IfCar = "2";
                    IntoDataInfo.IfCarCred = "2";
                    IntoDataInfo.IfRoom = "1";
                    IntoDataInfo.IfMort = "1";
                    IntoDataInfo.IfCard = "2";
                    IntoDataInfo.CardAmt = 0;
                    IntoDataInfo.IfApp = "2";
                    IntoDataInfo.IfId = "1";
                    IntoDataInfo.IfPact = "2";
                    IntoDataInfo.PrePactNo = SourceCaseNo.Replace("-", "");
                    IntoDataInfo.CzPactNo = "";
                    IntoDataInfo.CardChn = "CL0002";

                    List<IntoData> IntoDataList = new List<IntoData>();

                    IntoDataList.Add(IntoDataInfo);

                    IntoPiecesInfo.list = IntoDataList;

                    string IntoPiecesJson = JsonConvert.SerializeObject(IntoPiecesInfo);

            }
            catch (Exception ex)
            {
                return ex.Message;
            }

            return getData;
        }

127.0.0.1:6379> sadd set world

 

(integer) 1

127.0.0.1:6379> sadd set world

(integer) 0

查看set元素

127.0.0.1:6379> smembers set

1) "hello"

2) "world"

2 srem

删除名称为 key 的 set 中的元素 member

127.0.0.1:6379> smembers set

1) "hello"

2) "world"

127.0.0.1:6379> srem set world

(integer) 1

127.0.0.1:6379> smembers set

1) "hello"

3 spop

随机返回并删除名称为 key 的 set 中一个元素

127.0.0.1:6379> smembers set

1) "three"

2) "zero"

3) "two"

4) "one"

5) "four"

127.0.0.1:6379> spop set

"zero"

127.0.0.1:6379> spop set

"three"

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

4 sdiff

回所有给定 key 与第一个 key 的差集(第一个)

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sdiff set set1

1) "four"

127.0.0.1:6379> sdiff set1 set

1) "three"

5 sdiffstore

返回所有给定 key 与第一个 key 的差集,并将结果存为另一个 key

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sdiffstore set2 set set1

(integer) 1

127.0.0.1:6379> smembers set2

1) "four"

6 sinter

返回所有给定 key 的交集

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sinter set set1

1) "two"

2) "one"

7 sinterstore

返回所有给定 key 的交集,并将结果存为另一个 key

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sinterstore set2 set set1

(integer) 2

127.0.0.1:6379> smembers set2

1) "one"

2) "two"

8 sunion

返回所有给定 key 的并集

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sunion set set1

1) "two"

2) "one"

3) "four"

4) "three"

9 sunionstore

返回所有给定 key 的并集,并将结果存为另一个 key

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smembers set1

1) "three"

2) "two"

3) "one"

127.0.0.1:6379> sunionstore set2 set set1

(integer) 4

127.0.0.1:6379> smembers set2

1) "two"

2) "one"

3) "four"

4) "three"

10 smove

从第一个 key 对应的 set 中移除 member 并添加到第二个对应 set 中

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> smove set set2 one

(integer) 1

127.0.0.1:6379> smembers set2

1) "one"

11 scard

返回名称为 key 的 set 的元素个数

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> scard set

(integer) 3

12 sismember

测试 member 是否是名称为 key 的 set 的元素

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> scard set

(integer) 3

127.0.0.1:6379> sismember set one

(integer) 1

127.0.0.1:6379> sismember set three

(integer) 0

13 srandmember

随机返回名称为 key 的 set 的一个元素,但是不删除元素

127.0.0.1:6379> smembers set

1) "four"

2) "one"

3) "two"

127.0.0.1:6379> srandmember set

"one"

编辑:操作系统 本文来源:澳门新濠3559:根据参数创建,保存即可

关键词: