首页 > 其他分享 >Mybatis if标签判断数字大小

Mybatis if标签判断数字大小

时间:2022-09-20 17:45:04浏览次数:96  
标签:areaId 数字 AREA 标签 Param year Mybatis ID

if标签语法

<select...>
  SQL语句1
  <if test="条件表达式">
     SQL语句2
  </if>
</select>

条件表达式中大于号小于号用 gt,lt

<if test="num gt 0">...</if>

<if test="num lt 0">...</if>

mapper

List<ZftjHalf> selectByAreaIdAndYear(@Param("areaId") String areaId,
                                     @Param("year") String year,
                                     @Param("level") int level);

xml

  <select id="selectByAreaIdAndYear" resultType="com.zftdata.nyzft.entity.ZftjHalf">
    select * from ZFTJ_HALF
    where FILLING_TIME LIKE CONCAT(#{year},'%')
    <if test="level lt 3">
      and AREA_ID_PID =#{areaId}
    </if>
    <if test="level gt 2">
      and AREA_ID =#{areaId}
    </if>
    <if test="level == 4">
      and AREA_ID =#{areaId}
    </if>
  </select>

标签:areaId,数字,AREA,标签,Param,year,Mybatis,ID
From: https://www.cnblogs.com/leepandar/p/16711907.html

相关文章

  • Mybatis-plus 数据安全保护
    1、加密前 application-dev.ymlspring:datasource:url:jdbc:p6spy:mysql://localhost:3306/mybatis_plus?useUnicode=true&characterEncoding=utf-8&serverTim......
  • 05.有关MyBatis的配置与使用
    有关MyBatis的配置与使用虽然SpringDataJPA在国外广泛流行,但是在国内仍是MyBatis使用更加普遍整合MyBatis第一步:新建SpringBoot项目,在pom.xml中引入MyBatis的Starter......
  • video标签播放第一帧
    <videowidth="100%"height="100%"mutedx5-video-player-type="h5"controlscontrolsList='nodownloadnoplaybackrate'disablePictureInPicturepreload="metada......
  • MyBatisPlus-范围查询、模糊查询及排序查询
    MyBatisPlus-范围查询、模糊查询及排序查询原文链接:https://blog.csdn.net/m0_61961937/article/details/125967684一、范围查询二、模糊查询三、排序查询一、范围查......
  • Mybatis plus 查询
    1、子查询//管理主管查询IntegermanageSupervisor=query.getManageSupervisor();if(manageSupervisor!=null){......
  • Python读取文件夹按数字排序
    python中os.listdir()方法用于返回指定的文件夹包含的文件或文件夹的名字的列表importospath="../data/materials/test/"path_list=os.listdir(path)print(path......
  • @Param:在Mybatis中的使用
    @Param:在Mybatis中的使用1.如果mapper接口里参数是两个普通参数;如下:publicList<student> selectuser(intpn,Stringi);<selectid="selectuser"resultType="com.......
  • 怎样做数字化转型?
    做数字化转型,首先得明白它不是做信息化,而是业务层面的转型,是一把手工程,人和数字化工具二者都是数字化转型的重要抓手,缺一不可!数字化转型首先是人的转型,人是企业文化的核心,......
  • 单标签实现复杂的棋盘布局
    最近,有群友问我,他们的一个作业,尽量使用少的标签去实现这样一个象棋布局:他用了60多个标签,而他的同学,只用了6个,问我有没有办法尽可能的做到利用更少的标签去完成这个布......
  • HTML详解、HTML标签分类
    什么是HTMLHTML(超文本标记语言——HyperTextMarkupLanguage)是构成Web世界的一砖一瓦。它定义了网页内容的含义和结构。除HTML以外的其它技术则通常用来描述一个网页......