1、mybatis对应的实体类要有一个无参数的构造函数否则会报如下错误.
Error instantiating class com.xx.QueryUserResp with invalid types (DUser) or values (6). Cause: java.lang.IllegalArgumentException: argument type mismatch
2、注解
- myBatis中mapper对应的dao要有@Mapper注解,如果该dao在idea中有红线,再增加@Repostory注解。
- Service的实现类要有@Service注解。此时默认的service 名称为该serive的首字母小写类名。
- 当一个接口有两个实现类时,如何调用呢
@Resource(name="imgDataDao")
private DataDao xx;
或者:
@Autowired
@Qualifier("imgDataDao")
private DataDao yy;
- @Bean注解的作用
- @Param("classifyIds")
List<Goods> queryListByClassifyIds(@Param("classifyIds") List<Integer> classifyIds);
<select id="queryListByClassifyIds" resultMap="baseResultMap" parameterType="com.xx.sku.goods.entity.Goods">
select
<include refid="baseColumnList"/>
from d_goods
where cid in
<foreach collection="classifyIds" item="cid" index="index" open="(" close=")" separator=",">
#{cid}
</foreach>
</select>
3、工具类
Date date = new Date();
System.out.println(DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss"));
- BeanUtils
- MessageFormat \ String.format
4、框架
5、 SpringBoot-行锁 百度学习下
6、redis缓存击穿