“isDel”: true, 开启删除前验证
"mergeUserId": [
{
"type": "required",
"required": true,
"isAdd": true,
"isEdit": true,
"isDel": true,
"message": "【{merge_user_id}】值必须填写。"
},
{
"type": "maxlength",
"required": false,
"isAdd": true,
"isEdit": true,
"max": 36,
"message": "【{merge_user_id}】值最大长度为36。"
}
],
"userId": [
{
"type": "required",
"required": true,
"isAdd": true,
"isEdit": true,
"isDel": true,
"message": "【{user_id}】值必须填写。"
},
{
"type": "userOr",
"required": true,
"orField": "mergeUserId",
"isAdd": true,
"isEdit": true,
"isDel": true,
"message": "【{user_id}】只能操作自己数据。"
},
删除前验证
//删除前验证
if (jToken is JObject)
{
pf.FromOpRmt = RequestModuleType.DeletePost;
_dbExecuteRepository.SetRuleRearEnd(pf, sqlConfig, dictionaryUrl, pf.ModuleKey, pf.ReponseField, (JObject)jToken, false, _accessor.HttpContext);
}
else if (jToken is JArray)
{
foreach (var token in (JArray)jToken)
{
pf.FromOpRmt = RequestModuleType.DeletePost;
_dbExecuteRepository.SetRuleRearEnd(pf, sqlConfig, dictionaryUrl, pf.ModuleKey, pf.ReponseField, (JObject)token, false, _accessor.HttpContext);
}
}
批量删除前验证
if (jArray.Count() > 0)
{
foreach (var token in jArray)
{
pf.FromOpRmt = RequestModuleType.DeletePost;
_dbExecuteRepository.SetRuleRearEnd(pf, sqlConfig, dictionaryUrl, pf.ModuleKey, pf.ReponseField, (JObject)token, false, accessor.HttpContext);
}
SqlOpDelete sqlOp = StartDelete(pf, dbConnection, unitOfWork.Transaction, dictionaryUrl, sqlConfig, jArray, RequestModuleType.BatSave);
if (sqlOp.Result.DoResult)
{
sopResult.Result.DeleteSuccess++;
}
else
{
sopResult.Result.DeleteError++;
}
}
文档更新时间: 2022-01-09 20:59 作者:admin