add
This commit is contained in:
28
backend/src/main/java/com/nursinghome/mapper/BillMapper.java
Normal file
28
backend/src/main/java/com/nursinghome/mapper/BillMapper.java
Normal file
@@ -0,0 +1,28 @@
|
||||
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<Bill> 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<Bill> listByElderId(Long elderId);
|
||||
|
||||
@Select("<script>SELECT * FROM bill WHERE elder_id IN <foreach collection='elderIds' item='id' open='(' separator=',' close=')'>#{id}</foreach> ORDER BY month DESC</script>")
|
||||
List<Bill> listByElderIds(@Param("elderIds") List<Long> elderIds);
|
||||
|
||||
@Update("UPDATE bill SET status=#{status}, paid_at=#{paidAt} WHERE id=#{id}")
|
||||
int updateStatus(Bill bill);
|
||||
}
|
||||
Reference in New Issue
Block a user