package com.nursinghome.mapper; import com.nursinghome.entity.Bill; import org.apache.ibatis.annotations.*; import java.util.List; @Mapper public interface BillMapper { @Insert("INSERT INTO bill(elder_id, month, bed_fee, care_fee, meal_fee, other_fee, total, status, created_at) VALUES(#{elderId}, #{month}, #{bedFee}, #{careFee}, #{mealFee}, #{otherFee}, #{total}, #{status}, NOW())") @Options(useGeneratedKeys = true, keyProperty = "id") int insert(Bill bill); @Select("SELECT * FROM bill ORDER BY month DESC") List listAll(); @Select("SELECT * FROM bill WHERE id = #{id}") Bill findById(Long id); @Select("SELECT * FROM bill WHERE elder_id = #{elderId} ORDER BY month DESC") List listByElderId(Long elderId); @Select("") List listByElderIds(@Param("elderIds") List elderIds); @Update("UPDATE bill SET status=#{status}, paid_at=#{paidAt} WHERE id=#{id}") int updateStatus(Bill bill); }