package com.vci.server.base.persistence.dao;
|
|
import java.text.SimpleDateFormat;
|
|
import com.vci.common.objects.UserEntity;
|
|
/**
|
* <p>Title: Hibernate服务公用类</p>
|
* <p>Description: 通过共有类完成用户信息的设置,为操作记录日志做准备</p>
|
* <p>Copyright: Copyright (c) 2011</p>
|
* <p>Company: VCI</p>
|
* @author Administrator
|
* @time 2011-6-16
|
* @version 1.0
|
*/
|
public class BaseService {
|
|
protected UserEntity userEntity = null;
|
|
protected SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
public BaseService() {
|
|
}
|
|
public BaseService(UserEntity userEntity){
|
this.userEntity = userEntity;
|
}
|
|
public void setUserEntity(UserEntity userEntity) {
|
this.userEntity = userEntity;
|
}
|
|
public UserEntity getUserEntity() {
|
return this.userEntity;
|
}
|
|
/**
|
* 返回日期的字符串表现形式
|
* <p>Description: </p>
|
*
|
* @author xchao
|
* @time 2012-5-19
|
* @param date java.util.Date
|
* @return
|
*/
|
public String getDateString(java.util.Date date){
|
return SDF.format(date);
|
}
|
/**
|
*
|
* <p>Description: </p>
|
*
|
* @author xchao
|
* @time 2012-5-19
|
* @param date java.sql.Date
|
* @return
|
*/
|
public String getDateString(java.sql.Date date){
|
@SuppressWarnings("deprecation")
|
java.util.Date utDate = new java.util.Date(
|
date.getYear(), date.getMonth(), date.getDate(),
|
date.getHours(), date.getMinutes(), date.getSeconds());
|
return getDateString(utDate);
|
}
|
}
|