@PersistenceContext
private EntityManager entityManager;
public <B extends BaseBean> HashMap<String, String> queryPersonAttStatus(
Attendance attendance, String startDate, String endDate) {
Query query = entityManager
.createNativeQuery("select status, count(1), cast(sum( case when exctime = '' then 0 when exctime =null then 0 else exctime end) as varchar(10)) from T_UBMP_SM_ATTENDANCE where workdate between '"
+ startDate
+ "' and '"
+ endDate
+ "' and upprojectid = '"
+ attendance.getUpprojectid()
+ "' group by status");
List result = query.getResultList();
HashMap<String, String> ret = new HashMap<String,String>();
if(result != null && result.size() > 0){
for(int index = 0; index < result.size(); index ++){
Object[] status = (Object[])(result.get(index));
。。。。。。
如果不加 cast(column as varchar(size)) 报错No Dialect mapping for JDBC type: 111