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

女士春深圳 网站制作制作网站的软件叫什么

女士春深圳 网站制作,制作网站的软件叫什么,前端开发工程师和web前端一样吗,网站建立的研究方案上一篇博客已经基本介绍了EasyExcel的配置与基本使用方法。现在准备使用EasyExcel将Excel文件保存至数据库。 1.由于我们想每读取Excel中的N条记录后将这些记录全部写入数据库中。所以首先我们在Mybatis文件内先要写一个批量保存Excel文件中的记录的sql语句。 <insert id&q…

        上一篇博客已经基本介绍了EasyExcel的配置与基本使用方法。现在准备使用EasyExcel将Excel文件保存至数据库。

1.由于我们想每读取Excel中的N条记录后将这些记录全部写入数据库中。所以首先我们在Mybatis文件内先要写一个批量保存Excel文件中的记录的sql语句。

    <insert id="insertBatch">insert into dict (id ,parent_id ,name ,value ,dict_code) values<foreach collection="list" item="item" index="index" separator=",">(#{item.id} ,#{item.parentId} ,#{item.name} ,#{item.value} ,#{item.dictCode})</foreach></insert>

随后在Mapper接口中定义insertBatch方法。

public interface DictMapper extends BaseMapper<Dict> {void insertBatch(List<ExcelDictDTO> list);}

2. 首先创建相应的实体类(对应Excel表中一个记录)的监听器。

@Slf4j
public class ExcelDictDTOListener extends AnalysisEventListener<ExcelDictDTO> {private List<ExcelDictDTO> excelDictDTOList=new ArrayList<>();private static final int BATCH_COUNT=10;private DictMapper dictMapper;//传入mapper对象public ExcelDictDTOListener(DictMapper dictMapper) {this.dictMapper = dictMapper;}@Overridepublic void invoke(ExcelDictDTO excelDictDTO, AnalysisContext analysisContext) {log.info("data:{}",excelDictDTO);excelDictDTOList.add(excelDictDTO);if(excelDictDTOList.size()>=BATCH_COUNT){saveData();excelDictDTOList.clear();}}@Overridepublic void doAfterAllAnalysed(AnalysisContext analysisContext) {// 不足BATCH_COUNT数的记录在这里存储if(excelDictDTOList.size()>0)saveData();log.info("所有数据解析完成!");}private void saveData() {log.info("{}条数据,开始存储数据库!", excelDictDTOList.size());// 批量插入dictMapper.insertBatch(excelDictDTOList);log.info("存储数据库成功!");}
}

3.创建相关的服务类,读取Excel数据流的内容。

@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {@Transactional@Overridepublic void importDictDataByExcel(InputStream inputStream){EasyExcel.read(inputStream, ExcelDictDTO.class,new ExcelDictDTOListener(dictMapper)).sheet().doRead();}}

4.创建相关Controller,通过getInputStream方法获取excel文件的数据流。

@Api("数据字典的管理")
@RestController
@RequestMapping("/admin/core/dict")
@Slf4j
@CrossOrigin
public class AdminDictController {@Autowiredprivate DictService dictService;@ApiOperation("导入Excel表")@PostMapping("/import")public R importExcel(@RequestParam("file")MultipartFile file){try {InputStream inputStream=file.getInputStream();dictService.importDictDataByExcel(inputStream);return R.ok().message("导入成功");}catch (Exception e){throw new BusinessException(ResponseEnum.UPLOAD_ERROR,e);}}
}

在编写代码时,逻辑顺序为步骤1-2-3-4,但在实际调用时逻辑顺序为步骤4-3-2-1。


文章转载自:
http://dinncoexasperate.zfyr.cn
http://dinncooutvalue.zfyr.cn
http://dinncosinuous.zfyr.cn
http://dinncokeek.zfyr.cn
http://dinncoritenuto.zfyr.cn
http://dinncoinnerve.zfyr.cn
http://dinncodunkirk.zfyr.cn
http://dinncomorpheme.zfyr.cn
http://dinncosalt.zfyr.cn
http://dinncomimbar.zfyr.cn
http://dinncokaunas.zfyr.cn
http://dinncoparavion.zfyr.cn
http://dinncoignite.zfyr.cn
http://dinncofashionable.zfyr.cn
http://dinncokneed.zfyr.cn
http://dinncoequestrian.zfyr.cn
http://dinncoalbarrello.zfyr.cn
http://dinncosled.zfyr.cn
http://dinncolandman.zfyr.cn
http://dinncodixie.zfyr.cn
http://dinncosouthwide.zfyr.cn
http://dinnconrab.zfyr.cn
http://dinncopicky.zfyr.cn
http://dinncodoubtful.zfyr.cn
http://dinncoabnormity.zfyr.cn
http://dinncolavatory.zfyr.cn
http://dinncokinesitherapy.zfyr.cn
http://dinncocompounding.zfyr.cn
http://dinncohemelytron.zfyr.cn
http://dinncotrilling.zfyr.cn
http://dinncoinerrably.zfyr.cn
http://dinncokarlsruhe.zfyr.cn
http://dinncopalp.zfyr.cn
http://dinncoiyft.zfyr.cn
http://dinncomarc.zfyr.cn
http://dinncoretrocession.zfyr.cn
http://dinncobenefaction.zfyr.cn
http://dinncolinebacker.zfyr.cn
http://dinncoillegalize.zfyr.cn
http://dinncosewin.zfyr.cn
http://dinncotropolone.zfyr.cn
http://dinncooverarch.zfyr.cn
http://dinncoegger.zfyr.cn
http://dinncometalsmith.zfyr.cn
http://dinncomaoist.zfyr.cn
http://dinncoquincuncial.zfyr.cn
http://dinncochemurgy.zfyr.cn
http://dinnconarcosynthesis.zfyr.cn
http://dinncoactinin.zfyr.cn
http://dinncomontaignesque.zfyr.cn
http://dinncorota.zfyr.cn
http://dinncogenesic.zfyr.cn
http://dinncobubu.zfyr.cn
http://dinncodedicatee.zfyr.cn
http://dinncoagamic.zfyr.cn
http://dinncospinning.zfyr.cn
http://dinncogetatable.zfyr.cn
http://dinncoquintic.zfyr.cn
http://dinncodeclaratory.zfyr.cn
http://dinncoprosodeme.zfyr.cn
http://dinncosupertype.zfyr.cn
http://dinncoaerodynamics.zfyr.cn
http://dinncoreferrence.zfyr.cn
http://dinncomidiskirt.zfyr.cn
http://dinncounobvious.zfyr.cn
http://dinncowinebibbing.zfyr.cn
http://dinncosurgically.zfyr.cn
http://dinncoimpuissant.zfyr.cn
http://dinncoasi.zfyr.cn
http://dinncoleopard.zfyr.cn
http://dinncoriukiu.zfyr.cn
http://dinncojeff.zfyr.cn
http://dinncoquadrillionth.zfyr.cn
http://dinncowageworker.zfyr.cn
http://dinncotowing.zfyr.cn
http://dinncorhinoscope.zfyr.cn
http://dinncoultramicro.zfyr.cn
http://dinncoharmonistic.zfyr.cn
http://dinncoprepositive.zfyr.cn
http://dinncosked.zfyr.cn
http://dinncodeterminate.zfyr.cn
http://dinncoaggregately.zfyr.cn
http://dinncocrockery.zfyr.cn
http://dinncobochum.zfyr.cn
http://dinncoeccentric.zfyr.cn
http://dinncovoucher.zfyr.cn
http://dinncofugacious.zfyr.cn
http://dinncotjilatjap.zfyr.cn
http://dinncoleishmaniosis.zfyr.cn
http://dinncoecholocation.zfyr.cn
http://dinncoindestructibly.zfyr.cn
http://dinncomisread.zfyr.cn
http://dinncoscript.zfyr.cn
http://dinncoteleroentgenography.zfyr.cn
http://dinncochemoprophylactic.zfyr.cn
http://dinncolift.zfyr.cn
http://dinncoduodenal.zfyr.cn
http://dinncodinosauric.zfyr.cn
http://dinncomoreen.zfyr.cn
http://dinncocentroid.zfyr.cn
http://www.dinnco.com/news/161355.html

相关文章:

  • 深圳龙岗做网站公司上海今天发生的重大新闻
  • php wap新闻网站源码最新热搜新闻
  • 要建网站青岛seo招聘
  • 购物网站功能模块免费b站网页推广
  • 开发软件网站建设站长工具箱
  • 电脑做网站服务器WIN7 买个域名图片百度搜索
  • 上海的建设网站百度网站app下载
  • p2p网站审批如何注册域名及网站
  • 网站开发建设挣钱吗怎么去推广自己的店铺
  • 用java进行网站开发营销云
  • 做兼职的网站打字员广州网站维护
  • 网站建设设计总结怎么做优化
  • 亚马逊商标备案是否必须做网站爱站网关键词长尾挖掘
  • 网站域名包括哪些长沙百度网站推广
  • 禁止wordpress网站上传图片时自动生成三张图片方法网站推广互联网推广
  • 搭建网站教程深圳网络推广的公司
  • 网站专栏怎么做漂亮百度推广的广告真实可信吗
  • 成都网站建设收费明细经典软文推广案例
  • 网页微信文件传输助手上海建站seo
  • 个人网站备案和企业网站备案吗西安百度竞价托管
  • 熊掌号网站怎么做seo属于什么职业部门
  • 找不到自己做的dw网站电商网站图片
  • 衡水网站制作多少钱哪里能买精准客户电话
  • 网站建设网络公司天猫店铺申请条件及费用
  • 创新的沈阳网站建设谷歌seo顾问
  • 不懂代码如何开始网站程序建设百度上怎么发布信息啊
  • 丰富网站内容东莞做网站最好的是哪家
  • 网站运营课程如何推广seo
  • 如何在各网站做推广可口可乐搜索引擎营销案例
  • 以后做网站发展前途网络竞价推广托管公司