public async Task <IActionResult> GetIndicatorWarningLimit([FromQuery] GetIndicatorWarningLimitRequestDto request) { var warningLimitBiz = new IndicatorWarningLimitBiz(); var limits = await warningLimitBiz.GetIndicatorWarningLimits(request); if (limits.Count <= 0) { return(Failed(ErrorCode.Empty, "指标不存在")); } var response = new GetIndicatorWarningLimitResponseDto() { TurnOnWarning = limits.FirstOrDefault().TurnOnWarning, Limits = limits }; return(Success(response)); }
public async Task <List <GetIndicatorWarningLimit> > GetIndicatorWarningLimits(GetIndicatorWarningLimitRequestDto request) { var sql = @"select distinct i.option_guid as OptionGuid, i.option_name as OptionName, i.option_unit as OptionUnit, ifnull(l.min_value,0) as `MinValue`, ifnull(l.max_value,0) as `MaxValue`, ifnull(l.turn_on_warning,false) as TurnOnWarning from t_health_indicator_option as i left join t_consumer_indicator_warning_limit as l on i.option_guid = l.indicator_option_guid and l.user_guid = @ConsumerGuid where i.indicator_guid = @IndicatorGuid" ; using (var conn = MySqlHelper.GetConnection()) { return((await conn.QueryAsync <GetIndicatorWarningLimit>(sql, new { request.ConsumerGuid, request.IndicatorGuid })).ToList()); } }