MyBaties list 传参

本文深入探讨了DAO层中一种特定的列表查询方法,详细解释了如何通过参数化查询实现数据库记录的高效检索。该方法支持分页、类型过滤、工程师ID匹配及城市ID列表筛选,确保了数据查询的灵活性和准确性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

dao层

List<MyHouseType> getListByType(@Param("newCurrentPage") int newCurrentPage,
                                    @Param("pageSize") int pageSize,
                                    @Param("type")String type,
                                    @Param("engineerId")int engineerId,
                                    @Param("cityIdList") List<Integer> cityIdList);

mapper

<select id="getListByType" resultMap="BaseResultMap">
        SELECT
            <include refid="Base_Column_List"></include>
        from
        z_my_house_type

        where
        type=#{type}  and engineerId=#{engineerId}
        and
        cityId in
        <foreach item="value" index="index" collection="cityIdList" open="(" separator="," close=")">
            #{value}
        </foreach>

        order by
        id
        desc
        LIMIT  #{newCurrentPage}  , #{pageSize}
    </select>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值