支出信息维护

main
zjh 4 days ago
parent 8a01f22920
commit 7ae70ea3fa

@ -0,0 +1,51 @@
package com.ssm.di.annotation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
/**
* B
* XML
*/
@Component("expense")
public class Expense {
@Value("2001")
private Integer id;
@Value("1")
private Integer userId;
@Value("餐饮")
private String type;
@Value("1200.00")
private BigDecimal amount;
@Value("2024-04-15")
private String expenseDate;
@Value("日常餐饮消费")
private String remark;
public Expense() {}
public void printInfo() {
System.out.println("\n===== 组员赵晋鹤-支出信息 =====");
System.out.println("支出ID" + id);
System.out.println("用户ID" + userId);
System.out.println("支出类型:" + type);
System.out.println("支出金额:" + amount);
System.out.println("支出日期:" + expenseDate);
System.out.println("备注:" + remark);
}
// Getter & Setter
public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
public Integer getUserId() { return userId; }
public void setUserId(Integer userId) { this.userId = userId; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public BigDecimal getAmount() { return amount; }
public void setAmount(BigDecimal amount) { this.amount = amount; }
public String getExpenseDate() { return expenseDate; }
public void setExpenseDate(String expenseDate) { this.expenseDate = expenseDate; }
public String getRemark() { return remark; }
public void setRemark(String remark) { this.remark = remark; }
}

@ -16,5 +16,8 @@ public class TestAnnotation {
// 收入信息
Income income = (Income) ac.getBean("income");
income.printInfo();
// 支出信息
Expense expense = (Expense) ac.getBean("expense");
expense.printInfo();
}
}
Loading…
Cancel
Save