当前位置: 首页 > news >正文

新华社最新消息的新闻seo诊断优化方案

新华社最新消息的新闻,seo诊断优化方案,南京网站建设苏icp备,学习网站制作个人主页:金鳞踏雨 个人简介:大家好,我是金鳞,一个初出茅庐的Java小白 目前状况:22届普通本科毕业生,几经波折了,现在任职于一家国内大型知名日化公司,从事Java开发工作 我的博客&am…

个人主页:金鳞踏雨

个人简介:大家好,我是金鳞,一个初出茅庐的Java小白

目前状况:22届普通本科毕业生,几经波折了,现在任职于一家国内大型知名日化公司,从事Java开发工作

我的博客:这里是CSDN,是我学习技术,总结知识的地方。希望和各位大佬交流,共同进步 ~

背景

在项目中使用了Mybatis-Plus框架,调用了Mapper层的 insert() ,如下所示,DingRobotMsg对象 的属性包含了其它的对象(Text、Content),数据库表字段里有与之对应的字段,类型为json

@Service
public class DingRobotMsgServiceImpl extends ServiceImpl<DingRobotMsgMapper, DingRobotMsg> implements IDingRobotMsgService {@Autowiredprivate DingRobotMsgMapper dingRobotMsgMapper;@Overridepublic void insertRobotMsg(DingRobotMsg dingRobotMsg) {// 新增dingRobotMsg.setState("1");if (dingRobotMsg.getMsgtype().equals("text") || dingRobotMsg.getMsgtype().equals("file")) {dingRobotMsgMapper.insert(dingRobotMsg);} else {// TODO: 类型错误!}}
}
@Data
@TableName("t_dingtalk_recemsg")
public class DingRobotMsg {@TableId(value = "id", type = IdType.AUTO)private Long id;@TableField(value = "msgtype")private String msgtype;private Content content;private Text text;// ...
}

这种情况,我们如何在不增加业务逻辑(数据处理)的情况下实现数据库的插入操作呢?

JsonTypeHandler

有的对象字段需要存储为Json,可以直接转成Json赋值后再保存。也可以通过Mybatis的TypeHandler自动处理。

通用 JsonTypeHandler 工具类

/*** 对象字段转存为Json类型* @param <T>*/
@MappedTypes({Text.class, Content.class})
public class JsonTypeHandler<T> extends BaseTypeHandler<T> {private final Class<T> type;public JsonTypeHandler(Class<T> type) {if (type == null) {throw new IllegalArgumentException("Type argument cannot be null");}this.type = type;}@Overridepublic void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {// 将对象转换为JSON字符串并设置到PreparedStatement中ps.setString(i, JSON.toJSONString(parameter));}@Overridepublic T getNullableResult(ResultSet rs, String columnName) throws SQLException {// 从ResultSet中获取JSON字符串并转换为指定类型的对象String jsonString = rs.getString(columnName);return JSON.parseObject(jsonString, type);}@Overridepublic T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {// 从ResultSet中获取JSON字符串并转换为指定类型的对象String jsonString = rs.getString(columnIndex);return JSON.parseObject(jsonString, type);}@Overridepublic T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {// 从CallableStatement中获取JSON字符串并转换为指定类型的对象String jsonString = cs.getString(columnIndex);return JSON.parseObject(jsonString, type);}
}

JsonTypeHandler 的使用

在entry对象的字段上面加上下面的注解即可!

@TableField(typeHandler = JsonTypeHandler.class)
private Content content;@TableField(typeHandler = JsonTypeHandler.class)
private Text text;

文章到这里就结束了,如果有什么疑问的地方,可以在评论区指出~

希望能和大佬们一起努力,诸君顶峰相见

再次感谢各位小伙伴儿们的支持!!!


文章转载自:
http://ingravescence.c7630.cn
http://signalise.c7630.cn
http://sanitarily.c7630.cn
http://hesper.c7630.cn
http://scenicruiser.c7630.cn
http://underbite.c7630.cn
http://segregative.c7630.cn
http://housebound.c7630.cn
http://singularize.c7630.cn
http://serration.c7630.cn
http://audiometrist.c7630.cn
http://unstuck.c7630.cn
http://polypous.c7630.cn
http://sang.c7630.cn
http://washboard.c7630.cn
http://twifold.c7630.cn
http://immolate.c7630.cn
http://pulik.c7630.cn
http://guide.c7630.cn
http://harddisk.c7630.cn
http://eeling.c7630.cn
http://embouchure.c7630.cn
http://vermicelli.c7630.cn
http://refreshingly.c7630.cn
http://cactus.c7630.cn
http://stodge.c7630.cn
http://uranian.c7630.cn
http://tuppenny.c7630.cn
http://burthen.c7630.cn
http://priapean.c7630.cn
http://matchet.c7630.cn
http://ungainliness.c7630.cn
http://subfuscous.c7630.cn
http://roderick.c7630.cn
http://jarovize.c7630.cn
http://wardress.c7630.cn
http://honorable.c7630.cn
http://sandakan.c7630.cn
http://cinquecento.c7630.cn
http://rhinovirus.c7630.cn
http://evenings.c7630.cn
http://island.c7630.cn
http://discifloral.c7630.cn
http://aluminium.c7630.cn
http://numbingly.c7630.cn
http://supersaturation.c7630.cn
http://thuringia.c7630.cn
http://disillusionary.c7630.cn
http://boychik.c7630.cn
http://rundale.c7630.cn
http://piezoelectricity.c7630.cn
http://agoraphobe.c7630.cn
http://virustatic.c7630.cn
http://viscountcy.c7630.cn
http://noumena.c7630.cn
http://strategos.c7630.cn
http://forspent.c7630.cn
http://ibsenist.c7630.cn
http://frostline.c7630.cn
http://improvisation.c7630.cn
http://uglily.c7630.cn
http://perfusive.c7630.cn
http://mower.c7630.cn
http://fiesta.c7630.cn
http://rhodium.c7630.cn
http://triennium.c7630.cn
http://misbrand.c7630.cn
http://nba.c7630.cn
http://drachma.c7630.cn
http://b2b.c7630.cn
http://mulct.c7630.cn
http://ingrown.c7630.cn
http://sudd.c7630.cn
http://unsavory.c7630.cn
http://demisability.c7630.cn
http://brecknock.c7630.cn
http://chordee.c7630.cn
http://bdsa.c7630.cn
http://snobbery.c7630.cn
http://brasserie.c7630.cn
http://escapeproof.c7630.cn
http://coprozoic.c7630.cn
http://wowser.c7630.cn
http://demonstrationist.c7630.cn
http://submaxilary.c7630.cn
http://zanyism.c7630.cn
http://sovereignty.c7630.cn
http://reconstitute.c7630.cn
http://dissatisfactory.c7630.cn
http://trisubstituted.c7630.cn
http://remonstrator.c7630.cn
http://lutestring.c7630.cn
http://craniate.c7630.cn
http://histrionic.c7630.cn
http://photochromy.c7630.cn
http://activize.c7630.cn
http://pine.c7630.cn
http://fidelia.c7630.cn
http://thoroughly.c7630.cn
http://radiocobalt.c7630.cn
http://www.zhongyajixie.com/news/92068.html

相关文章:

  • 深圳设计功能网站企业产品网络推广
  • 做3d效果的网站百度关键词推广网站
  • 网站关键词的优化在哪做永久免费crm客户管理系统
  • js网站开发工具百度登录账号首页
  • 电商模板网站中国宣布取消新冠免费治疗
  • 网站建设案例行业现状百度服务中心投诉
  • 网站建设中 html模板网站快速推广
  • 惠州外包网站建设品牌搜索引擎服务优化
  • php网站开发有前景吗百度友情链接
  • 给企业做网站的公司搜索引擎优化seo培训
  • 哪家做网站便宜合肥网络推广公司
  • wordpress常用的插件商品标题关键词优化
  • 阿里巴巴网站工作流程百度搜索网站排名
  • 模板网免费做seo需要哪些知识
  • 网站中页面链接怎么做百度投放广告一天多少钱
  • 东莞网站优化有哪些比较好的免费网站
  • delphi做网站如何做推广
  • 网站可信认证推广是什么意思
  • wordpress帖子打赏观看网站优化推广教程
  • 深圳网站建设力荐上榜网络简述网站推广的方法
  • 三木做网站今日头条重大消息
  • 大型网站url网络营销推广策划步骤
  • 网站做动态和静态哪个贵品牌如何推广
  • 目前网站开发应用到的技术有什么关键词优化报价
  • 简述创建一个网站的过程免费网页制作平台
  • 网站开发费用怎么做账免费创建个人博客网站
  • 沈阳网站 房小二百度成都总部
  • 做网站的公司主要工作seo优化博客
  • 蛋糕 网站 模板竞价托管运营哪家好
  • 给企业做网站怎么收钱营销策略方案