|
|
@ -16,6 +16,25 @@ public class Ghre_QuestionController : BaseController<IGhre_QuestionServices, Gh |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 基础接口 |
|
|
|
#region 基础接口 |
|
|
|
|
|
|
|
#region 查询 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 根据Id查询数据 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="Id">主键ID</param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
[HttpPost("Query/{Id}")] |
|
|
|
|
|
|
|
public override async Task<ServiceResult<Ghre_QuestionDto>> QueryById(long Id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var entity = await _service.QueryById(Id); |
|
|
|
|
|
|
|
entity.Answers = await _ghre_QuestionAnswerServices.Query(x => x.QuestionId == Id, "TaxisNo ASC"); |
|
|
|
|
|
|
|
if (entity is null) |
|
|
|
|
|
|
|
return Failed<Ghre_QuestionDto>("获取失败", 500); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return Success(entity, "获取成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
#region 新增 |
|
|
|
#region 新增 |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 新增数据 |
|
|
|
/// 新增数据 |
|
|
@ -60,7 +79,7 @@ public class Ghre_QuestionController : BaseController<IGhre_QuestionServices, Gh |
|
|
|
[HttpPost("Update/{Id}")] |
|
|
|
[HttpPost("Update/{Id}")] |
|
|
|
public override async Task<ServiceResult> Put(long Id, [FromBody] EditGhre_QuestionInput editModel) |
|
|
|
public override async Task<ServiceResult> Put(long Id, [FromBody] EditGhre_QuestionInput editModel) |
|
|
|
{ |
|
|
|
{ |
|
|
|
await _ghre_QuestionAnswerServices.Delete(x=>x.QuestionId == Id); |
|
|
|
await _ghre_QuestionAnswerServices.Delete(x => x.QuestionId == Id); |
|
|
|
var answers = editModel.Answers; |
|
|
|
var answers = editModel.Answers; |
|
|
|
if (answers.Any()) |
|
|
|
if (answers.Any()) |
|
|
|
{ |
|
|
|
{ |
|
|
|