public DataItemDetailApiController(IServiceCollection collection, ILogger <DataItemDetailApiController> logger,
                                    IBaseUnitOfWork baseUnitOfWork,
                                    IMediator mediator,
                                    IDataItemDetailService dataItemService,
                                    IDataItemDetailRules dataItemRules)
     : base(baseUnitOfWork, collection, logger)
 {
     this._baseUnitOfWork  = baseUnitOfWork;
     this._mediator        = mediator;
     this._dataItemService = dataItemService;
     this._dataItemRules   = dataItemRules;
 }
        public DataItemDetailViewModelValidator(IDataItemDetailRules dataItemDetailRules)
        {
            _dataItemDetailRules = dataItemDetailRules;

            RuleFor(item => item.ItemName)
            .NotEmpty().WithMessage("字典项名称不能为空")
            .Length(1, 100).WithMessage("字典项名称长度必须介于1和100个字符之间..")
            .Must(HaveUniqueName).WithMessage("已存在相同名称的字典项.");

            RuleFor(item => item.ItemValue)
            .NotEmpty().WithMessage("字典项值不能为空")
            .Length(1, 100).WithMessage("字典项值长度必须介于1和100个字符之间.")
            .Must(HaveUniqueValue).WithMessage("已存在相同值的字典项.");

            RuleFor(item => item.SortIndex).NotEmpty()
            .WithMessage("排序不能为空");
        }