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 DSL_CONFIG_FILE 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("file_name", "String");
|
KEYS.put("file_path", "String");
|
KEYS.put("file_size", "String");
|
KEYS.put("file_format", "String");
|
KEYS.put("version_id", "String");
|
KEYS.put("ordernum", "Integer");
|
KEYS.put("file_note", "String");
|
KEYS.put("dsl_first_cate", "String");
|
KEYS.put("dsl_second_cate", "String");
|
KEYS.put("create_time", "Long");
|
KEYS.put("user_id", "String");
|
KEYS.put("user_name", "String");
|
KEYS.put("del_flag", "Integer");
|
}
|
public Map getColumnMap(){
|
return KEYS;
|
}
|
|
private String id;
|
private Boolean isSetted_id = false;;
|
|
private String file_name;
|
private Boolean isSetted_file_name = false;
|
private String file_path;
|
private Boolean isSetted_file_path = false;
|
private String file_size;
|
private Boolean isSetted_file_size = false;
|
private String file_format;
|
private Boolean isSetted_file_format = false;
|
private String version_id;
|
private Boolean isSetted_version_id = false;
|
private Integer ordernum;
|
private Boolean isSetted_ordernum = false;
|
private String file_note;
|
private Boolean isSetted_file_note = false;
|
private String dsl_first_cate;
|
private Boolean isSetted_dsl_first_cate = false;
|
private String dsl_second_cate;
|
private Boolean isSetted_dsl_second_cate = false;
|
private Long create_time;
|
private Boolean isSetted_create_time = false;
|
private String user_id;
|
private Boolean isSetted_user_id = false;
|
private String user_name;
|
private Boolean isSetted_user_name = false;
|
private Integer del_flag;
|
private Boolean isSetted_del_flag = false;
|
|
private void initBeanValues(){
|
BEAN_VALUES = new HashMap<String, Object>();
|
BEAN_VALUES.put("id",id);
|
BEAN_VALUES.put("file_name", null);
|
BEAN_VALUES.put("file_path", null);
|
BEAN_VALUES.put("file_size", null);
|
BEAN_VALUES.put("file_format", null);
|
BEAN_VALUES.put("version_id", null);
|
BEAN_VALUES.put("ordernum", null);
|
BEAN_VALUES.put("file_note", null);
|
BEAN_VALUES.put("dsl_first_cate", null);
|
BEAN_VALUES.put("dsl_second_cate", null);
|
BEAN_VALUES.put("create_time", null);
|
BEAN_VALUES.put("user_id", null);
|
BEAN_VALUES.put("user_name", null);
|
BEAN_VALUES.put("del_flag", null);
|
}
|
|
public DSL_CONFIG_FILE() {
|
initBeanValues();
|
}
|
|
public DSL_CONFIG_FILE(String id) {
|
super();
|
this.id = id;
|
initBeanValues();
|
BEAN_VALUES.put("id",id);
|
}
|
|
/**
|
* 获取ID
|
*/
|
public String getId() {
|
return this.id;
|
}
|
/**
|
* 设置ID
|
*/
|
public DSL_CONFIG_FILE 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 DSL_CONFIG_FILE set ");
|
if (isSetted_file_name) {
|
sBuffer.append("file_name=:file_name,");
|
}
|
if (isSetted_file_path) {
|
sBuffer.append("file_path=:file_path,");
|
}
|
if (isSetted_file_size) {
|
sBuffer.append("file_size=:file_size,");
|
}
|
if (isSetted_file_format) {
|
sBuffer.append("file_format=:file_format,");
|
}
|
if (isSetted_version_id) {
|
sBuffer.append("version_id=:version_id,");
|
}
|
if (isSetted_ordernum) {
|
sBuffer.append("ordernum=:ordernum,");
|
}
|
if (isSetted_file_note) {
|
sBuffer.append("file_note=:file_note,");
|
}
|
if (isSetted_dsl_first_cate) {
|
sBuffer.append("dsl_first_cate=:dsl_first_cate,");
|
}
|
if (isSetted_dsl_second_cate) {
|
sBuffer.append("dsl_second_cate=:dsl_second_cate,");
|
}
|
if (isSetted_create_time) {
|
sBuffer.append("create_time=:create_time,");
|
}
|
if (isSetted_user_id) {
|
sBuffer.append("user_id=:user_id,");
|
}
|
if (isSetted_user_name) {
|
sBuffer.append("user_name=:user_name,");
|
}
|
if (isSetted_del_flag) {
|
sBuffer.append("del_flag=:del_flag,");
|
}
|
String sql = sBuffer.toString();
|
return StringUtils.removeEnd(sql, ",") + " where id=:id";
|
}
|
|
|
@Override
|
public String getInsertSql() {
|
StringBuffer sBuffer = new StringBuffer("insert into DSL_CONFIG_FILE(");
|
StringBuffer fileds = new StringBuffer("id,");
|
StringBuffer values = new StringBuffer(":id,");
|
fileds.append("file_name,");
|
values.append(":file_name,");
|
fileds.append("file_path,");
|
values.append(":file_path,");
|
fileds.append("file_size,");
|
values.append(":file_size,");
|
fileds.append("file_format,");
|
values.append(":file_format,");
|
fileds.append("version_id,");
|
values.append(":version_id,");
|
fileds.append("ordernum,");
|
values.append(":ordernum,");
|
fileds.append("file_note,");
|
values.append(":file_note,");
|
fileds.append("dsl_first_cate,");
|
values.append(":dsl_first_cate,");
|
fileds.append("dsl_second_cate,");
|
values.append(":dsl_second_cate,");
|
fileds.append("create_time,");
|
values.append(":create_time,");
|
fileds.append("user_id,");
|
values.append(":user_id,");
|
fileds.append("user_name,");
|
values.append(":user_name,");
|
fileds.append("del_flag,");
|
values.append(":del_flag,");
|
sBuffer.append(StringUtils.removeEnd(fileds.toString(), ",") + ") values("+StringUtils.removeEnd(values.toString(), ",")+")");
|
return sBuffer.toString();
|
}
|
|
|
/**
|
* 获取文件名称<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getFile_name() {
|
return file_name;
|
}
|
/**
|
* 设置文件名称<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setFile_name(String file_name) {
|
this.file_name = file_name;
|
this.isSetted_file_name = true;
|
BEAN_VALUES.put("file_name",file_name);
|
return this;
|
}
|
/**
|
* 获取文件路径<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getFile_path() {
|
return file_path;
|
}
|
/**
|
* 设置文件路径<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setFile_path(String file_path) {
|
this.file_path = file_path;
|
this.isSetted_file_path = true;
|
BEAN_VALUES.put("file_path",file_path);
|
return this;
|
}
|
/**
|
* 获取文件大小<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getFile_size() {
|
return file_size;
|
}
|
/**
|
* 设置文件大小<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setFile_size(String file_size) {
|
this.file_size = file_size;
|
this.isSetted_file_size = true;
|
BEAN_VALUES.put("file_size",file_size);
|
return this;
|
}
|
/**
|
* 获取文件格式<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getFile_format() {
|
return file_format;
|
}
|
/**
|
* 设置文件格式<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setFile_format(String file_format) {
|
this.file_format = file_format;
|
this.isSetted_file_format = true;
|
BEAN_VALUES.put("file_format",file_format);
|
return this;
|
}
|
/**
|
* 获取版本号<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getVersion_id() {
|
return version_id;
|
}
|
/**
|
* 设置版本号<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setVersion_id(String version_id) {
|
this.version_id = version_id;
|
this.isSetted_version_id = true;
|
BEAN_VALUES.put("version_id",version_id);
|
return this;
|
}
|
/**
|
* 获取顺序号<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public Integer getOrdernum() {
|
return ordernum;
|
}
|
/**
|
* 设置顺序号<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setOrdernum(Integer ordernum) {
|
this.ordernum = ordernum;
|
this.isSetted_ordernum = true;
|
BEAN_VALUES.put("ordernum",ordernum);
|
return this;
|
}
|
/**
|
* 获取文件备注<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getFile_note() {
|
return file_note;
|
}
|
/**
|
* 设置文件备注<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setFile_note(String file_note) {
|
this.file_note = file_note;
|
this.isSetted_file_note = true;
|
BEAN_VALUES.put("file_note",file_note);
|
return this;
|
}
|
/**
|
* 获取配置一级分类<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getDsl_first_cate() {
|
return dsl_first_cate;
|
}
|
/**
|
* 设置配置一级分类<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setDsl_first_cate(String dsl_first_cate) {
|
this.dsl_first_cate = dsl_first_cate;
|
this.isSetted_dsl_first_cate = true;
|
BEAN_VALUES.put("dsl_first_cate",dsl_first_cate);
|
return this;
|
}
|
/**
|
* 获取DSL配置二级分类<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getDsl_second_cate() {
|
return dsl_second_cate;
|
}
|
/**
|
* 设置DSL配置二级分类<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setDsl_second_cate(String dsl_second_cate) {
|
this.dsl_second_cate = dsl_second_cate;
|
this.isSetted_dsl_second_cate = true;
|
BEAN_VALUES.put("dsl_second_cate",dsl_second_cate);
|
return this;
|
}
|
/**
|
* 获取创建时间<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public Long getCreate_time() {
|
return create_time;
|
}
|
/**
|
* 设置创建时间<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setCreate_time(Long create_time) {
|
this.create_time = create_time;
|
this.isSetted_create_time = true;
|
BEAN_VALUES.put("create_time",create_time);
|
return this;
|
}
|
/**
|
* 获取上传者<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getUser_id() {
|
return user_id;
|
}
|
/**
|
* 设置上传者<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setUser_id(String user_id) {
|
this.user_id = user_id;
|
this.isSetted_user_id = true;
|
BEAN_VALUES.put("user_id",user_id);
|
return this;
|
}
|
/**
|
* 获取上传者名称<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public String getUser_name() {
|
return user_name;
|
}
|
/**
|
* 设置上传者名称<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setUser_name(String user_name) {
|
this.user_name = user_name;
|
this.isSetted_user_name = true;
|
BEAN_VALUES.put("user_name",user_name);
|
return this;
|
}
|
/**
|
* 获取删除标识【1:未删除 2:已删除】<BR/>
|
* 䣺2016-10-09 hh:03
|
*/
|
public Integer getDel_flag() {
|
return del_flag;
|
}
|
/**
|
* 设置删除标识【1:未删除 2:已删除】<BR/>
|
* 2016-10-09 hh:03
|
*/
|
public DSL_CONFIG_FILE setDel_flag(Integer del_flag) {
|
this.del_flag = del_flag;
|
this.isSetted_del_flag = true;
|
BEAN_VALUES.put("del_flag",del_flag);
|
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 DSL_CONFIG_FILE getInstanceById() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("获取Bean时ID不能为空");
|
}
|
return dao.queryForBean("select * from " + getTableName() + " where id=:id", BEAN_VALUES, this);
|
}
|
|
|
public List<DSL_CONFIG_FILE_CHANGE_DETAIL> getDSL_CONFIG_FILE_CHANGE_DETAILList() {
|
if(null == getId()){
|
throw new RuntimeException("IDֵΪnull");
|
}
|
return dao.queryForList("select * from dsl_config_file_change_detail where FILE_ID=:file_id",this);
|
}
|
|
@Override
|
public DSL_CONFIG_FILE queryForBean() {
|
StringBuffer sBuffer = new StringBuffer("select * from DSL_CONFIG_FILE where ");
|
if(isSetted_id){
|
sBuffer.append("id=:id and ");
|
}
|
if (isSetted_file_name) {
|
sBuffer.append("file_name=:file_name and ");
|
}
|
if (isSetted_file_path) {
|
sBuffer.append("file_path=:file_path and ");
|
}
|
if (isSetted_file_size) {
|
sBuffer.append("file_size=:file_size and ");
|
}
|
if (isSetted_file_format) {
|
sBuffer.append("file_format=:file_format and ");
|
}
|
if (isSetted_version_id) {
|
sBuffer.append("version_id=:version_id and ");
|
}
|
if (isSetted_ordernum) {
|
sBuffer.append("ordernum=:ordernum and ");
|
}
|
if (isSetted_file_note) {
|
sBuffer.append("file_note=:file_note and ");
|
}
|
if (isSetted_dsl_first_cate) {
|
sBuffer.append("dsl_first_cate=:dsl_first_cate and ");
|
}
|
if (isSetted_dsl_second_cate) {
|
sBuffer.append("dsl_second_cate=:dsl_second_cate and ");
|
}
|
if (isSetted_create_time) {
|
sBuffer.append("create_time=:create_time and ");
|
}
|
if (isSetted_user_id) {
|
sBuffer.append("user_id=:user_id and ");
|
}
|
if (isSetted_user_name) {
|
sBuffer.append("user_name=:user_name and ");
|
}
|
if (isSetted_del_flag) {
|
sBuffer.append("del_flag=:del_flag and ");
|
}
|
String sql = sBuffer.toString();
|
sql = StringUtils.removeEnd(sql, " and ");
|
return dao.queryForBean(sql,this);
|
}
|
|
@Override
|
public String getTableName() {
|
return "DSL_CONFIG_FILE";
|
}
|
|
|
public Map getBeanValues(){
|
return this.BEAN_VALUES;
|
}
|
|
@Override
|
public DSL_CONFIG_FILE insert() {
|
if (StringUtils.isBlank(id)) {
|
this.setId(StringUtil.getUUID());
|
}
|
dao.execute(getInsertSql(),BEAN_VALUES);
|
return this;
|
}
|
|
@Override
|
public DSL_CONFIG_FILE update() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("更新Bean时ID不能为空");
|
}
|
dao.execute(getUpdateSql(),BEAN_VALUES);
|
return this;
|
}
|
|
public DSL_CONFIG_FILE 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 DSL_CONFIG_FILE 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("FILE_NAME");
|
BEAN_VALUES.put("file_name",obj);
|
this.setFile_name(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("FILE_PATH");
|
BEAN_VALUES.put("file_path",obj);
|
this.setFile_path(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("FILE_SIZE");
|
BEAN_VALUES.put("file_size",obj);
|
this.setFile_size(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("FILE_FORMAT");
|
BEAN_VALUES.put("file_format",obj);
|
this.setFile_format(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("VERSION_ID");
|
BEAN_VALUES.put("version_id",obj);
|
this.setVersion_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("ORDERNUM");
|
BEAN_VALUES.put("ordernum",obj);
|
this.setOrdernum(ConvertUtil.obj2Integer(obj));
|
obj = rs.getObject("FILE_NOTE");
|
BEAN_VALUES.put("file_note",obj);
|
this.setFile_note(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("DSL_FIRST_CATE");
|
BEAN_VALUES.put("dsl_first_cate",obj);
|
this.setDsl_first_cate(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("DSL_SECOND_CATE");
|
BEAN_VALUES.put("dsl_second_cate",obj);
|
this.setDsl_second_cate(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("CREATE_TIME");
|
BEAN_VALUES.put("create_time",obj);
|
this.setCreate_time(ConvertUtil.obj2Long(obj));
|
obj = rs.getObject("USER_ID");
|
BEAN_VALUES.put("user_id",obj);
|
this.setUser_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("USER_NAME");
|
BEAN_VALUES.put("user_name",obj);
|
this.setUser_name(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("DEL_FLAG");
|
BEAN_VALUES.put("del_flag",obj);
|
this.setDel_flag(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 DSL_CONFIG_FILE newInstance(){
|
return new DSL_CONFIG_FILE();
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|