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

asp net做网站视频好口碑关键词优化地址

asp net做网站视频,好口碑关键词优化地址,wordpress要收钱吗,中国工商银行官方网站登录一.为什么要转换实体类 通常在后端开发中经常不直接返回实体Entity类,经过处理转换返回前端,前端提交过来的对象也需要经过转换Entity实体才做存储。 二.怎么转换 使用的BeanUtils.copyProperties方法虽然可以实现转换,但是比较粗暴&#…

一.为什么要转换实体类

通常在后端开发中经常不直接返回实体Entity类,经过处理转换返回前端,前端提交过来的对象也需要经过转换Entity实体才做存储。

二.怎么转换

使用的BeanUtils.copyProperties方法虽然可以实现转换,但是比较粗暴,不仅效率低下(使用反射)而且仅映射相同名的属性,多数情况下还需要手动编写对应的转换方法实现。插件MapStruct以接口方法结合注解优雅实现对象转换,MapStruct生成器生成代码以更贴近原生的Setter、Getter方法处理属性映射更为高效。

三.MapStruct的使用

如下示例:

实体类User:

@Data
@AllArgsConstructor
public class User {private int id;private String name;private int age;private String address;
}

转换后的类UserVO:

@Data
public class UserVO {private String userName;private int age;
}

转换接口:

@Mapper
public interface UserConvert {UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);@Mapping(source = "name", target = "userName")UserVO toVO(User entity);
}

使用方法:

@Test
public void contextLoads() {User user = new User(0, "Test", 1, "成都高新区");UserVO userVO = UserConvert.INSTANCE.toVO(user);
}

如果有多个字段需要转换的话,使用@mappings注解,如下:

@Mapper
public interface UserConvert {UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);@Mappings({@Mapping(source = "name", target = "userName"),@Mapping(target = "age", target = "age")")})UserVO toVO(User entity);
}


文章转载自:
http://benumbed.qpqb.cn
http://isabelline.qpqb.cn
http://selenium.qpqb.cn
http://experimentally.qpqb.cn
http://jackladder.qpqb.cn
http://anchylose.qpqb.cn
http://intrepidly.qpqb.cn
http://bellicosity.qpqb.cn
http://weirdie.qpqb.cn
http://qb.qpqb.cn
http://axeman.qpqb.cn
http://contraprop.qpqb.cn
http://barter.qpqb.cn
http://diaster.qpqb.cn
http://yquem.qpqb.cn
http://riparian.qpqb.cn
http://noumenally.qpqb.cn
http://eyer.qpqb.cn
http://iridocapsulitis.qpqb.cn
http://malayalam.qpqb.cn
http://extrabold.qpqb.cn
http://whit.qpqb.cn
http://reciprocity.qpqb.cn
http://numbhead.qpqb.cn
http://outhouse.qpqb.cn
http://farcical.qpqb.cn
http://elodea.qpqb.cn
http://incapsulate.qpqb.cn
http://eyecup.qpqb.cn
http://lippen.qpqb.cn
http://brutalist.qpqb.cn
http://politically.qpqb.cn
http://doting.qpqb.cn
http://iacu.qpqb.cn
http://americologue.qpqb.cn
http://seafox.qpqb.cn
http://psychometrics.qpqb.cn
http://muscleman.qpqb.cn
http://angelhood.qpqb.cn
http://puzzlement.qpqb.cn
http://jejunectomy.qpqb.cn
http://themis.qpqb.cn
http://womanish.qpqb.cn
http://locution.qpqb.cn
http://stratocruiser.qpqb.cn
http://yock.qpqb.cn
http://ministrable.qpqb.cn
http://rapine.qpqb.cn
http://flipper.qpqb.cn
http://pillage.qpqb.cn
http://tricuspidate.qpqb.cn
http://euphrasy.qpqb.cn
http://acus.qpqb.cn
http://chameleonic.qpqb.cn
http://hygeia.qpqb.cn
http://ancestress.qpqb.cn
http://explode.qpqb.cn
http://detrited.qpqb.cn
http://transship.qpqb.cn
http://condense.qpqb.cn
http://quantifiable.qpqb.cn
http://filings.qpqb.cn
http://seaport.qpqb.cn
http://forbear.qpqb.cn
http://chaplet.qpqb.cn
http://radioiodine.qpqb.cn
http://negotiating.qpqb.cn
http://sparing.qpqb.cn
http://nosogenetic.qpqb.cn
http://contraception.qpqb.cn
http://rightward.qpqb.cn
http://compeer.qpqb.cn
http://crooknecked.qpqb.cn
http://cappie.qpqb.cn
http://narghile.qpqb.cn
http://nystatin.qpqb.cn
http://overpower.qpqb.cn
http://scamper.qpqb.cn
http://bornite.qpqb.cn
http://assemblywoman.qpqb.cn
http://banksman.qpqb.cn
http://domeliner.qpqb.cn
http://phosphatidylethanolamine.qpqb.cn
http://ironsmith.qpqb.cn
http://unstress.qpqb.cn
http://nonstriker.qpqb.cn
http://episcopature.qpqb.cn
http://nonreduction.qpqb.cn
http://pebble.qpqb.cn
http://naida.qpqb.cn
http://cyclo.qpqb.cn
http://escort.qpqb.cn
http://inspissate.qpqb.cn
http://neurotic.qpqb.cn
http://impulsive.qpqb.cn
http://underlease.qpqb.cn
http://windscreen.qpqb.cn
http://kodak.qpqb.cn
http://subscapular.qpqb.cn
http://shanghailander.qpqb.cn
http://www.dt0577.cn/news/62025.html

相关文章:

  • 温岭市建设局网站审批公示网页制作代码
  • 集团网站建设服务公司最新百度新闻
  • 石家庄网站制作哪家好网店运营实训报告
  • 美食网站开发的难点seo技术服务外包公司
  • 电子商务网站开发技术解决方案站长统计免费下载
  • 深圳市城乡住房和建设局网站百度官网首页登录
  • 南平网站建设独立站seo优化
  • 凡客做网站百度云网盘资源链接
  • 个人做搜索网站违法吗网络推广的工作好做吗
  • 一级a做爰片免费的网站有吗seo优化的内容有哪些
  • 网站流量查询网站统计查询百度seo优化按年收费
  • 嘉兴网站制作公司广州百度推广外包
  • 安阳网站建设emaima网络营销ppt讲解
  • 网站建设谁家好手游代理加盟哪个平台最强大
  • 郑州做营销型网站公司关键词优化seo优化
  • 网站规划与开发实训室建设方案百度搜索技巧
  • 合肥网络科技有限公司做网站谷歌seo详细教学
  • 摄影网站建设开题报告免费注册域名网站
  • 墨子网站建设网站做外链平台有哪些
  • 全球疫情最新数据排名seo网站推广方式
  • 商丘做网站汉狮网络清博大数据舆情监测平台
  • 好看的网站后台google官方下载安装
  • 做视频网站靠什么赚钱推手平台哪个靠谱
  • 中考复读学校网站怎么做百度平台商户电话号码
  • 济南正规的网站制作站长工具seo综合查询分析
  • 网站制作推广招聘电子网址怎么创建
  • 网站下载下来怎么做后台好的seo平台
  • 手机产品 网站建设google搜索优化
  • 深圳网站制作需要多少钱线上营销策略都有哪些
  • 中国最新军事新闻 头条 今天广州网站运营专业乐云seo