问答详情
源自:2-4 Mybatis自动生成器使用方式

Invalid bound statement (not found): com.glshopproject.dao.UserDOMapper.selectByPrimaryKey,找不到selectByPrimaryKey,找不到解决的办法

@SpringBootApplication(scanBasePackages = {"com.glshopproject"})
@RestController
@MapperScan("com.glshopproject.dao")
public class App 
{
    @Autowired
    private UserDOMapper userDOMapper;
    @RequestMapping("/")
    public String home()
    {
        UserDO userDO= userDOMapper.selectByPrimaryKey(1);
        if (userDO==null)
        {return  "用户对象不存在";}
        else{
            return userDO.getName();
        }

    }
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        SpringApplication.run(App.class,args);
    }
}


提问者:qq_鏖战_0 2021-10-13 01:16

个回答

  • qq_鏖战_0
    2021-10-14 22:14:01

    application.properties文件有单词拼错,低级错误,嘤嘤嘤