Buggy code:
@ MybatisMapper public interface ResourceMapper { @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>pattern,<seq2seq4repair_space>method,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources" + "<seq2seq4repair_space>where<seq2seq4repair_space>pattern<seq2seq4repair_space>=<seq2seq4repair_space>#{pattern}<seq2seq4repair_space>and<seq2seq4repair_space>method<seq2seq4repair_space>=<seq2seq4repair_space>#{method}" ) @ ResultMap ( "ResourceResult" ) Resource findByPatternAndMethod ( @ Param ( "pattern" ) String pattern , @ Param ( "method" ) ResourceMapping . RequestMethod method ) { } @ Select ( "select<seq2seq4repair_space>count(1)<seq2seq4repair_space>from<seq2seq4repair_space>role_resources<seq2seq4repair_space>rr,<seq2seq4repair_space>role_users<seq2seq4repair_space>ru<seq2seq4repair_space>where<seq2seq4repair_space>rr.role_id<seq2seq4repair_space>=<seq2seq4repair_space>ru.role_id<seq2seq4repair_space>" + "and<seq2seq4repair_space>rr.resource_id<seq2seq4repair_space>=<seq2seq4repair_space>#{resourceId}<seq2seq4repair_space>and<seq2seq4repair_space>ru.user_id<seq2seq4repair_space>=<seq2seq4repair_space>#{userId}" ) Integer countByUserId ( @ Param ( "userId" ) String userId , @ Param ( "resourceId" ) String resourceId ) { } @ Select ( "select<seq2seq4repair_space>mr.menu_id,<seq2seq4repair_space>mr.order_num,<seq2seq4repair_space>t.*<seq2seq4repair_space>from" + ( ( ( "<seq2seq4repair_space>(select<seq2seq4repair_space>distinct<seq2seq4repair_space>r.id,<seq2seq4repair_space>r.name,<seq2seq4repair_space>r.pattern,<seq2seq4repair_space>r.method,<seq2seq4repair_space>r.created_time,<seq2seq4repair_space>r.updated_time" + "<seq2seq4repair_space>from<seq2seq4repair_space>resources<seq2seq4repair_space>r,<seq2seq4repair_space>role_resources<seq2seq4repair_space>rr,<seq2seq4repair_space>role_users<seq2seq4repair_space>ru" ) + "<seq2seq4repair_space>where<seq2seq4repair_space>r.id<seq2seq4repair_space>=<seq2seq4repair_space>rr.resource_id<seq2seq4repair_space>and<seq2seq4repair_space>rr.role_id<seq2seq4repair_space>=<seq2seq4repair_space>ru.role_id<seq2seq4repair_space>and<seq2seq4repair_space>ru.user_id<seq2seq4repair_space>=<seq2seq4repair_space>#{userId})<seq2seq4repair_space>t,<seq2seq4repair_space>menu_resources<seq2seq4repair_space>mr" ) + "<seq2seq4repair_space>where<seq2seq4repair_space>t.id<seq2seq4repair_space>=<seq2seq4repair_space>mr.resource_id<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>mr.menu_id,<seq2seq4repair_space>mr.order_num" ) ) @ ResultMap ( "ResourceOrderResult" ) List < Resource > findUserResources ( String userId ) { } @ Select ( "select<seq2seq4repair_space>count(1)<seq2seq4repair_space>from<seq2seq4repair_space>resources" ) <START_BUG> long count ( ) ; <END_BUG> @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>pattern,<seq2seq4repair_space>method,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources" + "<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>created_time<seq2seq4repair_space>desc<seq2seq4repair_space>limit<seq2seq4repair_space>#{limit}<seq2seq4repair_space>offset<seq2seq4repair_space>#{offset}" ) @ ResultMap ( "ResourceResult" ) List < Resource > page ( @ Param ( "limit" ) int limit , @ Param ( "offset" ) long offset ) { } @ Insert ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>resources<seq2seq4repair_space>(id,<seq2seq4repair_space>name,<seq2seq4repair_space>pattern,<seq2seq4repair_space>method,<seq2seq4repair_space>created_time)" + "<seq2seq4repair_space>values<seq2seq4repair_space>(#{id},<seq2seq4repair_space>#{name},<seq2seq4repair_space>#{pattern},<seq2seq4repair_space>#{method},<seq2seq4repair_space>#{createdTime})" ) void insert ( Resource resource ) { } @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>pattern,<seq2seq4repair_space>method,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) @ ResultMap ( "ResourceResult" ) Resource find ( String id ) { } @ Update ( "update<seq2seq4repair_space>resources<seq2seq4repair_space>set<seq2seq4repair_space>name<seq2seq4repair_space>=<seq2seq4repair_space>#{name},<seq2seq4repair_space>pattern<seq2seq4repair_space>=<seq2seq4repair_space>#{pattern},<seq2seq4repair_space>method<seq2seq4repair_space>=<seq2seq4repair_space>#{method}," + "<seq2seq4repair_space>updated_time<seq2seq4repair_space>=<seq2seq4repair_space>#{updatedTime}<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) void update ( @ Param ( "id" ) String id , @ Param ( "name" ) String name , @ Param ( "pattern" ) String pattern , @ Param ( "method" ) ResourceMapping . RequestMethod method , @ Param ( "updatedTime" ) Date updatedTime ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>role_resources<seq2seq4repair_space>where<seq2seq4repair_space>resource_id<seq2seq4repair_space>=<seq2seq4repair_space>#{resourceId}" ) void deleteResourceRole ( @ Param ( "resourceId" ) String resourceId ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>resources<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) void delete ( @ Param ( "id" ) String id ) { } @ Select ( "select<seq2seq4repair_space>r.id,<seq2seq4repair_space>r.name,<seq2seq4repair_space>r.pattern,<seq2seq4repair_space>r.method,<seq2seq4repair_space>r.created_time,<seq2seq4repair_space>r.updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources<seq2seq4repair_space>r,<seq2seq4repair_space>menu_resources<seq2seq4repair_space>mr" + "<seq2seq4repair_space>where<seq2seq4repair_space>r.id<seq2seq4repair_space>=<seq2seq4repair_space>mr.resource_id<seq2seq4repair_space>and<seq2seq4repair_space>mr.menu_id<seq2seq4repair_space>=<seq2seq4repair_space>#{menuId}<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>mr.order_num" ) @ ResultMap ( "ResourceResult" ) List < Resource > findMenuResources ( @ Param ( "menuId" ) String menuId ) { } @ Select ( "select<seq2seq4repair_space>r.id,<seq2seq4repair_space>r.name,<seq2seq4repair_space>r.pattern,<seq2seq4repair_space>r.method,<seq2seq4repair_space>r.created_time,<seq2seq4repair_space>r.updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources<seq2seq4repair_space>r" + ( "<seq2seq4repair_space>where<seq2seq4repair_space>r.method<seq2seq4repair_space>=<seq2seq4repair_space>'GET'<seq2seq4repair_space>and<seq2seq4repair_space>not<seq2seq4repair_space>exists" + "<seq2seq4repair_space>(select<seq2seq4repair_space>*<seq2seq4repair_space>from<seq2seq4repair_space>menu_resources<seq2seq4repair_space>mr<seq2seq4repair_space>where<seq2seq4repair_space>r.id<seq2seq4repair_space>=<seq2seq4repair_space>mr.resource_id<seq2seq4repair_space>and<seq2seq4repair_space>mr.menu_id<seq2seq4repair_space>=<seq2seq4repair_space>#{menuId})" ) ) @ ResultMap ( "ResourceResult" ) List < Resource > findUnMenuResources ( @ Param ( "menuId" ) String menuId ) { } @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>menu_id,<seq2seq4repair_space>resource_id,<seq2seq4repair_space>order_num,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>menu_resources" + "<seq2seq4repair_space>where<seq2seq4repair_space>menu_id<seq2seq4repair_space>=<seq2seq4repair_space>#{menuId}<seq2seq4repair_space>and<seq2seq4repair_space>resource_id<seq2seq4repair_space>=<seq2seq4repair_space>#{resourceId}" ) @ ResultMap ( "MenuResourceResult" ) MenuResource findMenuResource ( @ Param ( "menuId" ) String menuId , @ Param ( "resourceId" ) String resourceId ) { } @ Update ( "update<seq2seq4repair_space>menu_resources<seq2seq4repair_space>set<seq2seq4repair_space>order_num<seq2seq4repair_space>=<seq2seq4repair_space>#{orderNum}<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) void updateMenuResourceOrderNum ( @ Param ( "id" ) String id , @ Param ( "orderNum" ) Integer orderNum ) { } @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>pattern,<seq2seq4repair_space>method,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>resources" ) @ ResultMap ( "ResourceResult" ) List < Resource > all ( ) { } }

Fix:
Long count ( ) ;