mybatis 大於等於小於等於

 >  這個是  >=
&lt;   這個是  <=

 

參數是一個list:
<if test="joinInformation.departIds != null and joinInformation.departIds.size() >0 ">
    and depart_id in
    <foreach collection="joinInformation.departIds" close=")" open="(" separator="," item="departId">
        #{joinInformation.departId}
    </foreach>
</if>

分頁的limit

<if test="joinInformation.startRow != null and joinInformation.limit != null">
    limit #{joinInformation.startRow},#{joinInformation.limit}
</if>

 

in條件

select id from tb_staff_base where user_name= #{userName} and phone= #{phone} and work_status in ('ALREADY_ENTRY','IMMINENT_ENTRY')

 

 

模糊匹配

<select id="selectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from tb_staff_base
    where user_name like #{userName}"%"
</select>

 

插入時候返回插入那條數據的id

<insert id="insertSelective" parameterType="com.bee.hrm.entity.staff.StaffEntity" useGeneratedKeys="true"
        keyProperty="id">

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章