SpringBoot中Mybatis问题收集

1.在SpringBoot中打印mybatis中执行的sql

其实在application.properties 文件下,添加一下配置即可:

logging.level.org.springframework=WARN
logging.level.org.spring.springboot.dao=DEBUG
logging.file=logs/spring-boot-logging.log

注意:其中logging.level.com.你的Mapper包=日志等级

logging.level.com.shitou.huishi.domain.dataaccess=debug

2.在mybatis中返回count这个方法的结果

 <select id="selectListByType" parameterType="com.shitou.huishi.domain.entity.BusinessMarketAffiliate" resultType="java.lang.Integer">
    select count(1) as num from tb_business_market_affiliate
    where busi_id=#{busiId,jdbcType=INTEGER}
    and data_key=#{dataKey,jdbcType=INTEGER}
    and data_type=#{dataType,jdbcType=VARCHAR}
  </select>

resultMap="java.lang.Integer" 改成 resultType="java.lang.Integer" 

https://blog.csdn.net/u010448530/article/details/52023256

猜你喜欢

转载自www.cnblogs.com/hongdada/p/9049679.html