无论我加几种查询条件,返回给我的查询总量恒等于mysql数据的总量
经过逐行打印,发现没有进入if语句中
问题:帮忙找出为什么没有进入if语句中????
public static int tongJi(StudentDuoTiaoJian sdtj) {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
conn = Util.getConnection();
StringBuilder sql = new StringBuilder();
sql.append(" select count(*)");
sql.append(" from stu_student");
sql.append(" where 1=1");
if (sdtj.getId() != 0) {
sql.append(" and stu_id=?");
System.out.println("==============================");
}
if (sdtj.getName() != null) {
sql.append(" and stu_name like ?");
System.out.println("=