dorado 在页面展示表格【表格的实体类不和数据库中单一表关联】

本文介绍了如何实现Serializable的CheckOrder类,包括构造函数、getter和setter方法,以及重写toString、hashCode和equals方法。同时展示了如何通过SQL查询从数据库中获取数据并转换为CheckOrder对象列表。
摘要由CSDN通过智能技术生成

创建实体类

//实现Serializable ,有参无参,set,get,equal,toString,hashCode
import java.io.Serializable;
import java.math.BigDecimal;

public class CheckOrder implements Serializable {
	private String apiName;
	private Integer num;
	
	public CheckOrder() {
		super();
	}

	public CheckOrder(String apiName, Integer num) {
		super();
		this.apiName = apiName;
		this.num = num;
		
	}

	public String getApiName() {
		return apiName;
	}

	public void setApiName(String apiName) {
		this.apiName = apiName;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	

	@Override
	public String toString() {
		return "CheckOrder [apiName=" + apiName + ", num=" + num
				+  "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((apiName == null) ? 0 : apiName.hashCode());
		
		result = prime * result
				+ ((num == null) ? 0 : num.hashCode());
		
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CheckOrder other = (CheckOrder) obj;
		if (apiName == null) {
			if (other.apiName != null)
				return false;
		} else if (!apiName.equals(other.apiName))
			return false;
		
		if (num == null) {
			if (other.num != null)
				return false;
		} else if (!num.equals(other.num))
			return false;
		
		return true;
	}
	
	
}

后台

//集成到了HelpDao中,只需要helpDao.find即可
String sql="select api.name apiName,pm.num num "+ 
				"from papr "+ 
				"left join pm on papr.package_id=pm.id  "+ 
				"left join api on pm.api_id=api.id where api.id=1 and pm.num=10000 and papr.level=0";
SQLQuery q = s.createSQLQuery(sql);
q.addScalar("apiName",StandardBasicTypes.STRING);
q.addScalar("num",StandardBasicTypes.INTEGER);
q.setResultTransformer(Transformers.aliasToBean(Entity.class));
List<CheckOrder> list2 = q.list();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值