package cn.ksource.beans;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.HashMap;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import cn.ksource.core.dao.BaseBean;
|
import cn.ksource.core.util.ConvertUtil;
|
import cn.ksource.core.util.StringUtil;
|
|
/**
|
* 系统接口
|
*/
|
public class CONFIG_DATA_INTERFACE extends BaseBean{
|
|
public final static Map<String, String> KEYS = new HashMap<String, String>();
|
private Map BEAN_VALUES = null;
|
|
static {
|
KEYS.put("id", "String");
|
KEYS.put("interfacekey", "String");
|
KEYS.put("interfacename", "String");
|
KEYS.put("systemid", "String");
|
KEYS.put("beiz", "String");
|
KEYS.put("interfaceurl", "String");
|
KEYS.put("inputdesc", "String");
|
KEYS.put("outputdesc", "String");
|
KEYS.put("type", "Integer");
|
}
|
public Map getColumnMap(){
|
return KEYS;
|
}
|
|
private String id;
|
private Boolean isSetted_id = false;;
|
|
private String interfacekey;
|
private Boolean isSetted_interfacekey = false;
|
private String interfacename;
|
private Boolean isSetted_interfacename = false;
|
private String systemid;
|
private Boolean isSetted_systemid = false;
|
private String beiz;
|
private Boolean isSetted_beiz = false;
|
private String interfaceurl;
|
private Boolean isSetted_interfaceurl = false;
|
private String inputdesc;
|
private Boolean isSetted_inputdesc = false;
|
private String outputdesc;
|
private Boolean isSetted_outputdesc = false;
|
private Integer type;
|
private Boolean isSetted_type = false;
|
|
private void initBeanValues(){
|
BEAN_VALUES = new HashMap<String, Object>();
|
BEAN_VALUES.put("id",id);
|
BEAN_VALUES.put("interfacekey", null);
|
BEAN_VALUES.put("interfacename", null);
|
BEAN_VALUES.put("systemid", null);
|
BEAN_VALUES.put("beiz", null);
|
BEAN_VALUES.put("interfaceurl", null);
|
BEAN_VALUES.put("inputdesc", null);
|
BEAN_VALUES.put("outputdesc", null);
|
BEAN_VALUES.put("type", null);
|
}
|
|
public CONFIG_DATA_INTERFACE() {
|
initBeanValues();
|
}
|
|
public CONFIG_DATA_INTERFACE(String id) {
|
super();
|
this.id = id;
|
initBeanValues();
|
BEAN_VALUES.put("id",id);
|
}
|
|
/**
|
* 获取ID
|
*/
|
public String getId() {
|
return this.id;
|
}
|
/**
|
* 设置ID
|
*/
|
public CONFIG_DATA_INTERFACE setId(String id) {
|
this.id = id;
|
this.isSetted_id = true;
|
BEAN_VALUES.put("id",id);
|
return this;
|
}
|
|
@Override
|
public String getUpdateSql() {
|
StringBuffer sBuffer = new StringBuffer("update CONFIG_DATA_INTERFACE set ");
|
if (isSetted_interfacekey) {
|
sBuffer.append("interfacekey=:interfacekey,");
|
}
|
if (isSetted_interfacename) {
|
sBuffer.append("interfacename=:interfacename,");
|
}
|
if (isSetted_systemid) {
|
sBuffer.append("systemid=:systemid,");
|
}
|
if (isSetted_beiz) {
|
sBuffer.append("beiz=:beiz,");
|
}
|
if (isSetted_interfaceurl) {
|
sBuffer.append("interfaceurl=:interfaceurl,");
|
}
|
if (isSetted_inputdesc) {
|
sBuffer.append("inputdesc=:inputdesc,");
|
}
|
if (isSetted_outputdesc) {
|
sBuffer.append("outputdesc=:outputdesc,");
|
}
|
if (isSetted_type) {
|
sBuffer.append("type=:type,");
|
}
|
String sql = sBuffer.toString();
|
return StringUtils.removeEnd(sql, ",") + " where id=:id";
|
}
|
|
|
@Override
|
public String getInsertSql() {
|
StringBuffer sBuffer = new StringBuffer("insert into CONFIG_DATA_INTERFACE(");
|
StringBuffer fileds = new StringBuffer("id,");
|
StringBuffer values = new StringBuffer(":id,");
|
fileds.append("interfacekey,");
|
values.append(":interfacekey,");
|
fileds.append("interfacename,");
|
values.append(":interfacename,");
|
fileds.append("systemid,");
|
values.append(":systemid,");
|
fileds.append("beiz,");
|
values.append(":beiz,");
|
fileds.append("interfaceurl,");
|
values.append(":interfaceurl,");
|
fileds.append("inputdesc,");
|
values.append(":inputdesc,");
|
fileds.append("outputdesc,");
|
values.append(":outputdesc,");
|
fileds.append("type,");
|
values.append(":type,");
|
sBuffer.append(StringUtils.removeEnd(fileds.toString(), ",") + ") values("+StringUtils.removeEnd(values.toString(), ",")+")");
|
return sBuffer.toString();
|
}
|
|
|
/**
|
* 获取接口标识(唯一性)<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getInterfacekey() {
|
return interfacekey;
|
}
|
/**
|
* 设置接口标识(唯一性)<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setInterfacekey(String interfacekey) {
|
this.interfacekey = interfacekey;
|
this.isSetted_interfacekey = true;
|
BEAN_VALUES.put("interfacekey",interfacekey);
|
return this;
|
}
|
/**
|
* 获取接口名称<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getInterfacename() {
|
return interfacename;
|
}
|
/**
|
* 设置接口名称<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setInterfacename(String interfacename) {
|
this.interfacename = interfacename;
|
this.isSetted_interfacename = true;
|
BEAN_VALUES.put("interfacename",interfacename);
|
return this;
|
}
|
/**
|
* 获取子系统编号<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getSystemid() {
|
return systemid;
|
}
|
/**
|
* 设置子系统编号<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setSystemid(String systemid) {
|
this.systemid = systemid;
|
this.isSetted_systemid = true;
|
BEAN_VALUES.put("systemid",systemid);
|
return this;
|
}
|
/**
|
* 获取接口说明<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getBeiz() {
|
return beiz;
|
}
|
/**
|
* 设置接口说明<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setBeiz(String beiz) {
|
this.beiz = beiz;
|
this.isSetted_beiz = true;
|
BEAN_VALUES.put("beiz",beiz);
|
return this;
|
}
|
/**
|
* 获取接口地址<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getInterfaceurl() {
|
return interfaceurl;
|
}
|
/**
|
* 设置接口地址<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setInterfaceurl(String interfaceurl) {
|
this.interfaceurl = interfaceurl;
|
this.isSetted_interfaceurl = true;
|
BEAN_VALUES.put("interfaceurl",interfaceurl);
|
return this;
|
}
|
/**
|
* 获取输入参数说明<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getInputdesc() {
|
return inputdesc;
|
}
|
/**
|
* 设置输入参数说明<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setInputdesc(String inputdesc) {
|
this.inputdesc = inputdesc;
|
this.isSetted_inputdesc = true;
|
BEAN_VALUES.put("inputdesc",inputdesc);
|
return this;
|
}
|
/**
|
* 获取输出参数说明<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public String getOutputdesc() {
|
return outputdesc;
|
}
|
/**
|
* 设置输出参数说明<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setOutputdesc(String outputdesc) {
|
this.outputdesc = outputdesc;
|
this.isSetted_outputdesc = true;
|
BEAN_VALUES.put("outputdesc",outputdesc);
|
return this;
|
}
|
/**
|
* 获取接口类型(1=查询类;2=修改类;3=查询修改类)<BR/>
|
* 䣺2014-57-21 hh:05
|
*/
|
public Integer getType() {
|
return type;
|
}
|
/**
|
* 设置接口类型(1=查询类;2=修改类;3=查询修改类)<BR/>
|
* 2014-57-21 hh:05
|
*/
|
public CONFIG_DATA_INTERFACE setType(Integer type) {
|
this.type = type;
|
this.isSetted_type = true;
|
BEAN_VALUES.put("type",type);
|
return this;
|
}
|
|
/**
|
* 使用ID删除Bean<BR/>
|
*/
|
public void deleteById() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("删除bean时ID不能为空");
|
}
|
dao.execute("delete from " + getTableName() + " where id = :id", BEAN_VALUES);
|
}
|
|
@Override
|
public CONFIG_DATA_INTERFACE getInstanceById() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("获取Bean时ID不能为空");
|
}
|
return dao.queryForBean("select * from " + getTableName() + " where id=:id", BEAN_VALUES, this);
|
}
|
|
public CONFIG_DATA_SUBSYSTEM getCONFIG_DATA_SUBSYSTEM() {
|
if(null == getSystemid()){
|
throw new RuntimeException("SYSTEMIDֵΪnull");
|
}
|
return new CONFIG_DATA_SUBSYSTEM(getSystemid()).getInstanceById();
|
//return dao.queryForBean("select * from config_data_subsystem where ID=:systemid", new CONFIG_DATA_SUBSYSTEM(this.getSystemid()));
|
}
|
|
|
@Override
|
public CONFIG_DATA_INTERFACE queryForBean() {
|
StringBuffer sBuffer = new StringBuffer("select * from CONFIG_DATA_INTERFACE where ");
|
if(isSetted_id){
|
sBuffer.append("id=:id and ");
|
}
|
if (isSetted_interfacekey) {
|
sBuffer.append("interfacekey=:interfacekey and ");
|
}
|
if (isSetted_interfacename) {
|
sBuffer.append("interfacename=:interfacename and ");
|
}
|
if (isSetted_systemid) {
|
sBuffer.append("systemid=:systemid and ");
|
}
|
if (isSetted_beiz) {
|
sBuffer.append("beiz=:beiz and ");
|
}
|
if (isSetted_interfaceurl) {
|
sBuffer.append("interfaceurl=:interfaceurl and ");
|
}
|
if (isSetted_inputdesc) {
|
sBuffer.append("inputdesc=:inputdesc and ");
|
}
|
if (isSetted_outputdesc) {
|
sBuffer.append("outputdesc=:outputdesc and ");
|
}
|
if (isSetted_type) {
|
sBuffer.append("type=:type and ");
|
}
|
String sql = sBuffer.toString();
|
sql = StringUtils.removeEnd(sql, " and ");
|
return dao.queryForBean(sql,this);
|
}
|
|
@Override
|
public String getTableName() {
|
return "CONFIG_DATA_INTERFACE";
|
}
|
|
|
public Map getBeanValues(){
|
return this.BEAN_VALUES;
|
}
|
|
@Override
|
public CONFIG_DATA_INTERFACE insert() {
|
if (StringUtils.isBlank(id)) {
|
this.setId(StringUtil.getUUID());
|
}
|
dao.execute(getInsertSql(),BEAN_VALUES);
|
return this;
|
}
|
|
@Override
|
public CONFIG_DATA_INTERFACE update() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("更新Bean时ID不能为空");
|
}
|
dao.execute(getUpdateSql(),BEAN_VALUES);
|
return this;
|
}
|
|
public CONFIG_DATA_INTERFACE insertOrUpdate(){
|
if (StringUtils.isNotBlank(id)) {
|
return update();
|
} else {
|
return insert();
|
}
|
}
|
|
/**
|
* 通过ID获取该条信息的Map结构
|
*/
|
public Map getBeanMapById() {
|
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("ID不能为空!");
|
}
|
|
return dao.queryForMap("select * from CONFIG_DATA_INTERFACE where id=:id",BEAN_VALUES);
|
}
|
|
public Object mapRow(ResultSet rs, int rownum) throws SQLException {
|
Object id = rs.getObject("ID");
|
this.setId(ConvertUtil.obj2Str(id));
|
BEAN_VALUES.put("id",id);
|
Object obj = null;
|
obj = rs.getObject("INTERFACEKEY");
|
BEAN_VALUES.put("interfacekey",obj);
|
this.setInterfacekey(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("INTERFACENAME");
|
BEAN_VALUES.put("interfacename",obj);
|
this.setInterfacename(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("SYSTEMID");
|
BEAN_VALUES.put("systemid",obj);
|
this.setSystemid(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("BEIZ");
|
BEAN_VALUES.put("beiz",obj);
|
this.setBeiz(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("INTERFACEURL");
|
BEAN_VALUES.put("interfaceurl",obj);
|
this.setInterfaceurl(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("INPUTDESC");
|
BEAN_VALUES.put("inputdesc",obj);
|
this.setInputdesc(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("OUTPUTDESC");
|
BEAN_VALUES.put("outputdesc",obj);
|
this.setOutputdesc(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("TYPE");
|
BEAN_VALUES.put("type",obj);
|
this.setType(ConvertUtil.obj2Integer(obj));
|
return this;
|
}
|
|
|
public String toString() {
|
StringBuffer sb = new StringBuffer("[");
|
for (Iterator iterator = KEYS.keySet().iterator(); iterator.hasNext();) {
|
String key = (String) iterator.next();
|
sb.append(key+"=" + BEAN_VALUES.get(key)+",");
|
}
|
sb.append("]");
|
return sb.toString();
|
}
|
|
public CONFIG_DATA_INTERFACE newInstance(){
|
return new CONFIG_DATA_INTERFACE();
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|