select by id
来源:互联网 发布:淘宝发布销售属性错误 编辑:程序博客网 时间:2024/05/29 09:16
@Override
public Device selectById(Serializable id) {
DetachedCriteriaBuilder query = DetachedCriteriaBuilder.instance(Device.class, "de");
query.leftJoin("de.classroom.city", "city");
query.leftJoin("de.classroom", "classroom");
query.addEq("de.id", id);
query.setProjection(Projections.projectionList().add(Projections.property("de.id"), "id")
.add(Projections.property("de.partNumber"), "partNumber").add(Projections.property("de.description"), "description")
.add(Projections.property("de.qty"), "qty").add(Projections.property("de.un"), "un")
.add(Projections.property("de.location"), "location").add(Projections.property("de.modality"), "modality")
.add(Projections.property("de.pts"), "pts").add(Projections.property("de.status"), "status")
.add(Projections.property("de.remark"), "remark").add(Projections.property("city.cityName"), "cityName")
.add(Projections.property("classroom.code"), "labName").add(Projections.property("de.caliBration"), "caliBration")
.add(Projections.property("de.system"),"system").add(Projections.property("de.labId"),"labId")
);
query.getDetachedCriteria().setResultTransformer(new AliasToBeanResultTransformer(Device.class));
List<Device> devices = this.select(query);
return CollectionUtils.isNotEmpty(devices) ? devices.get(0) : null;
}
public Device selectById(Serializable id) {
DetachedCriteriaBuilder query = DetachedCriteriaBuilder.instance(Device.class, "de");
query.leftJoin("de.classroom.city", "city");
query.leftJoin("de.classroom", "classroom");
query.addEq("de.id", id);
query.setProjection(Projections.projectionList().add(Projections.property("de.id"), "id")
.add(Projections.property("de.partNumber"), "partNumber").add(Projections.property("de.description"), "description")
.add(Projections.property("de.qty"), "qty").add(Projections.property("de.un"), "un")
.add(Projections.property("de.location"), "location").add(Projections.property("de.modality"), "modality")
.add(Projections.property("de.pts"), "pts").add(Projections.property("de.status"), "status")
.add(Projections.property("de.remark"), "remark").add(Projections.property("city.cityName"), "cityName")
.add(Projections.property("classroom.code"), "labName").add(Projections.property("de.caliBration"), "caliBration")
.add(Projections.property("de.system"),"system").add(Projections.property("de.labId"),"labId")
);
query.getDetachedCriteria().setResultTransformer(new AliasToBeanResultTransformer(Device.class));
List<Device> devices = this.select(query);
return CollectionUtils.isNotEmpty(devices) ? devices.get(0) : null;
}
0 0
- select by id
- media in the link element -CSS and select by #id
- select * from tb_shop id order by id desc limit 0,1
- select * from t 和select * from t order by id两个有什么区别
- SELECT sysobjects.id objectId,
- select max(id)优化
- select group by语句
- mysql update by select
- select top order by
- MySQL Select-Order by
- hiveQL Select Order By
- select * from sample where id = id
- JQuery - select class 或是select id?
- select name where id>1
- Get Process ID by Name
- ROW_NUMBER() over(order by Id)
- MySQL排序:SELECT ORDER BY
- Selenium寻找元素定位 id findElement(by.id(“id”)) name findElement(by.name(“name”)) class_name findE
- 没有植入的内容就是TM在逗我
- 调试MySQL中遇到的问题
- [IOS]学习
- 一位ACMer过来人的心得 POJ测试数据合集
- Unity 动态加载dll
- select by id
- HTML5基础
- 使用Autolayout xib实现动态高度的TableViewCell
- quintic蓝牙芯片NVDS方法读写flash
- linux 修改path
- 用内存做Linux下的/tmp目录
- 查看数据库死锁
- Quartz 2D编程指南(3)- PDF文档的创建、显示及转换
- linux下创建守护进程(daemon process)