Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复当mapper目录没有mapper的xml配置文件的时候,启动报错的问题 #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jaychang9
Copy link

按照作者当前的做法,在src/main/resources/mapper目录是必须存在的,启动才能成功。
但我们有些时候,项目比较简单,不需要写XxxMapper.xml这样的文件,而是使用注解的方式如。

package com.company.project.dao;

import com.company.project.core.Mapper;
import com.company.project.model.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper extends Mapper<User> {
    @Select("SELECT username FROM user WHERE id = #{id}")
    public String selectUsernameById(@Param("id") Long id);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant