混合调用tk.mybatis.mapper 与 自编xml文件 的配置

本项目采用的是 Spring+Mybatis 的架构。

1. 在项目中引入如下jar.

  mybatis.jar     mapper-4.1.2.jar

2. 在写 Dao 类时需要添加 如下注解。

import com.i7colors.bean.customer.CustomerBill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 客户账户信息DAO
 * @author 
 *
 */
@Mapper
@Component
public interface CustomerBillDao extends tk.mybatis.mapper.common.Mapper<CustomerBill>, tk.mybatis.mapper.common.MySqlMapper<CustomerBill> {

    List<CustomerBill> queryList(@Param("customerBill") CustomerBill customerBill, @Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);

    int count(CustomerBill customerBill);
}

  

3. 编写xml 后注意在 mybatis 的配置文件中引入此xml。

猜你喜欢

转载自www.cnblogs.com/mobaids/p/10861100.html