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

wordpress葡萄酒模板百度搜索排名优化

wordpress葡萄酒模板,百度搜索排名优化,公司为什么做网站,大连网站建设特色if标签与where标签 if标签 test如果为true就会拼接查询条件&#xff0c;否则不会 当没有使用Param&#xff0c;test出现arg0/param1当使用Param&#xff0c;test为Param指定的值当使用Pojo&#xff0c;test为对象的属性名 select * from car where <if test"name!n…

if标签与where标签

if标签

test如果为true就会拼接查询条件,否则不会

  • 当没有使用@Param,test出现arg0/param1
  • 当使用@Param,test为@Param指定的值
  • 当使用Pojo,test为对象的属性名
select * from car where
<if test="name!=null || name!='' ">name like concat('%',${name},'%')
</if>
<if test="price!=null || price!='' ">and price=#{price}
</if>
...

注意日期不能判断为空字符串

如何所有条件都不满足上述代码会报错

解决

如果用 where 1=1 后面判断必须加and

select * from car where 1=1
<if test="name!=null || name!='' ">and name like concat('%',${name},'%')
</if>
<if test="price!=null || price!='' ">and price=#{price}
</if>
...

where标签

  • 所有条件都为空时,where子句不会生成
  • 自动去掉前面多余的and,or
select * from car 
<where><if test="name!=null || name!='' ">name like concat('%',${name},'%')</if><if test="price!=null || price!='' ">and price=#{price}</if>
</where>
...

trim标签

  • prefix在标签前面动态的添加属性值
  • suffix在标签后面动态的添加属性值
  • suffixOverrides去除标签内容后面中指定的属性值
  • prefixOverrides去除标签内容前面中指定的属性值
select * from car 
<trim prefix="where" suffixOverrides="and | or" prefixOverrides="" suffix=""><if test="name!=null || name!='' ">name like concat('%',${name},'%')</if><if test="price!=null || price!='' ">and price=#{price}</if>
</trim>

set标签

  • 主要用在update标签中,只会提交不为空的条件
  • 可以动态去除语句中多余的,
update  car 
<set><if test="name!=null || name!='' ">name=#{name} , </if><if test="price!=null || price!='' ">price=#{price} ,</if>
</set>
where id=#{id}

choose when otherwise标签

一般在多条件中只执行某一个条件查询

用法类似与 if else if else

selecr * from car
<where><choose><when test="name!=null || name!='' ">name=#{name} </when><when test="price!=null || price!='' ">price=#{price} </when><otherwise>id=#{id} <otherwise></choose>
<where>

因为只会满足一种查询条件所有不需要加and


forEach标签

  • collection为循环列表
  • item为循环元素
  • separator为循环元素之间的分隔符
  • open为标签前面加属性值
  • close为标签后面加属性值

批量删除

delete  from car where  id in(<foreach collection="ids" item="item" separator=",">#{item}</foreach>
)delete  from car where  id in<foreach collection="ids" item="item" open="(" separator=","  close=")">#{item}</foreach>delete  from car where  <foreach collection="ids" item="item" separator="or"  >id=#{item}</foreach>

批量插入

insert into  car( name, price)
values<foreach collection="list" item="item" separator=",">(#{item.name},#{item.price})</foreach>

sql与include标签

主要用于字段的封装和复用

<sql id="CarSql">id,car_num as  carNum,brand,guide_price as guidePrice,produce_time as produceTime,car_type as carType
</sql><select id="selectAll" resultType="com.example.webapplication.pojo.Car">select<include refid="CarSql"></include>from car
</select>
http://www.fp688.cn/news/156419.html

相关文章:

  • 打鱼网站怎么做抖音搜索引擎优化
  • 服装微商城网站建设软文新闻发布平台
  • 天津平台网站建设公司windows优化大师官方网站
  • 在线客服系统接入网站seo优化技巧
  • 中英文网站是咋做的厦门seo优化
  • 织梦建网站如何自己开发一个平台
  • 武汉网站建设多少钱挖掘关键词工具
  • java做网站怎么样抖音怎么推广引流
  • 数据来源网站怎么做脚注网络营销的一般流程
  • 莱芜雪野湖鱼头seo人员的相关薪资
  • 租号网站怎么做的推广赚钱一个50元
  • 上海平台网站制作公司哪家好郑州官网关键词优化公司
  • 优秀的电商设计网站有哪些内容免费的行情网站app软件
  • 网站建设 资讯华联股份股票
  • 高明网站设计案例北京中文seo
  • 童装网站建设建站平台哪个好
  • 这样做微信网站上海企业推广
  • 政府类网站建设老铁外链工具
  • 做暧昧免费视频大全网站济南网站推广公司
  • 网站开发公司的推广费用西安seo服务外包
  • 查邮箱注册的网站网页seo优化
  • 蚌埠网站开发外包微信营销管理软件
  • 郑州网站推广服务万网登录入口
  • 酒店网站html模板靠谱的推广平台有哪些
  • 求一个全部用div做的网站深圳白帽优化
  • 织梦电影网站免费模板北京网站优化专家
  • 有没有做租赁的网站关键词优化怎么做
  • 云主机网站的空间在哪里看什么叫关键词
  • 杭州城乡建设委员会的网站网络宣传推广
  • 班级手机网站墨刀怎样做网络营销主要是什么