public void selectAll() throws DataAccessException {
System.out.println("---------------------------------selectAll");
SubjectTemplate template = new SubjectTemplate(mlinktemplate);
List<Subject> list = template.selectAll();
for (Subject clz : list) {
System.out.println(">>"+clz);
}
}
public void testTemplateSelect() throws DataAccessException {
System.out.println("---------------------------------testTemplateSelect 多条");
SubjectTemplate subjectTemplate = new SubjectTemplate(mlinktemplate);
Subject entityget = subjectTemplate.get(0, 51201);
System.out.println("0>>"+entityget);
Subject entity = new Subject();
// 1
entity.setSubjectCode(51203);
List<Subject> list = subjectTemplate.select(entity);
for (Subject clz : list) {
System.out.println("1>>"+clz);
}
// 2
entity.setSubjectName("财务费用");
entity.setSubjectCode(null);
list = subjectTemplate.select(entity);
for (Subject clz : list) {
System.out.println("2>>"+clz);
}
// 2.2
list = subjectTemplate.select("subject_Code=53206");
for (Subject clz : list) {
System.out.println("2.2>>"+clz);
}
// 2.3
list = subjectTemplate.select("subject_Code=?", 53206);
for (Subject clz : list) {
System.out.println("2.3>>"+clz);
}
// 2.4
list = subjectTemplate.select("subject_Name=? and hid=?", new Object[]{"\"投资收益\"", 0});
for (Subject clz : list) {
System.out.println("2.4>>"+clz);
}
// 3
list = mlinktemplate.select(Subject.class, "subject_Name=\"投资收益\" and hid=0");
for (Subject clz : list) {
System.out.println("3>>"+clz);
}
// 4
list = mlinktemplate.select(Subject.class, "subject_Name=? and hid=0", "\"投资收益\"");
for (Subject clz : list) {
System.out.println("4>>"+clz);
}
// 5
list = mlinktemplate.select(Subject.class, "subject_Name=? and hid=?", new Object[]{"\"投资收益\"", 0});
for (Subject clz : list) {
System.out.println("5>>"+clz);
}
}