Mybatis的动态拼接条件
来源:互联网 发布:淘宝机箱定制线哪家好 编辑:程序博客网 时间:2024/05/29 17:20
官网的例子永远是最好的,切记切记!!
拼接条件
<sql id="select_asset_where"> <if test="accountType != null and accountType.size != 0" > and <foreach collection="accountType" item="param" separator="OR" open="(" close=")"> a.account_type = #{param} </foreach> </if> </sql>
条件查询
<select id="selectAssetByCondition" parameterType="com.zemcho.controller.asset.dto.AssetConditionDto" resultMap="AssetCondtitionResultMap"> SELECT reg_code, asset_name, asset_type, metering_units, use_info, expect_end_date, regist_man, regist_date, account_type, fee_item, finance_bill_date, user, user_account, keeper, checker, buyer, school_addr, account_book, acquire_way, asset_use_way, write_off_date, asset_status_1, store_place, orginal_value, net_value, number_value FROM tb_asset_regist_d a <if test="assetDepInfo != null" > , cfg_asset_dep_info b </if> <if test="assetTypeInfo != null" > , cfg_asset_type_info c </if> <where> <include refid="select_asset_where"></include> </where></select>
批量插入
<!-- 批量插入 --> <!-- 批量插入生成的兑换码 --> <insert id ="insertBulk" parameterType="java.util.List" > <selectKey resultType ="java.lang.Integer" keyProperty= "id" order= "AFTER"> SELECT LAST_INSERT_ID() </selectKey > insert into `tb_basic_treatment_d` (<include refid="Base_Column_List" />,LOAD_TIME) values <foreach collection ="list" item="item" index= "index" separator =","> ( #{item.name}, #{item.teacherNumber}, #{item.idNumber}, #{item.year}, #{item.annualWageIncomeYuan}, #{item.fiveInsuranceAGold}, #{item.loadTime} ) </foreach > </insert >
普通查询
<select id="selectByReaderNum" parameterType="string" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from tb_library_borrower_d where reader_id = #{num,jdbcType=VARCHAR} limit 1 </select>
阅读全文
1 0
- Mybatis的动态拼接条件
- Mybatis的动态拼接条件
- myBatis中删除条件的拼接问题
- myBatis中查询条件的拼接
- mybatis拼接条件查询
- mybatis拼接查询条件
- mybatis根据参数动态拼接多个where条件
- 动态拼接LINQ查询条件的解决方案
- Linq动态拼接条件
- MyBatis的动态sql的like拼接
- mybatis的动态条件查询
- Mybatis动态拼接SQL
- Mybatis动态拼接SQL
- MyBatis动态拼接SQL
- Mybatis动态拼接sql
- Oracle SQL 动态拼接Where后面的筛选条件
- Spring Data JPA 动态拼接条件的通用设计模式
- 基于mybatis的动态条件查询
- OCR 图片识别 Tesseract基于Android Studio的示例演示搭建
- Spring5学习(二)-spring projects之Spring Boot
- flex中给xml动态添加
- 水平渐变进度条的实现
- java 学习总结
- Mybatis的动态拼接条件
- solaris64位安装gsoap及编译帐务
- pandas 基础
- 11月27日云栖精选夜读:阿里毕玄:智能时代,运维工程师在谈什么?
- HTML标签学习1
- mysql添加新用户 开放外网访问
- SpringBoot+Gradle运行简单Demo Eclipse
- 高级运维工程师的打怪升级之路
- 时间工具类(二)