基于注解开发MyBatis时出现的问题

//dao接口
@Repository
public interface IVacDao {

    @Select("select * from vaccine_remind where isvr = 0")
    @Results(id="reminds",value={
            @Result(id=true,column = "vrid",property = "vrid"),
            @Result(column = "vruid",property = "vruid"),
            @Result(column = "vrtime",property = "vrtime"),
            @Result(column = "isvr",property = "isvr"),
            @Result(column = "vruid",
                    property = "user",
                    one=@One(select="com.outbreakControllerCenter.dao.IPlaceDao.queryU",
                            fetchType = FetchType.LAZY))
    })
    List<Vaccine_remind> queryAllReminds() throws Exception;
}



@Repository
public interface IUserDao {

    @Select("select * from user_table where uid = #{uid}")
    /*@Results(id="UserByUid",value = {
            @Result(id=true,column = "uid",property = "uid"),
            @Result(column = "uname",property = "uname"),
            @Result(column = "upwd",property = "upwd"),
            @Result(column = "permission",property = "permission"),
            @Result(column = "gender",property = "gender"),
            @Result(column = "area",property = "area"),
            @Result(column = "birthday",property = "birthday"),
            @Result(column = "mobile",property = "mobile"),
            @Result(column = "realid",property = "realid")
    })*/
    User queryUserByUid(String uid) throws Exception;
}

@Repository
public interface IPlaceDao {


    @Select("select * from user_table where uid = #{uid}")
    /*@Results(id="UserByUid",value = {
            @Result(id=true,column = "uid",property = "uid"),
            @Result(column = "uname",property = "uname"),
            @Result(column = "upwd",property = "upwd"),
            @Result(column = "permission",property = "permission"),
            @Result(column = "gender",property = "gender"),
            @Result(column = "area",property = "area"),
            @Result(column = "birthday",property = "birthday"),
            @Result(column = "mobile",property = "mobile"),
            @Result(column = "realid",property = "realid")
    })*/
    User queryU(String uid) throws Exception;
}



//实体类
public class User implements Serializable {
    private String uid;
    private String uname;
    private String upwd;
    private int permission;
    private int gender;
    private String area;
    private String birthday;
    private String mobile;
    private String realid;
}

public class Vaccine_remind implements Serializable {
    private int vrid;
    private String vruid;
    private String vrtime;
    private int isvr;
    private User user;
}

SSM开发过程中,使用注解开发MyBatis,需要在vaccine_remind类中多表查询,在vacdao中的@one注解内的select属性中去调用userdao中的queryUserByUid,但会在项目启动时报错,在网上查了解决方案大多都并未基于注解开发,且原因多数为xml文件中mapper标签的namespace属性的填写有误导致。在随意换了一个dao接口,方法完全复制粘贴过去,又不报错了,且满足了一开始的需求与目的。目前仍未解决此问题且并不理解导致该问题发生的原因。

对于dao层的扫描于配置文件中直接将dao包下文件一同扫描了,所以应该不会因扫描问题导致。

基于注解开发,会让代码看起来很臃肿,绝大多数都是在xml中实现sql操作,或者是使用mybatis-plus简化sql操作