Example #1
0
        public IActionResult GetModelById(string keyValue)
        {
            var resultModel = new RespResultCountViewModel();

            try
            {
                if (string.IsNullOrEmpty(keyValue))
                {
                    resultModel.code = -1;
                    resultModel.msg  = "没有检索到机构数据,缺少主键值";
                    return(Ok(resultModel));
                }
                var data = _organizeService.GetEntityById(keyValue);
                if (data != null)
                {
                    resultModel.code  = 0;
                    resultModel.msg   = "查询机构成功";
                    resultModel.data  = data;
                    resultModel.count = 1;
                }
                else
                {
                    resultModel.code = -1;
                    resultModel.msg  = "没有检索到机构数据";
                }
                return(Ok(resultModel));
            }
            catch (Exception ex)
            {
                resultModel.code = -1;
                resultModel.msg  = "操作失败:" + ex.Message;
                resultModel.data = null;
                return(Ok(resultModel));
            }
        }