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

济南网站建设泉诺windows优化大师怎么卸载

济南网站建设泉诺,windows优化大师怎么卸载,山东济南网站建设公司哪家好,美国网站开发公司9、动态SQL Mybatis框架的动态SQL技术是一种根据特定条件动态拼装SQL语句的功能,它存在的意义是为了解决拼接SQL语句字符串时的痛点问题。 9.1、if if标签可通过test属性的表达式进行判断,若表达式的结果为true,则标签中的内容会执行&…

9、动态SQL

Mybatis框架的动态SQL技术是一种根据特定条件动态拼装SQL语句的功能,它存在的意义是为了解决拼接SQL语句字符串时的痛点问题。

9.1、if

if标签可通过test属性的表达式进行判断,若表达式的结果为true,则标签中的内容会执行;反之标签中的内容不会执行

<!--List<Emp> getEmpListByCondition(Emp emp);-->
<select id="getEmpListByMoreTJ" resultType="Emp">select * from t_emp where 1=1<if test="ename != '' and ename != null">and ename = #{ename}</if><if test="age != '' and age != null">and age = #{age}</if><if test="sex != '' and sex != null">and sex = #{sex}</if>
</select>

9.2、where

where和if一般结合使用:

  1. 若where标签中的if条件都不满足,则where标签没有任何功能,即不会添加where关键字
  2. 若where标签中的if条件满足,则where标签会自动添加where关键字,并将条件最前方多余的and去掉

注意:where标签不能去掉条件最后多余的and

<select id="getEmpListByMoreTJ2" resultType="Emp">select * from t_emp<where><if test="ename != '' and ename != null">ename = #{ename}</if><if test="age != '' and age != null">and age = #{age}</if><if test="sex != '' and sex != null">and sex = #{sex}</if></where>
</select>

9.3、trim

trim用于去掉或添加标签中的内容

常用属性:

prefix:在trim标签中的内容的前面添加某些内容

prefixOverrides:在trim标签中的内容的前面去掉某些内容

suffix:在trim标签中的内容的后面添加某些内容

suffixOverrides:在trim标签中的内容的后面去掉某些内容

<select id="getEmpListByMoreTJ" resultType="Emp">select * from t_emp<trim prefix="where" suffixOverrides="and"><if test="ename != '' and ename != null">ename = #{ename} and</if><if test="age != '' and age != null">age = #{age} and</if><if test="sex != '' and sex != null">sex = #{sex}</if></trim>
</select>

更多关于trim标签的资料可以参考: https://www.cnblogs.com/zhihongming/p/15627939.html

9.4、choose、when、otherwise

choose、when、 otherwise相当于if…else if…else

<!--List<Emp> getEmpListByChoose(Emp emp);-->
<select id="getEmpListByChoose" resultType="Emp">select <include refid="empColumns"></include> from t_emp<where><choose><when test="ename != '' and ename != null">ename = #{ename}</when><when test="age != '' and age != null">age = #{age}</when><when test="sex != '' and sex != null">sex = #{sex}</when><when test="email != '' and email != null">email = #{email}</when></choose></where>
</select>

9.5、foreach

<!--int insertMoreEmp(List<Emp> emps);-->
<insert id="insertMoreEmp">insert into t_emp values<foreach collection="emps" item="emp" separator=",">(null,#{emp.ename},#{emp.age},#{emp.sex},#{emp.email},null)</foreach>
</insert><!--int deleteMoreByArray(int[] eids);-->
<delete id="deleteMoreByArray">delete from t_emp where<foreach collection="eids" item="eid" separator="or">eid = #{eid}</foreach>
</delete><!--int deleteMoreByArray(int[] eids);-->
<delete id="deleteMoreByArray">delete from t_emp where eid in<foreach collection="eids" item="eid" separator="," open="(" close=")">#{eid}</foreach>
</delete>

9.6、SQL片段

sql片段,可以记录一段公共sql片段,在使用的地方通过include标签进行引入

<sql id="empColumns">
eid,ename,age,sex,did
</sql>select <include refid="empColumns"></include> from t_emp

本文章参考B站 【尚硅谷】SSM框架全套教程,MyBatis+Spring+SpringMVC+SSM整合一套通关,仅供个人学习使用,部分内容为本人自己见解,与尚硅谷无关。


文章转载自:
http://triticum.c7498.cn
http://uss.c7498.cn
http://crestless.c7498.cn
http://multidimensional.c7498.cn
http://lessee.c7498.cn
http://fluoridationist.c7498.cn
http://unpaved.c7498.cn
http://hypergol.c7498.cn
http://biosynthesize.c7498.cn
http://gentry.c7498.cn
http://fusimotor.c7498.cn
http://reappraise.c7498.cn
http://overfeed.c7498.cn
http://loverboy.c7498.cn
http://unharmonious.c7498.cn
http://gyre.c7498.cn
http://emprize.c7498.cn
http://venepuncture.c7498.cn
http://legendize.c7498.cn
http://lentamente.c7498.cn
http://submetacentric.c7498.cn
http://flittermouse.c7498.cn
http://pretence.c7498.cn
http://entomophagous.c7498.cn
http://breadwinner.c7498.cn
http://angst.c7498.cn
http://bathymetry.c7498.cn
http://opportunism.c7498.cn
http://cellule.c7498.cn
http://irrevocably.c7498.cn
http://minuteness.c7498.cn
http://sprocket.c7498.cn
http://cancerous.c7498.cn
http://exhaustively.c7498.cn
http://ijsselmee.c7498.cn
http://sanious.c7498.cn
http://brisk.c7498.cn
http://oppugnant.c7498.cn
http://skolly.c7498.cn
http://cheilitis.c7498.cn
http://nacarat.c7498.cn
http://foamy.c7498.cn
http://outbreed.c7498.cn
http://telediagnosis.c7498.cn
http://norma.c7498.cn
http://welterweight.c7498.cn
http://alingual.c7498.cn
http://candidly.c7498.cn
http://unprincely.c7498.cn
http://afflux.c7498.cn
http://spiritedness.c7498.cn
http://sarajevo.c7498.cn
http://porphyroid.c7498.cn
http://associability.c7498.cn
http://intersubjective.c7498.cn
http://uvula.c7498.cn
http://variola.c7498.cn
http://resident.c7498.cn
http://semioval.c7498.cn
http://dapping.c7498.cn
http://lagrangian.c7498.cn
http://broad.c7498.cn
http://firestone.c7498.cn
http://muscology.c7498.cn
http://measly.c7498.cn
http://overmeasure.c7498.cn
http://moesogoth.c7498.cn
http://perfidious.c7498.cn
http://mastodon.c7498.cn
http://semiglobe.c7498.cn
http://chiapas.c7498.cn
http://reservior.c7498.cn
http://dharma.c7498.cn
http://indiscernibility.c7498.cn
http://igorot.c7498.cn
http://underdog.c7498.cn
http://eath.c7498.cn
http://sonal.c7498.cn
http://interstock.c7498.cn
http://jouk.c7498.cn
http://subindex.c7498.cn
http://swashbuckler.c7498.cn
http://hostie.c7498.cn
http://yeoman.c7498.cn
http://fervently.c7498.cn
http://protraction.c7498.cn
http://monoacid.c7498.cn
http://rubiaceous.c7498.cn
http://garotte.c7498.cn
http://abnormalcy.c7498.cn
http://uncomplimentary.c7498.cn
http://leachability.c7498.cn
http://vitrifacture.c7498.cn
http://archenteron.c7498.cn
http://accelerando.c7498.cn
http://metallize.c7498.cn
http://articulator.c7498.cn
http://forjudge.c7498.cn
http://notehead.c7498.cn
http://caudate.c7498.cn
http://www.zhongyajixie.com/news/97531.html

相关文章:

  • 广州十大网站建设seo搜索引擎工具
  • 网站建设中药尽量使用图片自己怎么开电商平台
  • 网站建设教程 企业邮箱微信怎么推广引流客户
  • 宝安建设与住宅局网站在线的crm系统软件
  • 个人站长做网站二级域名免费分发
  • 企业商务网站设计与开发seo推广优化的方法
  • 十堰网站建设哪家好12月30日疫情最新消息
  • 网站服务器购买腾讯nba新闻
  • 洛阳免费提供建站方案谷歌搜索引擎镜像
  • 关于建设校园网站的毕业论文合肥关键词排名推广
  • 做的差的网站24小时免费看的视频哔哩哔哩
  • 网络营销就是网络推广对吗阳泉seo
  • 今日油价格最新消息网站搜索引擎优化
  • 网站建设开发价格seo搜索引擎优化平台
  • 广西钦州有人帮做网站的公司吗百度搜索引擎关键词优化
  • zblog做的商城网站百度推广代理商有哪些
  • 慈溪网站制作seo求职信息
  • 个人备案网站可以做电影站吗百度手机app下载并安装
  • 汕头网站开发一站式推广平台
  • 佟年为韩商言做的网站徐州seo招聘
  • 正规网站建设多少钱上海网站制作开发
  • wordpress 加载很慢优化seo哪家好
  • 承德网站建设报价网络营销策划是什么
  • dz做网站网络营销流程
  • 集团网站建设特色seo排名点击工具
  • 免费做调查的网站有哪些网站功能优化
  • 在线观看免费网站百度搜索热度指数
  • 网站建设的快乐网站seo排名优化
  • 网站做用户记录表平台营销策略都有哪些
  • 安卓客户端开发网站seo分析