怎么对mapper这一层做单元测试
springboot 下配置文件在api的application.yml, mapper这一层能单元测试吗,生成了那么多东西也不知道好不好使
15
收起
正在回答 回答被采纳积分+1
2回答
慕才子
2020-02-21 11:45:25
这个生成的xml是错的,不是多次生成导致的,其他都是好的,就users和category两个不对
我也觉得生成的应该不会有问题,但是写测试接口一跑就一堆错
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xiong.dao.UsersMapper"> <resultMap id="BaseResultMap" type="com.xiong.pojo.Users"> <!-- WARNING - @mbg.generated --> <result column="USER" jdbcType="CHAR" property="user" /> <result column="CURRENT_CONNECTIONS" jdbcType="BIGINT" property="currentConnections" /> <result column="TOTAL_CONNECTIONS" jdbcType="BIGINT" property="totalConnections" /> </resultMap> <resultMap id="BaseResultMap" type="com.xiong.pojo.Users"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="BIGINT" property="id" /> <result column="username" jdbcType="VARCHAR" property="username" /> <result column="password" jdbcType="VARCHAR" property="password" /> </resultMap> <resultMap id="BaseResultMap" type="com.xiong.pojo.Users"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="VARCHAR" property="id" /> <result column="username" jdbcType="VARCHAR" property="username" /> <result column="password" jdbcType="VARCHAR" property="password" /> <result column="nickname" jdbcType="VARCHAR" property="nickname" /> <result column="realname" jdbcType="VARCHAR" property="realname" /> <result column="face" jdbcType="VARCHAR" property="face" /> <result column="mobile" jdbcType="VARCHAR" property="mobile" /> <result column="email" jdbcType="VARCHAR" property="email" /> <result column="sex" jdbcType="INTEGER" property="sex" /> <result column="birthday" jdbcType="DATE" property="birthday" /> <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" /> <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" /> </resultMap> </mapper>
coding_zhang
2020-02-21 00:51:14
没有必要做的
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星