Buggy code:
@ MybatisMapper public interface RoleMapper { @ Insert ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>role_users(role_id,<seq2seq4repair_space>user_id)<seq2seq4repair_space>values<seq2seq4repair_space>(#{roleId},<seq2seq4repair_space>#{userId})" ) void insertUserRole ( @ Param ( "roleId" ) String roleId , @ Param ( "userId" ) String userId ) { } @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>roles<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>created_time" ) @ ResultMap ( "RoleResult" ) List < Role > all ( ) { } @ Select ( "select<seq2seq4repair_space>r.id,<seq2seq4repair_space>r.name,<seq2seq4repair_space>r.created_time,<seq2seq4repair_space>r.updated_time<seq2seq4repair_space>from<seq2seq4repair_space>roles<seq2seq4repair_space>r,<seq2seq4repair_space>role_users<seq2seq4repair_space>ru" + "<seq2seq4repair_space>where<seq2seq4repair_space>r.id<seq2seq4repair_space>=<seq2seq4repair_space>ru.role_id<seq2seq4repair_space>and<seq2seq4repair_space>ru.user_id<seq2seq4repair_space>=<seq2seq4repair_space>#{userId}" ) @ ResultMap ( "RoleResult" ) List < Role > userRoles ( @ Param ( "userId" ) String userId ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>role_users<seq2seq4repair_space>where<seq2seq4repair_space>user_id<seq2seq4repair_space>=<seq2seq4repair_space>#{userId}" ) void deleteUserRole ( @ Param ( "userId" ) String userId ) { } @ Select ( "select<seq2seq4repair_space>count(1)<seq2seq4repair_space>from<seq2seq4repair_space>roles" ) <START_BUG> long count ( ) ; <END_BUG> @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>roles" + "<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 ( "RoleResult" ) List < Role > page ( @ Param ( "limit" ) int limit , @ Param ( "offset" ) long offset ) { } @ Insert ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>roles<seq2seq4repair_space>(id,<seq2seq4repair_space>name,<seq2seq4repair_space>created_time)<seq2seq4repair_space>values<seq2seq4repair_space>(#{id},<seq2seq4repair_space>#{name},<seq2seq4repair_space>#{createdTime})" ) void insert ( Role role ) { } @ Select ( "select<seq2seq4repair_space>id,<seq2seq4repair_space>name,<seq2seq4repair_space>created_time,<seq2seq4repair_space>updated_time<seq2seq4repair_space>from<seq2seq4repair_space>roles<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) @ ResultMap ( "RoleResult" ) Role find ( @ Param ( "id" ) String id ) { } @ Update ( "update<seq2seq4repair_space>roles<seq2seq4repair_space>set<seq2seq4repair_space>name<seq2seq4repair_space>=<seq2seq4repair_space>#{name},<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 ( "updatedTime" ) Date updatedTime ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>roles<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>#{id}" ) void delete ( @ Param ( "id" ) String id ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>role_users<seq2seq4repair_space>where<seq2seq4repair_space>role_id<seq2seq4repair_space>=<seq2seq4repair_space>#{roleId}" ) void deleteRoleUser ( @ Param ( "roleId" ) String roleId ) { } @ 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>role_resources<seq2seq4repair_space>rr" + "<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>#{roleId}" ) @ ResultMap ( "ResourceResult" ) List < Resource > findRoleResources ( @ Param ( "roleId" ) String roleId ) { } @ Select ( "select<seq2seq4repair_space>u.id,<seq2seq4repair_space>u.username,<seq2seq4repair_space>u.status,<seq2seq4repair_space>u.created_time,<seq2seq4repair_space>u.updated_time<seq2seq4repair_space>from<seq2seq4repair_space>users<seq2seq4repair_space>u,<seq2seq4repair_space>role_users<seq2seq4repair_space>ru" + "<seq2seq4repair_space>where<seq2seq4repair_space>u.id<seq2seq4repair_space>=<seq2seq4repair_space>ru.user_id<seq2seq4repair_space>and<seq2seq4repair_space>ru.role_id<seq2seq4repair_space>=<seq2seq4repair_space>#{roleId}" ) @ ResultMap ( "UserResult" ) List < User > findRoleUsers ( @ Param ( "roleId" ) String roleId ) { } @ Delete ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>role_resources<seq2seq4repair_space>where<seq2seq4repair_space>role_id<seq2seq4repair_space>=<seq2seq4repair_space>#{roleId}" ) void deleteRoleResource ( @ Param ( "roleId" ) String roleId ) { } @ Select ( "select<seq2seq4repair_space>r.id,<seq2seq4repair_space>r.name,<seq2seq4repair_space>r.created_time,<seq2seq4repair_space>r.updated_time<seq2seq4repair_space>from<seq2seq4repair_space>roles<seq2seq4repair_space>r,<seq2seq4repair_space>role_resources<seq2seq4repair_space>rr" + "<seq2seq4repair_space>where<seq2seq4repair_space>r.id<seq2seq4repair_space>=<seq2seq4repair_space>rr.role_id<seq2seq4repair_space>and<seq2seq4repair_space>rr.resource_id<seq2seq4repair_space>=<seq2seq4repair_space>#{resourceId}" ) @ ResultMap ( "RoleResult" ) List < Role > resourceRoles ( @ Param ( "resourceId" ) String resourceId ) { } @ 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 ) { } @ Insert ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>role_resources(role_id,<seq2seq4repair_space>resource_id)<seq2seq4repair_space>values<seq2seq4repair_space>(#{roleId},<seq2seq4repair_space>#{resourceId})" ) void insertResourceRole ( @ Param ( "roleId" ) String roleId , @ Param ( "resourceId" ) String resourceId ) { } }

Fix:
Long count ( ) ;