This commit is contained in:
李鹏飞 2023-04-07 15:26:52 +08:00
commit 745004f761
2 changed files with 56 additions and 4 deletions

View File

@ -21,6 +21,58 @@ namespace BLL
return Funs.DB.Model_QualityModel.FirstOrDefault(e => e.QualityModelId == QualityModelId);
}
/// <summary>
/// 获取质量样板信息
/// </summary>
/// <param name="UnitWorkId"></param>
/// <returns></returns>
public static List<Model.Model_QualityModel> GetQualityModelByIdForApi(string QualityModelId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.Model_QualityModel> q = db.Model_QualityModel;
if (!string.IsNullOrEmpty(QualityModelId))
{
q = q.Where(e => e.QualityModelId == QualityModelId);
}
var qres = from x in q
orderby x.CompileDate descending
select new
{
x.QualityModelId,
x.ProjectId,
x.CompanyModelId,
ModelType = (from y in db.Base_CompanyModel where y.CompanyModelId == x.CompanyModelId select y.ModelType).First(),
CompanyModelKindName = (from y in db.Base_CompanyModelKind
join z in db.Base_CompanyModel on y.CompanyModelKindId equals z.CompanyModelKindId
where z.CompanyModelId == x.CompanyModelId
select y.CompanyModelKindName).First(),
x.Evaluate,
x.Remark,
x.CompileDate,
x.CompileMan,
CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(),
x.AttachUrl,
};
List<Model.Model_QualityModel> res = new List<Model.Model_QualityModel>();
foreach (var item in qres)
{
Model.Model_QualityModel cd = new Model.Model_QualityModel();
cd.QualityModelId = item.QualityModelId;
cd.ProjectId = item.ProjectId;
cd.CompanyModelId = item.CompanyModelId + "$" + item.ModelType + "$" + item.CompanyModelKindName;
cd.Evaluate = item.Evaluate;
cd.Remark = item.Remark;
cd.CompileDate = item.CompileDate;
cd.CompileMan = item.CompileMan + "$" + item.CompileManName;
cd.AttachUrlModel = AttachFileService.getFileUrl(item.CompanyModelId);
cd.AttachUrl = AttachFileService.getFileUrl(item.QualityModelId);
res.Add(cd);
}
return res;
}
}
/// <summary>
/// 添加公司质量样板
/// </summary>

View File

@ -33,13 +33,13 @@ namespace WebAPI.Controllers
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<Model_QualityModel> GetModelsById(string id)
public ResponseData<List<Model_QualityModel>> GetModelsById(string id)
{
ResponseData<Model_QualityModel> res = new ResponseData<Model_QualityModel>();
Model_QualityModel cd = BLL.QualityModelService.GetQualityModelById(id);
ResponseData<List<Model_QualityModel>> res = new ResponseData<List<Model_QualityModel>>();
List<Model_QualityModel> cd = BLL.QualityModelService.GetQualityModelByIdForApi(id);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<Model_QualityModel>(cd, true);
res.resultValue = cd;
return res;
}