0
에 DATE 유형 쿼리 java.util.Date는 내가 가진 :의 MyBatis : 내 매핑 XML에서 MySQL 데이터베이스
생일 MySQL 데이터베이스에 DATE 유형<select id="getPatientsByBirthday" parameterType="date" resultType="com.axiohelix.nozoki.entity.Patient">
SELECT id AS id,
pharumo_id AS pharumoId,
code AS code,
family_name AS familyName,
first_name AS firstName,
family_name_kana AS familyNameKana,
first_name_kana AS firstNameKana,
gender AS gender,
address AS address,
tel AS tel
FROM tbl_patient
WHERE birthday = #{id}
</select>
.
내 매퍼 인터페이스는 다음과 같이이다 :
public interface PatientMapper {
void insertPatient(Patient patient);
Patient getPatientById(Integer id);
Integer getPatientCount();
List<Patient> getPatientsByBirthday(Date bday);
}
내가 같이 특정 생일 환자를 조회하려고 :
주어진 날짜 레코드가 비록Calendar cal1 = new GregorianCalendar(1980, 8, 15);
Date bday=cal1.getTime();
List<Patient> plist=mapper.getPatientsByBirthday(bday);
이 반환 빈 목록입니다.
Anytips?
결과 매핑과 함께 Mapper 인터페이스 구현을 XML 파일에 공유하십시오. –