Mybatis 对 Mysql 中 text 类型的特殊处理
- 昨天晚上在做 cms 的 crud 的时候遇到的问题,编辑的时候不回显内容,然后 f12 看了下响应的 json 里面 content 也为 null,然后去 service 里面把那个 pojo 加了 toString 把几条数据直接打印出来 因为用了分页然后打印出来的也并不是数据
(下次再来探究分页插件) 然后注释掉在打印发现还是没有然后我试了下单独查询,根据主键查询查出来的居然用有!!!这就很奇怪了。我当时就以为是 byexample 的 mapper 有问题 哈哈哈~~ 其实还是自己框架学的不好的问题
public EasyUIJsonResult listContent(long categoryId,int page,int rows) { |
- 然后就面向百度了一波,还真就查到了遇到跟我一样的问题 同道中人
selectByExampleWithBLOBs 用这个方法就可以了 看名字就知道更这个有关哈哈哈
然后就愉快的解决了!image - 不仅仅是 select update 也有这个方法
public interface TbContentMapper {
int countByExample(TbContentExample example);
int deleteByExample(TbContentExample example);
int deleteByPrimaryKey(Long id);
int insert(TbContent record);
int insertSelective(TbContent record);
List<TbContent> selectByExampleWithBLOBs(TbContentExample example);
List<TbContent> selectByExample(TbContentExample example);
TbContent selectByPrimaryKey(Long id);
int updateByExampleSelective(; TbContent record, TbContentExample example)
int updateByExampleWithBLOBs(; TbContent record, TbContentExample example)
int updateByExample(; TbContent record, TbContentExample example)
int updateByPrimaryKeySelective(TbContent record);
int updateByPrimaryKeyWithBLOBs(TbContent record);
int updateByPrimaryKey(TbContent record);
}