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

网站建设用图企业qq一年多少费用

网站建设用图,企业qq一年多少费用,wordpress注意,网站建设公司net2006if标签与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.yayakq.cn/news/692171/

相关文章:

  • 网站开发系统源代码做网站阳泉
  • 台州自助建站在线咨询重庆做网站优化推广的公司
  • app推广平台网站建网站郑州
  • 外贸网站都有哪些内容莆田系医院的网站用什么做的
  • 免费做企业网站的步骤怎么建立博客网站
  • 成都网站seo国家基础设施建设网站
  • 有一个做ppt的网站网站的建设宗旨
  • 延吉网站开发公司wordpress修改语言包目录
  • pc网页游戏网站创同盟做网站好不好
  • 沈阳网站备案网站制作服务商
  • 个人网站写什么好国外网站开发发展历程
  • 建设注册管理中心网站最近最新手机中文大全10
  • 网站百度搜不到湛江网站建设的软件
  • 沈阳免费建网站找人做一下网站大概多少钱
  • 网站备案掉了重庆微信网站
  • 建设网站和别人公司重名机械行业网站怎么做
  • 网站编辑应该怎么做网站建设方案主要是
  • 徐州网站优化价格wordpress2018
  • 企业网站资料大全建设网站需要什么设备
  • 庆阳做网站公司邮箱登陆嵌入网站
  • 茂港手机网站建设公司京东网站建设目标
  • 商品数据包网站开发怎么下载网站程序
  • 徐州网站制作报价北京网站制作公司兴田德润实力强
  • 建个营销型网站多少钱手机建个人网站
  • 深圳做app网站设计邯郸一站式网络推广欢迎咨询
  • 昆明做网站公司哪家好重庆官网seo技术厂家
  • 个人网站如何备企业erp定制软件开发公司推荐
  • 网站有二级域名做竞价怎么做盗版网站赚钱
  • 网站自己可以做么中信建设有限责任公司陈晓佳简历
  • 制作企业网站页面html百度2020新版下载