批量添加、修改、查询相关Java代码

批量添加

void insertRiderCompute(@Param("riderMoneyReportPos") List<RiderMoneyReportPo> riderMoneyReportPos);

<insert id="insertRiderCompute">
INSERT INTO tb_rider_money_report
(rider_money,rider_user_id,status,create_time,zhi_fu_bao,zhi_fu_bao_name,type)
VALUES
<foreach collection="riderMoneyReportPos" item="item" index="index" separator=",">
(
#{item.riderMoney},
#{item.riderUserId},
#{item.status},
#{item.createTime},
#{item.zhiFuBao},
#{item.zhiFuBaoName},
#{item.type}
)
</foreach>
</insert>

批量查询

List<TbOrderVo> selectByTime(@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("shopId") Long shopId, @Param("type") String type,
@Param("schoolShops") List<String> schoolShops);

select tr.shops_money as shopsMoney,tr.shops_id,tr.status,tr.create_time,tr.update_time,tr.type,gs.shop_name,gs.phone,
tr.sum_platform_money as sumPlatformMoney,tr.sum_rider_money as sumRiderMoney,tr.deduction_earning as deductionEarning,tr.sum_order_money as sumOrderMoney
from tb_shop_money_report tr
left join goods_shop gs on tr.shops_id=gs.shop_id
where 1=1
<if test="schoolShops!=null and schoolShops.size()>0">
AND tr.shops_id in
<foreach collection="schoolShops" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="schoolShops.size()==0">
AND tr.shops_id in ('')
</if>

批量修改

Integer importInfo(@Param("students")List<Student> students,@Param("classroom")String classroom);

<update id="importInfo">
        update tab_student set
        <foreach collection="students" item="student" open="classroom= case id" close="end">
            when #{student.id} then #{student.classroom}
        </foreach>
        where id in
        <foreach collection="students" item="student" open="(" close=")" separator=",">
            #{student.id}
        </foreach>
    </update>
 

  • 9
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值