📄 taskdaoimpl.java
字号:
+ toBeSql
+ "'"
+ DateTimeTool
.getTomorrowDate("yyyy-MM-dd", to)
+ "'" + " order by at.finalTime",
new Object[] { flag, user.getId() });
}
/**
* @author 陆文邦;
* @function 搜索全部任务活动;
* @param whereSql
* 根据whereSql搜索记录;
* @param type
* 根据类型任务活动;
* @param to区分重写方法;
* @return 返回本月的任务活动;
*/
public List getAllTasksByFuture(Integer flag, User user, String toBeSql,
Integer to, String type) throws DataAccessException {
return this
.getHibernateTemplate()
.find(
"from ActivityTask at where at.executeState<>3 and at.flag=? and at.assignerId=? order by at.finalTime"
+ toBeSql, new Object[] { flag, user.getId() });
}
/**
* @author 陆文邦;
* @function 根据联系人更新任务;
* @param modifyManId;
* @param modifyTime;
* @param contactId;
* @param flag;
*/
public void updateTasksByContactId(int modifyManId, String modifyTime,
int contactId, int flag) throws DataAccessException {
this
.getHibernateTemplate()
.bulkUpdate(
"update ActivityTask as at set at.flag=?, at.modifyManId=?, at.lastModifyTime=? where at.customerContact.id=? ",
new Object[] { flag, modifyManId, modifyTime, contactId });
}
/**
* @author 陆文邦;
* @function 更新任务根据ID;
* @param modifyManId;
* @param modifyTime;
* @param contactId;
* @param flag;
*/
public void updateTaskById(int modifyManId, String modifyTime, int taskId,
int flag) throws DataAccessException {
this
.getHibernateTemplate()
.bulkUpdate(
"update ActivityTask as at set at.flag=?, at.modifyManId=?, at.lastModifyTime=? where at.id=? ",
new Object[] { flag, modifyManId, modifyTime, taskId });
}
/**
* @author 陆文邦;
* @function 查找所有被删除的任务;
* @param modifyManId;
* @param modifyTime;
* @param contactId;
* @param flag;
*/
public List getTasksByDelete(User user, int flag)
throws DataAccessException {
return getHibernateTemplate()
.find(
"from ActivityTask as at where at.assignerId=? and at.flag=? order by at.lastModifyTime desc",
new Object[] { user.getId(), flag });
}
/**
* @author 陆文邦;
* @function 根据subject模糊查找任务;
* @param modifyManId;
* @param modifyTime;
* @param contactId;
* @param flag;
*/
public List getTasksBySubjectLike(User user, int flag, String subject)
throws DataAccessException {
return getHibernateTemplate()
.find(
"from ActivityTask as at where at.assignerId=? and at.flag=? and at.subject like '%"
+ subject
+ "%' order by at.lastModifyTime desc",
new Object[] { user.getId(), flag });
}
/**
* 函数功能 获取当前时间是否有任务要提醒; 参数说明@param flag 可用状态
*
* @param user
* 用户
* @param dateStr
* 日期
* @param wakeUpTime
* 提醒时间 创建时间:2009-1-17; 程序作者:陆文邦;
* @return
* @throws ApplicationException
*/
public List getTasksByNow(int flag, User user, String dateStr,
String wakeUpTime) throws ApplicationException {
return this
.getHibernateTemplate()
.find(
"from ActivityTask at where at.assignerId=? and at.flag=? and at.wakeUpDate=? and at.wakeUpTime=?",
new Object[] { user.getId(), flag, dateStr, wakeUpTime });
}
/**
* 程序作者:陆文邦; 创建时间:2009-01-19; 函数功能:获取需要提醒的数据; 参数说明:@param user 根据该用户相关的数据
*
* @param flag
* 可用状态的数据;
* @return list 数据列表;
* @throws DataAccessException
*/
public List getAllTaskByAlert(User user, int flag)
throws DataAccessException {
return this
.getHibernateTemplate()
.find(
"from ActivityTask at where at.assignerId=? and at.flag=? and at.wakeUpTime is not null and at.wakeUpDate is not null order by at.wakeUpDate desc,at.wakeUpTime desc",
new Object[] { user.getId(), flag });
}
/**
* 程序作者:陆文邦; 创建时间:2009-02-03; 函数功能:搜索提醒数据;
*
* @param id
* @return
* @throws DataAccessException
*/
public List getActivityById(Integer id) throws DataAccessException {
return this.getHibernateTemplate().find(
"from ActivityTask at where at.id=" + id);
}
/**
* 根据指定的对象(ActivityTask)删除它 param:at 指ActivityTask对象 author:张明强 time:
* 2009-02-14
*
* @throws DataAccessException
*/
public void deleteByObject(ActivityTask at) throws DataAccessException {
this.getHibernateTemplate().delete(at);
logger.debug("任务删除成功!");
}
/**
* @author LuWenBang
* @date 2009_02_17
* @param user
* @param type
* @return
* @throws ApplicationException
*/
public List getOptionsByUserAndType(User user, int type)
throws DataAccessException {
return getHibernateTemplate().find(
"from UserDefined as ud where ud.user=? and ud.type=?",
new Object[] { user, type });
}
/**
* @author LuWenBang
* @date 2009_02_18
*/
public void saveUserDefined(UserDefined userDefined)
throws DataAccessException {
this.getHibernateTemplate().save(userDefined);
}
/**
* @author LuWenBang
* @date 2009_02_18
*/
public void saveUserFilter(UserFilter userFilter)
throws DataAccessException {
this.getHibernateTemplate().save(userFilter);
}
/**
* @author LuWenBang
* @date 2009_02_18
*/
public void saveUserField(UserField userField) throws DataAccessException {
this.getHibernateTemplate().save(userField);
}
/**
* @author LuWenBang
* @date 2009_02_19
* @param usersId
* @param flag
*/
public List getTaskEvents(final String usersId,final int flag)
throws DataAccessException {
return this.getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session
.createSQLQuery("select id,(id*0)+1 as tid,subject, functionId,recordId,contact,userAuId as uid,record_name from activity_task a where a.flag="+flag+" and userAuId in ("+usersId+") union all select id,id*0 as tid,subject,functionId,recordId,contact_Id as contact,userId as uid,recordName from event e where e.flag="+flag+" and userId in ("+usersId+")");
List list = query.list();
return list;
}
});
}
/**
* @author Administrator
* @date 2009_02_20
* @function 根据id获取用户自定义搜索条件;
* @param optionId
* @return
* @throws DataAccessException
*/
public UserDefined getUserDefinedById(int optionId)
throws DataAccessException {
return (UserDefined) getHibernateTemplate().get(UserDefined.class,optionId);
}
/**
* @author LuWenBang
* @date 2009_02_20
* @function 根据UserDefined搜索过滤符号;
* @param userDefined
* @return
* @throws DataAccessException
*/
public List getUserFilterByOption(UserDefined userDefined)
throws DataAccessException {
return getHibernateTemplate().find(
"from UserFilter as uf where uf.userDefined=?", userDefined);
}
/**
* @author LuWenBang
* @date 2009_02_20;
* @function 根据UserDefined搜索UserField
* @param userDefined
* @return
* @throws DataAccessException
*/
public List getUserFieldByOption(UserDefined userDefined)
throws DataAccessException {
return getHibernateTemplate().find(
"from UserField as uf where uf.userDefined=?", userDefined);
}
/**
* @author LuWenBang
* @date 2009-02-24
* @function 修改用户自定义选项;
* @param userDefined
* @throws DataAccessException
*/
public void updateUserDefined(UserDefined userDefined)
throws DataAccessException {
this.getHibernateTemplate().saveOrUpdate(userDefined);
}
/**
* @author LuWenBang
* @DATE 2009_02_24
* @FUNCTION 获取用户视图过滤字段
* @param id
* @return
* @throws DataAccessException
*/
public UserFilter getUserFilter(int id) throws DataAccessException {
return (UserFilter) getHibernateTemplate().get(UserFilter.class, id);
}
/**
* @author LuWenBang
* @date 2009_02_24
* @function 删除过滤条件
* @param userFilter
* @throws DataAccessException
*/
public void deleteFilter(UserFilter userFilter) throws DataAccessException {
this.getHibernateTemplate().delete(userFilter);
}
/**
* @author LuWenBang
* @date 2009_02_24;
* @function 更新过滤字段;
* @param userFilter
* @throws DataAccessException
*/
public void updateUserFilter(UserFilter userFilter)
throws DataAccessException {
this.getHibernateTemplate().saveOrUpdate(userFilter);
}
/**
* @author LuWenBang
* @date 2009_02_24;
* @function 修改显示字段;
* @param userField
* @throws DataAccessException
*/
public void updateUserField(UserField userField) throws DataAccessException {
this.getHibernateTemplate().saveOrUpdate(userField);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -