一、Oracle时间
Dao接口:
/**
* 获取当前数据库时间
* @return
* @throws CommonException
*/
Date getCurrentDates();
Mapper:
select sysdate from dual
测试类:
/**
* @version: V1.0
* @author: fendo
* @className: Controller
* @packageName: test
* @description: Controller测试
* @data: 2018-01-05 10:54
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring.xml"})
public class Controller {
@Autowired
private HealthConsultationMapper healthConsultationMapper;
@Test
public void TestA() throws CommonException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date des = healthConsultationMapper.getCurrentDates();
System.out.println(format.format(des));
}
}输出为:
2018-01-05 13:53:42