Skip to content

Commit

Permalink
optimize the sql statement to get the last api id
Browse files Browse the repository at this point in the history
  • Loading branch information
chengjoey committed Dec 27, 2023
1 parent af96aa4 commit 28c18b8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (impl *GatewayUpstreamApiServiceImpl) updateFields(update *orm.GatewayUpstr
func (impl *GatewayUpstreamApiServiceImpl) GetLastApiId(cond *orm.GatewayUpstreamApi) string {
var descList []orm.GatewayUpstreamApi
err := orm.Desc(impl.engine, "register_id").And("upstream_id = ? and api_name = ? and api_id != ''",
cond.UpstreamId, cond.ApiName).Find(&descList)
cond.UpstreamId, cond.ApiName).Limit(1).Find(&descList)
if err != nil {
log.Errorf("error happend:%+v", errors.WithStack(err))
return ""
Expand Down

0 comments on commit 28c18b8

Please sign in to comment.