/**
*Feb 27, 2007
* Zhou JianGuo
* 小白
* 中国电信上海技术研究院
* MSN:zhuojianguo_leo@hotmail.com
*/
package com.procedure.util.select;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.procedure.hibernate.SessionFactory.HibernateSessionFactory;
import com.procedure.hibernate.oracle10.getHibernateTemplate.model.DeviceInfo;
import com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoArea;
import com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoDevice;
import com.procedure.org.framework.service.select.SelectDeviceService;
import com.procedure.org.framework.service.select.SelectService;
/**
*Feb 27, 2007
* Zhou JianGuo
* 小白
* 中国电信上海技术研究院
* MSN:zhuojianguo_leo@hotmail.com
*/
public class SelectDeviceDAO {
/**
*
*/
public SelectDeviceDAO() {
// TODO Auto-generated constructor stub
}
/*
* 获取所有大类的类别列表
*/
/**
*Feb 20, 2007
* Zhou JianGuo
* 小白
* 中国电信上海技术研究院
* MSN:zhuojianguo_leo@hotmail.com
*/
SelectDeviceService selectDeviceServiceImpl;
VideoDevice VideoDevice=new VideoDevice();
protected final Log logger = LogFactory.getLog(getClass().getName());
public Map getFactory()
{
Map map = new HashMap();
List list = new ArrayList();
String queryString="select new com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoDevice(d.factory,(select c.annexa from HrUserDic c where c.dicid='EMP0023' and c.dicname=d.factory) as tmpName) from DeviceInfo d";
list=selectDeviceServiceImpl.getFactory(queryString);
logger.info("调用getFactory得到list:"+list);
for(int i=0;i<list.size();i++){
//---------这里只能采用这种形式,呵呵,为什么??请去看DWR的文档吧
map.put(((VideoDevice)list.get(i)).getTmpName(),((VideoDevice)list.get(i)).getTmpValue());
}
return map;
}
public Map getModel(String data)
{
Map map = new HashMap();
List list = new ArrayList();
String queryString="select new com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoDevice( d.model,(select c.annexa from HrUserDic c where c.dicid='EMP0024' and c.dicname=d.model) as tmpName) from DeviceInfo d where d.factory=?";
list=selectDeviceServiceImpl.getModel(queryString,data);
logger.info("调用getModel得到list:"+list);
for(int i=0;i<list.size();i++){
//---------这里只能采用这种形式,呵呵,为什么??请去看DWR的文档吧
map.put(((VideoDevice)list.get(i)).getTmpName(),((VideoDevice)list.get(i)).getTmpValue());
}
return map;
}
public Map getNumb(String factory,String data)
{
Map map = new HashMap();
List list = new ArrayList();
String queryString="select new com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoDevice( d.numb,d.numb) from DeviceInfo d where d.factory=? and d.model=?";
list=selectDeviceServiceImpl.getNumb(queryString,new String[]{factory,data});
logger.info("调用getNumb得到list:"+list);
for(int i=0;i<list.size();i++){
//---------这里只能采用这种形式,呵呵,为什么??请去看DWR的文档吧
map.put(((VideoDevice)list.get(i)).getTmpName(),((VideoDevice)list.get(i)).getTmpValue());
}
return map;
}
public Map getValue(String data)
{
Map map = new HashMap();
List list = new ArrayList();
String queryString="select d.name from DeviceInfo d where d.numb=?";
list=selectDeviceServiceImpl.getModel(queryString,data);
logger.info("调用getValue得到list:"+list);
for(int i=0;i<list.size();i++){
//---------这里只能采用这种形式,呵呵,为什么??请去看DWR的文档吧
map.put("deviceName",list.get(0));
}
return map;
}
/**
* @return the selectDeviceServiceImpl
*/
public SelectDeviceService getselectDeviceServiceImpl() {
return selectDeviceServiceImpl;
}
/**
* @param selectDeviceServiceImpl the selectDeviceServiceImpl to set
*/
public void setselectDeviceServiceImpl(SelectDeviceService selectDeviceServiceImpl) {
this.selectDeviceServiceImpl = selectDeviceServiceImpl;
}
}
/*--------------------------------------------------|
| Zhou jianguo |
|---------------------------------------------------|
| Copyright (c) 2007-2008 ChinaTelecom |
| |
| Updated: 25.02.2007 |
|--------------------------------------------------*/
function loadSelectDevice()
{
SelectDeviceDAO.getFactory(createSelectDevice);
}
function createSelectDevice(data)
{
var factory = document.getElementById("factory");
var model = document.getElementById("model");
DWRUtil.removeAllOptions("factory");
DWRUtil.removeAllOptions("model");
DWRUtil.addOptions("factory",{0:'选择厂商'});//----------设置ä¸ä¸ªåå§åç䏿å表å
容
DWRUtil.addOptions("model",{0:'选择类型'});
factory.options[0].selected=true;
model.options[0].selected=true;
DWRUtil.addOptions("factory", data);
}
function selectModel(data)
{
var model = document.getElementById("model");
model.length=1;
model.options[0].selected=true;
if(data == "0"){
DWRUtil.removeAllOptions("model");
DWRUtil.removeAllOptions("numb");
DWRUtil.addOptions("numb",{0:'选择型号'});
DWRUtil.addOptions("model",{0:'选择类型'});
numb.length=1;
numb.options[0].selected=true;
model.length=1;
model.options[0].selected=true;
}else
{
DWRUtil.removeAllOptions("model");
DWRUtil.addOptions("model",{0:'选择类型'});
SelectDeviceDAO.getModel(data,getAModel);//è¿é被è°ç¨çæ¹æ³è¦æ¾åé¢ï¼è¦ä¼ éçåæ°æ¾åé¢
}
}
function getAModel(data){
DWRUtil.addOptions("model",data);
}
function selectNO(data)
{
var factory = document.getElementById("factory");
var numb = document.getElementById("numb");
numb.length=1;
numb.options[0].selected=true;
if(data == "0"){
DWRUtil.removeAllOptions("numb");
DWRUtil.addOptions("numb",{0:'选择型号'});
numb.length=1;
numb.options[0].selected=true;
}else
{
DWRUtil.removeAllOptions("numb");
DWRUtil.addOptions("numb",{0:'选择型号'});
SelectDeviceDAO.getNumb(factory.value,data,getANumb);//è¿é被è°ç¨çæ¹æ³è¦æ¾åé¢ï¼è¦ä¼ éçåæ°æ¾åé¢
}
}
function getANumb(data){
DWRUtil.addOptions("numb",data);
}
function getName(data)
{
if(data == "0"){
DWRUtil.setValue('name','');
}else
{
SelectDeviceDAO.getValue(data,getAValue)
}
}
function getAValue(data){
DWRUtil.setValue('name',data.deviceName);
}
/**
*Nov 8, 2006
* Zhou JianGuo
* 小白
* MSN:zhuojianguo_leo@hotmail.com
*/
package com.procedure.org.framework.service.select;
import java.util.List;
import org.springframework.context.ApplicationContext;
import com.procedure.hibernate.oracle10.getHibernateTemplate.model.VideoArea;
import com.procedure.org.framework.dao.ICommonDAO;
import com.procedure.org.framework.service.BaseServiceImpl;
/**
*Nov 8, 2006
* Zhou JianGuo
* 小白
* MSN:zhuojianguo_leo@hotmail.com
*/
public class SelectDeviceServiceImpl implements SelectDeviceService{
/**
*
*/
public SelectDeviceServiceImpl() {
// TODO Auto-generated constructor stub
}
private ICommonDAO commonDAO;
/**
* The service Spring bean id, used in the applicationContext.xml file.
*/
private static final String SERVICE_BEAN_ID = "SelectDeviceServiceImpl";
/**
* Returns the singleton <code>IProcedureService</code> instance.
*/
public static ICommonDAO getInstance(ApplicationContext context) {
return (ICommonDAO)context.getBean(SERVICE_BEAN_ID);
}
/**
* @return the commonDAO
*/
public ICommonDAO getCommonDAO() {
return commonDAO;
}
/**
* @param commonDAO the commonDAO to set
*/
public void setCommonDAO(ICommonDAO commonDAO) {
this.commonDAO = commonDAO;
}
public List getFactory(String queryString) {
// TODO Auto-generated method stub
return (List)this.getCommonDAO().getSelect(queryString);
}
public List getModel(String queryString,String params) {
// TODO Auto-generated method stub
return (List)this.getCommonDAO().getSelect(queryString,params);
}
public List getNumb(String queryString,String[] params) {
// TODO Auto-generated method stub
return (List)this.getCommonDAO().getSelect(queryString,params);
}
}
package com.procedure.hibernate.oracle10.getHibernateTemplate.model;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* The persistent class for the VIDEO_DEVICE database table.
*
* @author BEA Workshop Studio
*/
public class VideoDevice implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
private String id;
private String annexa;
private String annexb;
private String annexc;
private String annexd;
private String ascription;
private java.sql.Date begindatime;
private String bookin;
private String cpycde;
private String describe;
private java.sql.Date editdatime;
private String factory;
private String ip;
private String location;
private String mappingnumber;
private String mode1;
private String model;
private String name;
private String numb;
private String orgcde;
private String state;
private java.sql.Date stopdatime;
private String vindicatestatus;
private String tmpName;
private String tmpValue;
public VideoDevice() {
}
public VideoDevice(String tmpName,String tmpValue) {
this.tmpName=tmpName;
this.tmpValue=tmpValue;
}
/**
* @return the factoryName
*/
public String getTmpName() {
return tmpName;
}
/**
* @param factoryName the factoryName to set
*/
public void setTmpName(String tmpName) {
this.tmpName = tmpName;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getAnnexa() {
return this.annexa;
}
public void setAnnexa(String annexa) {
this.annexa = annexa;
}
public String getAnnexb() {
return this.annexb;
}
public void setAnnexb(String annexb) {
this.annexb = annexb;
}
public String getAnnexc() {
return this.annexc;
}
public void setAnnexc(String annexc) {
this.annexc = annexc;
}
public String getAnnexd() {
return this.annexd;
}
public void setAnnexd(String annexd) {
this.annexd = annexd;
}
public String getAscription() {
return this.ascription;
}
public void setAscription(String ascription) {
this.ascription = ascription;
}
public java.sql.Date getBegindatime() {
return this.begindatime;
}
public void setBegindatime(java.sql.Date begindatime) {
this.begindatime = begindatime;
}
public String getBookin() {
return this.bookin;
}
public void setBookin(String bookin) {
this.bookin = bookin;
}
public String getCpycde() {
return this.cpycde;
}
public void setCpycde(String cpycde) {
this.cpycde = cpycde;
}
public String getDescribe() {
return this.describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public java.sql.Date getEditdatime() {
return this.editdatime;
}
public void setEditdatime(java.sql.Date editdatime) {
this.editdatime = editdatime;
}
public String getFactory() {
return this.factory;
}
public void setFactory(String factory) {
this.factory = factory;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getLocation() {
return this.location;
}
public void setLocation(String location) {
this.location = location;
}
public String getMappingnumber() {
return this.mappingnumber;
}
public void setMappingnumber(String mappingnumber) {
this.mappingnumber = mappingnumber;
}
public String getMode1() {
return this.mode1;
}
public void setMode1(String mode1) {
this.mode1 = mode1;
}
public String getModel() {
return this.model;
}
public void setModel(String model) {
this.model = model;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getNumb() {
return this.numb;
}
public void setNumb(String numb) {
this.numb = numb;
}
public String getOrgcde() {
return this.orgcde;
}
public void setOrgcde(String orgcde) {
this.orgcde = orgcde;
}
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
public java.sql.Date getStopdatime() {
return this.stopdatime;
}
public void setStopdatime(java.sql.Date stopdatime) {
this.stopdatime = stopdatime;
}
public String getVindicatestatus() {
return this.vindicatestatus;
}
public void setVindicatestatus(String vindicatestatus) {
this.vindicatestatus = vindicatestatus;
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof VideoDevice)) {
return false;
}
VideoDevice castOther = (VideoDevice)other;
return new EqualsBuilder()
.append(this.getId(), castOther.getId())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getId())
.toHashCode();
}
public String toString() {
return new ToStringBuilder(this)
.append("id", getId())
.toString();
}
/**
* @return the tmpValue
*/
public String getTmpValue() {
return tmpValue;
}
/**
* @param tmpValue the tmpValue to set
*/
public void setTmpValue(String tmpValue) {
this.tmpValue = tmpValue;
}
}