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 SPARE_PART 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("cate_id", "String");
|
KEYS.put("link_delivery_id", "String");
|
KEYS.put("link_storage_id", "String");
|
KEYS.put("link_apply_id", "String");
|
KEYS.put("name", "String");
|
KEYS.put("entity_no", "String");
|
KEYS.put("asset_no", "String");
|
KEYS.put("model_no", "String");
|
KEYS.put("location", "String");
|
KEYS.put("cost_price", "Double");
|
KEYS.put("sale_price", "Double");
|
KEYS.put("supplier_id", "String");
|
KEYS.put("supplier_name", "String");
|
KEYS.put("warranty_start", "Long");
|
KEYS.put("warranty_cycle", "Integer");
|
KEYS.put("warranty_end", "Long");
|
KEYS.put("create_id", "String");
|
KEYS.put("create_name", "String");
|
KEYS.put("gmt_create", "Long");
|
KEYS.put("modified_id", "String");
|
KEYS.put("modified_name", "String");
|
KEYS.put("gmt_modified", "Long");
|
KEYS.put("state", "Integer");
|
}
|
public Map getColumnMap(){
|
return KEYS;
|
}
|
|
private String id;
|
private Boolean isSetted_id = false;;
|
|
private String cate_id;
|
private Boolean isSetted_cate_id = false;
|
private String link_delivery_id;
|
private Boolean isSetted_link_delivery_id = false;
|
private String link_storage_id;
|
private Boolean isSetted_link_storage_id = false;
|
private String link_apply_id;
|
private Boolean isSetted_link_apply_id = false;
|
private String name;
|
private Boolean isSetted_name = false;
|
private String entity_no;
|
private Boolean isSetted_entity_no = false;
|
private String asset_no;
|
private Boolean isSetted_asset_no = false;
|
private String model_no;
|
private Boolean isSetted_model_no = false;
|
private String location;
|
private Boolean isSetted_location = false;
|
private Double cost_price;
|
private Boolean isSetted_cost_price = false;
|
private Double sale_price;
|
private Boolean isSetted_sale_price = false;
|
private String supplier_id;
|
private Boolean isSetted_supplier_id = false;
|
private String supplier_name;
|
private Boolean isSetted_supplier_name = false;
|
private Long warranty_start;
|
private Boolean isSetted_warranty_start = false;
|
private Integer warranty_cycle;
|
private Boolean isSetted_warranty_cycle = false;
|
private Long warranty_end;
|
private Boolean isSetted_warranty_end = false;
|
private String create_id;
|
private Boolean isSetted_create_id = false;
|
private String create_name;
|
private Boolean isSetted_create_name = false;
|
private Long gmt_create;
|
private Boolean isSetted_gmt_create = false;
|
private String modified_id;
|
private Boolean isSetted_modified_id = false;
|
private String modified_name;
|
private Boolean isSetted_modified_name = false;
|
private Long gmt_modified;
|
private Boolean isSetted_gmt_modified = false;
|
private Integer state;
|
private Boolean isSetted_state = false;
|
|
private void initBeanValues(){
|
BEAN_VALUES = new HashMap<String, Object>();
|
BEAN_VALUES.put("id",id);
|
BEAN_VALUES.put("cate_id", null);
|
BEAN_VALUES.put("link_delivery_id", null);
|
BEAN_VALUES.put("link_storage_id", null);
|
BEAN_VALUES.put("link_apply_id", null);
|
BEAN_VALUES.put("name", null);
|
BEAN_VALUES.put("entity_no", null);
|
BEAN_VALUES.put("asset_no", null);
|
BEAN_VALUES.put("model_no", null);
|
BEAN_VALUES.put("location", null);
|
BEAN_VALUES.put("cost_price", null);
|
BEAN_VALUES.put("sale_price", null);
|
BEAN_VALUES.put("supplier_id", null);
|
BEAN_VALUES.put("supplier_name", null);
|
BEAN_VALUES.put("warranty_start", null);
|
BEAN_VALUES.put("warranty_cycle", null);
|
BEAN_VALUES.put("warranty_end", null);
|
BEAN_VALUES.put("create_id", null);
|
BEAN_VALUES.put("create_name", null);
|
BEAN_VALUES.put("gmt_create", null);
|
BEAN_VALUES.put("modified_id", null);
|
BEAN_VALUES.put("modified_name", null);
|
BEAN_VALUES.put("gmt_modified", null);
|
BEAN_VALUES.put("state", null);
|
}
|
|
public SPARE_PART() {
|
initBeanValues();
|
}
|
|
public SPARE_PART(String id) {
|
super();
|
this.id = id;
|
initBeanValues();
|
BEAN_VALUES.put("id",id);
|
}
|
|
/**
|
* 获取ID
|
*/
|
public String getId() {
|
return this.id;
|
}
|
/**
|
* 设置ID
|
*/
|
public SPARE_PART 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 SPARE_PART set ");
|
if (isSetted_cate_id) {
|
sBuffer.append("cate_id=:cate_id,");
|
}
|
if (isSetted_link_delivery_id) {
|
sBuffer.append("link_delivery_id=:link_delivery_id,");
|
}
|
if (isSetted_link_storage_id) {
|
sBuffer.append("link_storage_id=:link_storage_id,");
|
}
|
if (isSetted_link_apply_id) {
|
sBuffer.append("link_apply_id=:link_apply_id,");
|
}
|
if (isSetted_name) {
|
sBuffer.append("name=:name,");
|
}
|
if (isSetted_entity_no) {
|
sBuffer.append("entity_no=:entity_no,");
|
}
|
if (isSetted_asset_no) {
|
sBuffer.append("asset_no=:asset_no,");
|
}
|
if (isSetted_model_no) {
|
sBuffer.append("model_no=:model_no,");
|
}
|
if (isSetted_location) {
|
sBuffer.append("location=:location,");
|
}
|
if (isSetted_cost_price) {
|
sBuffer.append("cost_price=:cost_price,");
|
}
|
if (isSetted_sale_price) {
|
sBuffer.append("sale_price=:sale_price,");
|
}
|
if (isSetted_supplier_id) {
|
sBuffer.append("supplier_id=:supplier_id,");
|
}
|
if (isSetted_supplier_name) {
|
sBuffer.append("supplier_name=:supplier_name,");
|
}
|
if (isSetted_warranty_start) {
|
sBuffer.append("warranty_start=:warranty_start,");
|
}
|
if (isSetted_warranty_cycle) {
|
sBuffer.append("warranty_cycle=:warranty_cycle,");
|
}
|
if (isSetted_warranty_end) {
|
sBuffer.append("warranty_end=:warranty_end,");
|
}
|
if (isSetted_create_id) {
|
sBuffer.append("create_id=:create_id,");
|
}
|
if (isSetted_create_name) {
|
sBuffer.append("create_name=:create_name,");
|
}
|
if (isSetted_gmt_create) {
|
sBuffer.append("gmt_create=:gmt_create,");
|
}
|
if (isSetted_modified_id) {
|
sBuffer.append("modified_id=:modified_id,");
|
}
|
if (isSetted_modified_name) {
|
sBuffer.append("modified_name=:modified_name,");
|
}
|
if (isSetted_gmt_modified) {
|
sBuffer.append("gmt_modified=:gmt_modified,");
|
}
|
if (isSetted_state) {
|
sBuffer.append("state=:state,");
|
}
|
String sql = sBuffer.toString();
|
return StringUtils.removeEnd(sql, ",") + " where id=:id";
|
}
|
|
|
@Override
|
public String getInsertSql() {
|
StringBuffer sBuffer = new StringBuffer("insert into SPARE_PART(");
|
StringBuffer fileds = new StringBuffer("id,");
|
StringBuffer values = new StringBuffer(":id,");
|
fileds.append("cate_id,");
|
values.append(":cate_id,");
|
fileds.append("link_delivery_id,");
|
values.append(":link_delivery_id,");
|
fileds.append("link_storage_id,");
|
values.append(":link_storage_id,");
|
fileds.append("link_apply_id,");
|
values.append(":link_apply_id,");
|
fileds.append("name,");
|
values.append(":name,");
|
fileds.append("entity_no,");
|
values.append(":entity_no,");
|
fileds.append("asset_no,");
|
values.append(":asset_no,");
|
fileds.append("model_no,");
|
values.append(":model_no,");
|
fileds.append("location,");
|
values.append(":location,");
|
fileds.append("cost_price,");
|
values.append(":cost_price,");
|
fileds.append("sale_price,");
|
values.append(":sale_price,");
|
fileds.append("supplier_id,");
|
values.append(":supplier_id,");
|
fileds.append("supplier_name,");
|
values.append(":supplier_name,");
|
fileds.append("warranty_start,");
|
values.append(":warranty_start,");
|
fileds.append("warranty_cycle,");
|
values.append(":warranty_cycle,");
|
fileds.append("warranty_end,");
|
values.append(":warranty_end,");
|
fileds.append("create_id,");
|
values.append(":create_id,");
|
fileds.append("create_name,");
|
values.append(":create_name,");
|
fileds.append("gmt_create,");
|
values.append(":gmt_create,");
|
fileds.append("modified_id,");
|
values.append(":modified_id,");
|
fileds.append("modified_name,");
|
values.append(":modified_name,");
|
fileds.append("gmt_modified,");
|
values.append(":gmt_modified,");
|
fileds.append("state,");
|
values.append(":state,");
|
sBuffer.append(StringUtils.removeEnd(fileds.toString(), ",") + ") values("+StringUtils.removeEnd(values.toString(), ",")+")");
|
return sBuffer.toString();
|
}
|
|
|
/**
|
* 获取分类ID(三级)<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getCate_id() {
|
return cate_id;
|
}
|
/**
|
* 设置分类ID(三级)<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setCate_id(String cate_id) {
|
this.cate_id = cate_id;
|
this.isSetted_cate_id = true;
|
BEAN_VALUES.put("cate_id",cate_id);
|
return this;
|
}
|
/**
|
* 获取关联出库工单ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getLink_delivery_id() {
|
return link_delivery_id;
|
}
|
/**
|
* 设置关联出库工单ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setLink_delivery_id(String link_delivery_id) {
|
this.link_delivery_id = link_delivery_id;
|
this.isSetted_link_delivery_id = true;
|
BEAN_VALUES.put("link_delivery_id",link_delivery_id);
|
return this;
|
}
|
/**
|
* 获取关联入库工单ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getLink_storage_id() {
|
return link_storage_id;
|
}
|
/**
|
* 设置关联入库工单ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setLink_storage_id(String link_storage_id) {
|
this.link_storage_id = link_storage_id;
|
this.isSetted_link_storage_id = true;
|
BEAN_VALUES.put("link_storage_id",link_storage_id);
|
return this;
|
}
|
/**
|
* 获取关联备件申请工单ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getLink_apply_id() {
|
return link_apply_id;
|
}
|
/**
|
* 设置关联备件申请工单ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setLink_apply_id(String link_apply_id) {
|
this.link_apply_id = link_apply_id;
|
this.isSetted_link_apply_id = true;
|
BEAN_VALUES.put("link_apply_id",link_apply_id);
|
return this;
|
}
|
/**
|
* 获取备件名称<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getName() {
|
return name;
|
}
|
/**
|
* 设置备件名称<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setName(String name) {
|
this.name = name;
|
this.isSetted_name = true;
|
BEAN_VALUES.put("name",name);
|
return this;
|
}
|
/**
|
* 获取实物编码<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getEntity_no() {
|
return entity_no;
|
}
|
/**
|
* 设置实物编码<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setEntity_no(String entity_no) {
|
this.entity_no = entity_no;
|
this.isSetted_entity_no = true;
|
BEAN_VALUES.put("entity_no",entity_no);
|
return this;
|
}
|
/**
|
* 获取资产编码<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getAsset_no() {
|
return asset_no;
|
}
|
/**
|
* 设置资产编码<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setAsset_no(String asset_no) {
|
this.asset_no = asset_no;
|
this.isSetted_asset_no = true;
|
BEAN_VALUES.put("asset_no",asset_no);
|
return this;
|
}
|
/**
|
* 获取型号<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getModel_no() {
|
return model_no;
|
}
|
/**
|
* 设置型号<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setModel_no(String model_no) {
|
this.model_no = model_no;
|
this.isSetted_model_no = true;
|
BEAN_VALUES.put("model_no",model_no);
|
return this;
|
}
|
/**
|
* 获取货位<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getLocation() {
|
return location;
|
}
|
/**
|
* 设置货位<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setLocation(String location) {
|
this.location = location;
|
this.isSetted_location = true;
|
BEAN_VALUES.put("location",location);
|
return this;
|
}
|
/**
|
* 获取成本价<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Double getCost_price() {
|
return cost_price;
|
}
|
/**
|
* 设置成本价<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setCost_price(Double cost_price) {
|
this.cost_price = cost_price;
|
this.isSetted_cost_price = true;
|
BEAN_VALUES.put("cost_price",cost_price);
|
return this;
|
}
|
/**
|
* 获取销售价<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Double getSale_price() {
|
return sale_price;
|
}
|
/**
|
* 设置销售价<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setSale_price(Double sale_price) {
|
this.sale_price = sale_price;
|
this.isSetted_sale_price = true;
|
BEAN_VALUES.put("sale_price",sale_price);
|
return this;
|
}
|
/**
|
* 获取供应商ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getSupplier_id() {
|
return supplier_id;
|
}
|
/**
|
* 设置供应商ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setSupplier_id(String supplier_id) {
|
this.supplier_id = supplier_id;
|
this.isSetted_supplier_id = true;
|
BEAN_VALUES.put("supplier_id",supplier_id);
|
return this;
|
}
|
/**
|
* 获取供应商<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getSupplier_name() {
|
return supplier_name;
|
}
|
/**
|
* 设置供应商<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setSupplier_name(String supplier_name) {
|
this.supplier_name = supplier_name;
|
this.isSetted_supplier_name = true;
|
BEAN_VALUES.put("supplier_name",supplier_name);
|
return this;
|
}
|
/**
|
* 获取起保日期<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Long getWarranty_start() {
|
return warranty_start;
|
}
|
/**
|
* 设置起保日期<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setWarranty_start(Long warranty_start) {
|
this.warranty_start = warranty_start;
|
this.isSetted_warranty_start = true;
|
BEAN_VALUES.put("warranty_start",warranty_start);
|
return this;
|
}
|
/**
|
* 获取保质周期【天】<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Integer getWarranty_cycle() {
|
return warranty_cycle;
|
}
|
/**
|
* 设置保质周期【天】<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setWarranty_cycle(Integer warranty_cycle) {
|
this.warranty_cycle = warranty_cycle;
|
this.isSetted_warranty_cycle = true;
|
BEAN_VALUES.put("warranty_cycle",warranty_cycle);
|
return this;
|
}
|
/**
|
* 获取出保日期<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Long getWarranty_end() {
|
return warranty_end;
|
}
|
/**
|
* 设置出保日期<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setWarranty_end(Long warranty_end) {
|
this.warranty_end = warranty_end;
|
this.isSetted_warranty_end = true;
|
BEAN_VALUES.put("warranty_end",warranty_end);
|
return this;
|
}
|
/**
|
* 获取创建人ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getCreate_id() {
|
return create_id;
|
}
|
/**
|
* 设置创建人ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setCreate_id(String create_id) {
|
this.create_id = create_id;
|
this.isSetted_create_id = true;
|
BEAN_VALUES.put("create_id",create_id);
|
return this;
|
}
|
/**
|
* 获取创建人<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getCreate_name() {
|
return create_name;
|
}
|
/**
|
* 设置创建人<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setCreate_name(String create_name) {
|
this.create_name = create_name;
|
this.isSetted_create_name = true;
|
BEAN_VALUES.put("create_name",create_name);
|
return this;
|
}
|
/**
|
* 获取创建时间<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Long getGmt_create() {
|
return gmt_create;
|
}
|
/**
|
* 设置创建时间<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setGmt_create(Long gmt_create) {
|
this.gmt_create = gmt_create;
|
this.isSetted_gmt_create = true;
|
BEAN_VALUES.put("gmt_create",gmt_create);
|
return this;
|
}
|
/**
|
* 获取修改人ID<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getModified_id() {
|
return modified_id;
|
}
|
/**
|
* 设置修改人ID<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setModified_id(String modified_id) {
|
this.modified_id = modified_id;
|
this.isSetted_modified_id = true;
|
BEAN_VALUES.put("modified_id",modified_id);
|
return this;
|
}
|
/**
|
* 获取修改人<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public String getModified_name() {
|
return modified_name;
|
}
|
/**
|
* 设置修改人<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setModified_name(String modified_name) {
|
this.modified_name = modified_name;
|
this.isSetted_modified_name = true;
|
BEAN_VALUES.put("modified_name",modified_name);
|
return this;
|
}
|
/**
|
* 获取修改时间<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Long getGmt_modified() {
|
return gmt_modified;
|
}
|
/**
|
* 设置修改时间<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setGmt_modified(Long gmt_modified) {
|
this.gmt_modified = gmt_modified;
|
this.isSetted_gmt_modified = true;
|
BEAN_VALUES.put("gmt_modified",gmt_modified);
|
return this;
|
}
|
/**
|
* 获取状态【0 删除,1正常 2 废弃 3 已出库】<BR/>
|
* 䣺2017-30-16 hh:05
|
*/
|
public Integer getState() {
|
return state;
|
}
|
/**
|
* 设置状态【0 删除,1正常 2 废弃 3 已出库】<BR/>
|
* 2017-30-16 hh:05
|
*/
|
public SPARE_PART setState(Integer state) {
|
this.state = state;
|
this.isSetted_state = true;
|
BEAN_VALUES.put("state",state);
|
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 SPARE_PART getInstanceById() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("获取Bean时ID不能为空");
|
}
|
return dao.queryForBean("select * from " + getTableName() + " where id=:id", BEAN_VALUES, this);
|
}
|
|
|
|
@Override
|
public SPARE_PART queryForBean() {
|
StringBuffer sBuffer = new StringBuffer("select * from SPARE_PART where ");
|
if(isSetted_id){
|
sBuffer.append("id=:id and ");
|
}
|
if (isSetted_cate_id) {
|
sBuffer.append("cate_id=:cate_id and ");
|
}
|
if (isSetted_link_delivery_id) {
|
sBuffer.append("link_delivery_id=:link_delivery_id and ");
|
}
|
if (isSetted_link_storage_id) {
|
sBuffer.append("link_storage_id=:link_storage_id and ");
|
}
|
if (isSetted_link_apply_id) {
|
sBuffer.append("link_apply_id=:link_apply_id and ");
|
}
|
if (isSetted_name) {
|
sBuffer.append("name=:name and ");
|
}
|
if (isSetted_entity_no) {
|
sBuffer.append("entity_no=:entity_no and ");
|
}
|
if (isSetted_asset_no) {
|
sBuffer.append("asset_no=:asset_no and ");
|
}
|
if (isSetted_model_no) {
|
sBuffer.append("model_no=:model_no and ");
|
}
|
if (isSetted_location) {
|
sBuffer.append("location=:location and ");
|
}
|
if (isSetted_cost_price) {
|
sBuffer.append("cost_price=:cost_price and ");
|
}
|
if (isSetted_sale_price) {
|
sBuffer.append("sale_price=:sale_price and ");
|
}
|
if (isSetted_supplier_id) {
|
sBuffer.append("supplier_id=:supplier_id and ");
|
}
|
if (isSetted_supplier_name) {
|
sBuffer.append("supplier_name=:supplier_name and ");
|
}
|
if (isSetted_warranty_start) {
|
sBuffer.append("warranty_start=:warranty_start and ");
|
}
|
if (isSetted_warranty_cycle) {
|
sBuffer.append("warranty_cycle=:warranty_cycle and ");
|
}
|
if (isSetted_warranty_end) {
|
sBuffer.append("warranty_end=:warranty_end and ");
|
}
|
if (isSetted_create_id) {
|
sBuffer.append("create_id=:create_id and ");
|
}
|
if (isSetted_create_name) {
|
sBuffer.append("create_name=:create_name and ");
|
}
|
if (isSetted_gmt_create) {
|
sBuffer.append("gmt_create=:gmt_create and ");
|
}
|
if (isSetted_modified_id) {
|
sBuffer.append("modified_id=:modified_id and ");
|
}
|
if (isSetted_modified_name) {
|
sBuffer.append("modified_name=:modified_name and ");
|
}
|
if (isSetted_gmt_modified) {
|
sBuffer.append("gmt_modified=:gmt_modified and ");
|
}
|
if (isSetted_state) {
|
sBuffer.append("state=:state and ");
|
}
|
String sql = sBuffer.toString();
|
sql = StringUtils.removeEnd(sql, " and ");
|
return dao.queryForBean(sql,this);
|
}
|
|
@Override
|
public String getTableName() {
|
return "SPARE_PART";
|
}
|
|
|
public Map getBeanValues(){
|
return this.BEAN_VALUES;
|
}
|
|
@Override
|
public SPARE_PART insert() {
|
if (StringUtils.isBlank(id)) {
|
this.setId(StringUtil.getUUID());
|
}
|
dao.execute(getInsertSql(),BEAN_VALUES);
|
return this;
|
}
|
|
@Override
|
public SPARE_PART update() {
|
if (StringUtils.isBlank(id)) {
|
throw new RuntimeException("更新Bean时ID不能为空");
|
}
|
dao.execute(getUpdateSql(),BEAN_VALUES);
|
return this;
|
}
|
|
public SPARE_PART 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 SPARE_PART 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("CATE_ID");
|
BEAN_VALUES.put("cate_id",obj);
|
this.setCate_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("LINK_DELIVERY_ID");
|
BEAN_VALUES.put("link_delivery_id",obj);
|
this.setLink_delivery_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("LINK_STORAGE_ID");
|
BEAN_VALUES.put("link_storage_id",obj);
|
this.setLink_storage_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("LINK_APPLY_ID");
|
BEAN_VALUES.put("link_apply_id",obj);
|
this.setLink_apply_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("NAME");
|
BEAN_VALUES.put("name",obj);
|
this.setName(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("ENTITY_NO");
|
BEAN_VALUES.put("entity_no",obj);
|
this.setEntity_no(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("ASSET_NO");
|
BEAN_VALUES.put("asset_no",obj);
|
this.setAsset_no(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("MODEL_NO");
|
BEAN_VALUES.put("model_no",obj);
|
this.setModel_no(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("LOCATION");
|
BEAN_VALUES.put("location",obj);
|
this.setLocation(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("COST_PRICE");
|
BEAN_VALUES.put("cost_price",obj);
|
this.setCost_price(ConvertUtil.obj2Double(obj));
|
obj = rs.getObject("SALE_PRICE");
|
BEAN_VALUES.put("sale_price",obj);
|
this.setSale_price(ConvertUtil.obj2Double(obj));
|
obj = rs.getObject("SUPPLIER_ID");
|
BEAN_VALUES.put("supplier_id",obj);
|
this.setSupplier_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("SUPPLIER_NAME");
|
BEAN_VALUES.put("supplier_name",obj);
|
this.setSupplier_name(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("WARRANTY_START");
|
BEAN_VALUES.put("warranty_start",obj);
|
this.setWarranty_start(ConvertUtil.obj2Long(obj));
|
obj = rs.getObject("WARRANTY_CYCLE");
|
BEAN_VALUES.put("warranty_cycle",obj);
|
this.setWarranty_cycle(ConvertUtil.obj2Integer(obj));
|
obj = rs.getObject("WARRANTY_END");
|
BEAN_VALUES.put("warranty_end",obj);
|
this.setWarranty_end(ConvertUtil.obj2Long(obj));
|
obj = rs.getObject("CREATE_ID");
|
BEAN_VALUES.put("create_id",obj);
|
this.setCreate_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("CREATE_NAME");
|
BEAN_VALUES.put("create_name",obj);
|
this.setCreate_name(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("GMT_CREATE");
|
BEAN_VALUES.put("gmt_create",obj);
|
this.setGmt_create(ConvertUtil.obj2Long(obj));
|
obj = rs.getObject("MODIFIED_ID");
|
BEAN_VALUES.put("modified_id",obj);
|
this.setModified_id(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("MODIFIED_NAME");
|
BEAN_VALUES.put("modified_name",obj);
|
this.setModified_name(ConvertUtil.obj2Str(obj));
|
obj = rs.getObject("GMT_MODIFIED");
|
BEAN_VALUES.put("gmt_modified",obj);
|
this.setGmt_modified(ConvertUtil.obj2Long(obj));
|
obj = rs.getObject("STATE");
|
BEAN_VALUES.put("state",obj);
|
this.setState(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 SPARE_PART newInstance(){
|
return new SPARE_PART();
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|