<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>
Mybatis中绑定参数
最新推荐文章于 2023-09-10 00:59:31 发布