Mybatis中绑定参数

<select id="list" resultType="net.ybjt.model.storageManagement.warehouse.domain.WarehouseDO">
		select `id`,`stu_name`,`stu_num`,`stu_model`,`stu_price`,`stu_unit`,`stu_amount`,`stu_man`,`stu_in_date`,`stu_out_date`,`stu_days`,`stu_state`,u.name manName from ybms_warehouse y,sys_user u 
        <where>  
        			y.stu_man = u.user_id  and  stu_delete = 1 and stu_type = 0
		  		  <if test="id != null and id != ''"> and id = #{id} </if>
		  		  <if test="stuName != null and stuName != ''"> <bind name="stuName" value="'%' + stuName + '%'" /> and stu_name  like #{stuName} </if>
		  		  <if test="stuNum != null and stuNum != ''"> and stu_num = #{stuNum} </if>
		  		  <if test="stuModel != null and stuModel != ''"> and stu_model = #{stuModel} </if>
		  		  <if test="stuPrice != null and stuPrice != ''"> and stu_price = #{stuPrice} </if>
		  		  <if test="stuUnit != null and stuUnit != ''"> and stu_unit = #{stuUnit} </if>
		  		  <if test="stuAmount != null and stuAmount != ''"> and stu_amount = #{stuAmount} </if>
		  		  <if test="stuMan != null and stuMan != ''"> and stu_man = #{stuMan} </if>
		  		  <if test="stuInDate != null and stuInDate != ''"> and stu_in_date = #{stuInDate} </if>
		  		  <if test="stuOutDate != null and stuOutDate != ''"> and stu_out_date = #{stuOutDate} </if>
		  		  <if test="stuDays != null and stuDays != ''"> and stu_days = #{stuDays} </if>
		  		  <if test="stuState != null and stuState != ''"> and stu_state = #{stuState} </if>
		  		</where>
        <choose>
            <when test="sort != null and sort.trim() != ''">
                order by ${sort} ${order}
            </when>
			<otherwise>
                order by id desc
			</otherwise>
        </choose>
		<if test="offset != null and limit != null">
			limit #{offset}, #{limit}
		</if>
	</select>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值