{
"UID" : 0,
"RiDs" : [
0
],
"ULoginName" : "string",
"ULoginPWD" : "string",
"URealName" : "string",
"UStatus" : 0,
"URemark" : "string",
"UCreateTime" : "the 2021-01-21 T02:42:34. 831 z,"
"UUpdateTime" : "the 2021-01-21 T02:42:34. 831 z,"
"ULastErrTime" : "the 2021-01-21 T02:42:34. 831 z,"
"UErrorCount" : 0,
"Name" : "string",
"Sex" : 0,
"Age" : 0,
"Birth" : "the 2021-01-21 T02:42:34. 831 z,"
"Addr" : "string",
"TdIsDelete" : true,
"RoleNames" : [
"String"
]
}
public async TaskPut ([FromBody] sysUserInfo sysUserInfo)
But to update the case, uCreateTime uUpdateTime, uLastErrTime don't should be by the user to fill in, even if I will be the three parameters are removed from the json, but because of receiving sysUserInfo will still have the three parameters, but may not value for the right time, should be method can achieve automatic judging which parameters is the require, which is optional, and update only part of the data...
Now Add and Put in the same Class (sysUserInfo) to receive the data, I have to create a specifically for the use of the Put update the Class?
Pleas board great god gives guidance or keyword query, thank you,
CodePudding user response:
Whether to set up based on the SqlSugar update only which fieldsusing (SqlSugarClient db=new SqlSugarClient (new ConnectionConfig ()
{
The ConnectionString=Server="XXXXX",
DbType=DbType. Essentially,
IsAutoCloseConnection=true,
InitKeyType=InitKeyType. Attribute
}))
{
//the Where By Expression
Var test=db. Updateable(it=& gt; New sysUserInfo () {uLoginName=", "uLoginPWD=" ", uRealName=""}) Where (=it & gt; It. The uID==0). ExecuteCommand ();
}
CodePudding user response: