import java.util.List; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import com.sunrise.psmis.AbstractDAO; import com.sunrise.psmis.Constants; import com.sunrise.psmis.util.StringUtil; public class SequenceJdbcTemplateDAO extends AbstractDAO { protected JdbcTemplate jdbcTemplate; public void setJdbcTemplate(JdbcTemplate dao) { this.jdbcTemplate = dao; } public SequenceJdbcTemplateDAO(){ if(jdbcTemplate==null){ jdbcTemplate = (JdbcTemplate)Constants.getActx().getBean("jdbcTemplate"); } } /** * 取 wf_group 表的最大ID * @return */ public Long getMAX_WFGROUP(){ String sql = "SELECT MAX(GROUPID) AS A FROM WF_GROUP"; return jdbcTemplate.queryForLong(sql); } /** * 取 EX_WORKSHEET 表的最大ID * @return */ public Long getMAX_EX_WORKSHEET(){ String sql = "SELECT MAX(CONVERT(NUMERIC,substring(WORK_SHEET_NO,4,char_length(WORK_SHEET_NO)-3))) AS A FROM EX_WORKSHEET"; //sybase return jdbcTemplate.queryForLong(sql); } /** * 取 MR_group 表的最大ID * @return */ public Long getMAX_MRGROUP(){ String sql = "SELECT MAX(GROUPID)+1 AS A FROM MR_GROUP"; return jdbcTemplate.queryForLong(sql); } }
最近下载更多