MyBatis mapper记录

1、批量删除

接口

   int deleteUserMenu(Integer menuId, List<Integer> listId);

xml

    <delete id="deleteUserMenu">
        delete from user_menu
        where menu_id = #{menuId}
        and user_id in
        <foreach collection="listId" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

 

2、查询字段集合

接口

List<CheckTaskDTO> getTaskList(@Param("listTaskStatus") List<Integer> listTaskStatus, @Param("taskName") String taskName);

xml

    <select id="getTaskList" resultType="com.sunwin.robotcloud.db.dto.CheckTaskDTO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        check_task
        WHERE        
        <if test="taskName != null and taskName != ‘‘">
            task_name like "%"#{taskName}"%"
        </if>
        <if test="listTaskStatus != null and listTaskStatus.size() > 0">
            and task_status in
            <foreach collection="listTaskStatus" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>

 

MyBatis mapper记录

上一篇:android 上传图片


下一篇:史上最强Android保活思路:深入剖析腾讯TIM的进程永生技术