81,095
社区成员
发帖
与我相关
我的任务
分享
public class ExhibitionExhibitsListByExhibitsResource extends ServerResource
implements IExhibitionExhibitsResource {
private IExhibitionExhibitsMapper exhibitionExhibitsMapper = null;
private Long exhibitsId = null;
@Override
public void setExhibitionExhibitsMapper(
IExhibitionExhibitsMapper exhibitionExhibitsMapper) {
this.exhibitionExhibitsMapper = exhibitionExhibitsMapper;
}
@Override
public void setExhibitionExhibitsDao(IExhibitionExhibitsDao dao) {
// TODO Auto-generated method stub
}
public ExhibitionExhibitsListByExhibitsResource() {
super.getVariants().add(new Variant(MediaType.TEXT_PLAIN));
}
@Override
public void doInit() {
if (CheckHelper.objectIsNull(super.getRequestAttributes().get(
"exhibitsId"))) {
return;
} else {
this.exhibitsId = Long.valueOf(super.getRequestAttributes()
.get("exhibitsId").toString());
}
}
@Override
public Representation get(Variant variant) {
List<TbExhibitionExhibits> proList = this.exhibitionExhibitsMapper
.selectListExhibitionExhibitsByExhibitsId(this.exhibitsId
.intValue());
List<ExhibitionExhibitsRo> proRo = new ArrayList<ExhibitionExhibitsRo>();
for (TbExhibitionExhibits type : proList) {
proRo.add(new ExhibitionExhibitsRo(type));
}
JSONArray array = JSONArray.fromObject(proRo);
return new StringRepresentation(array.toString());
}
}
<entry key="/exhibitionExhibits/{exhibitsId}">
<bean class="org.restlet.ext.spring.SpringFinder">
<lookup-method name="create" bean="exhibitionExhibitsListByExhibitsResource" />
</bean>
</entry>