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

毕业论文网站开发线上营销活动有哪些

毕业论文网站开发,线上营销活动有哪些,表白网,yum nginx wordpress今天要有个功能,要进行一批数据的插入和修改,为了不频繁调用数据库,所以想到了批量插入和修改,因为从毕业后,就没写过批量插入和批量修改,所以在这里记录一下,避免后续再遇到忘记怎么写了 批量…

今天要有个功能,要进行一批数据的插入和修改,为了不频繁调用数据库,所以想到了批量插入和修改,因为从毕业后,就没写过批量插入和批量修改,所以在这里记录一下,避免后续再遇到忘记怎么写了

批量插入(传入的参数是List<实体>list):

<insert id="insertList" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="java.util.List">insert into xhs_collection_data (note_id,`status`,title,`desc`,`time`,user_id,nickname,liked_count,collected_count,comment_count,share_count,image_list,tag_list,batch_number,file_name) values<foreach collection="list" separator="," item="item">( #{item.noteId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},#{item.title,jdbcType=VARCHAR},#{item.desc,jdbcType=VARCHAR},#{item.time,jdbcType=TIMESTAMP},#{item.userId,jdbcType=VARCHAR}, #{item.nickname,jdbcType=VARCHAR},#{item.likedCount,jdbcType=VARCHAR},#{item.collectedCount,jdbcType=VARCHAR},#{item.commentCount,jdbcType=TIMESTAMP},#{item.shareCount,jdbcType=VARCHAR},#{item.imageList,jdbcType=VARCHAR},#{item.tagList,jdbcType=VARCHAR},#{item.batchNumber,jdbcType=BIGINT},#{item.fileName,jdbcType=VARCHAR})</foreach>
</insert>



批量修改(传入的参数是List<实体>list):

sql原理语句:update table set 要修改的表字段A = case when 表字段 = 实体数据字段 then 实体数据字段 when 表字段 = 实体数据字段 then 实体数据字段 when … then… end,
要修改的表字段B = case when 表字段 = 实体数据字段 then 实体数据字段 when 表字段 = 实体数据字段 then 实体数据字段 when … then… end where 条件

注意:这里踩过一个坑,因为当时不会写批量修改的语句,所以让文心一言帮忙生成了一个批量修改的sql,后续我忘记是不是手动给<foreach>标签手动加的<separator=“,”>这个属性,结果报错了,排查了半天这个sql哪里错了,最后还是放到数据库执行了一下看到了错误原因,当时我还让温馨一样帮忙检查了下我修改后的sql,结果还说没sql没问题,只是可能在拼接时报错

<update id="updateList" parameterType="java.util.List">update xhs_collection_data<trim prefix="set" suffixOverrides=","><trim prefix="`status` = case" suffix="end,"><foreach collection="list" index="index" item="item" >when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.status,jdbcType=INTEGER}</foreach></trim><trim prefix="title = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.title,jdbcType=VARCHAR}</foreach></trim><trim prefix="`desc` = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.desc,jdbcType=VARCHAR}</foreach></trim><trim prefix="time = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.time,jdbcType=TIMESTAMP}</foreach></trim><trim prefix="user_id = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.userId,jdbcType=VARCHAR}</foreach></trim><trim prefix="nickname = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.nickname,jdbcType=VARCHAR}</foreach></trim><trim prefix="liked_count = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.likedCount,jdbcType=VARCHAR}</foreach></trim><trim prefix="collected_count = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.collectedCount,jdbcType=VARCHAR}</foreach></trim><trim prefix="comment_count = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.commentCount,jdbcType=VARCHAR}</foreach></trim><trim prefix="share_count = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.shareCount,jdbcType=VARCHAR}</foreach></trim><trim prefix="image_list = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.imageList,jdbcType=VARCHAR}</foreach></trim><trim prefix="tag_list = case" suffix="end,"><foreach collection="list" index="index" item="item">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.tagList,jdbcType=VARCHAR}</foreach></trim><trim prefix="batch_number = case" suffix="end,"><foreach collection="list" index="index" item="item"><if test="item.batchNumber != null">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.batchNumber,jdbcType=BIGINT}</if></foreach></trim><trim prefix="file_name = case" suffix="end,"><foreach collection="list" index="index" item="item"><if test="item.fileName != null">when note_id = #{item.noteId,jdbcType=VARCHAR} then #{item.fileName,jdbcType=VARCHAR}</if></foreach></trim></trim>where note_id in<foreach close=")" collection="list" item="item" open="(" separator=", ">#{item.noteId,jdbcType=VARCHAR}</foreach>
</update>
http://www.tj-hxxt.cn/news/104576.html

相关文章:

  • b2b电子商务平台网站有哪些企业域名查询
  • 昆明网站建设优化技术百度爱采购服务商查询
  • 广西网站制作seo网络营销推广
  • 撤销网站备案表填写后苏州网站建设哪家靠谱
  • 做交友网站广州seo服务外包
  • wordpress前台发表文章seocui cn
  • 淘宝搜券的网站怎么做关键词生成器
  • 哪些做展架图的网站好电商平台建设方案
  • 经常会更换网站域名请收藏个人永久免费自助建站
  • 微商建立网站深圳网络营销推广外包
  • 做网站和做软件一样吗济南做网站比较好的公司
  • 网站管理系统设置发布广告的平台免费
  • wordpress上传图片自动压缩专业seo服务商
  • 中国建设银行网上银行网站特点杭州seo百度关键词排名推广
  • 中国人も日本人も汉字を河源网站seo
  • 个人网站网页模板百度seo sem
  • 如何做响应式网站深圳网站建设推广优化公司
  • dw做的网站成品无线网络优化工程师
  • 华为300mbps无线扩展器设置网站seo双标题软件
  • 仿做购物网站游戏推广员平台
  • wordpress 添加样式表肇庆seo外包公司
  • 建筑设计专业比较好的学校镇江优化推广
  • 海尔电商网站建设方案东莞关键字排名优化
  • 网站突然打不开是什么原因百度广告一级代理
  • 腾讯低代码开发平台seo成创网络
  • 上海市建设工程设计文件审查管理事务中心网站成都网站seo服务
  • 如何进入网站后台管理网站电脑系统优化软件十大排名
  • 拍卖网站建设公司河北网站seo策划
  • 拿自己爱人做网站太原seo推广
  • 网站上的在线答题是怎么做的太仓网站制作