Commit 6e59d840 by 高晓磊

摄像头添加所属流域的的字段

parent 3bd10eac
...@@ -66,7 +66,7 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao, ...@@ -66,7 +66,7 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao,
detachedCriteria.add(Restrictions.eq("regionalStation.id", stationId)); detachedCriteria.add(Restrictions.eq("regionalStation.id", stationId));
} }
if(null!=watershedId){ if(null!=watershedId){
detachedCriteria.add(Restrictions.eq("watershedId", watershedId)); detachedCriteria.add(Restrictions.eq("watershed.id", watershedId));
} }
if(StringUtils.isNotBlank(cameraName)){ if(StringUtils.isNotBlank(cameraName)){
detachedCriteria.add(Restrictions.like("cameraName", "%"+cameraName+"%")); detachedCriteria.add(Restrictions.like("cameraName", "%"+cameraName+"%"));
...@@ -99,9 +99,14 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao, ...@@ -99,9 +99,14 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao,
kobject.set(BaseConstants.CREATE_TIME, id.getDate(BaseConstants.CREATE_TIME)); kobject.set(BaseConstants.CREATE_TIME, id.getDate(BaseConstants.CREATE_TIME));
kobject.set("regionalCompany", currentLoginRegionalCompany); kobject.set("regionalCompany", currentLoginRegionalCompany);
Object cameraAccount = template.load("com.xyst.dinas.camera.dict.datamodel.CameraAccount", kobject.get("cameraAccount").getUuid("id")); Object cameraAccount = template.load("com.xyst.dinas.camera.dict.datamodel.CameraAccount", kobject.get("cameraAccount").getUuid("id"));
Object regionalStation = template.load("com.xyst.dinas.biz.datamodel.Station", kobject.get("regionalStation").getUuid("id")); if(kobject.getInt("cameraObject")==0){
Object regionalStation = template.load("com.xyst.dinas.biz.datamodel.Station", kobject.get("regionalStation").getUuid("id"));
kobject.set("regionalStation",regionalStation);
}else {
Object watershed = template.load("com.xyst.dinas.biz.datamodel.SandMiningArea", kobject.get("watershed").getUuid("id"));
kobject.set("watershed",watershed);
}
kobject.set("cameraAccount",cameraAccount); kobject.set("cameraAccount",cameraAccount);
kobject.set("regionalStation",regionalStation);
KObject staff = AminoContextHolder.getContext().getStaff(); KObject staff = AminoContextHolder.getContext().getStaff();
kobject.set(BaseConstants.MODIFY_TIME, new Date()); kobject.set(BaseConstants.MODIFY_TIME, new Date());
kobject.set(BaseConstants.MODIFIER, staff); kobject.set(BaseConstants.MODIFIER, staff);
...@@ -110,15 +115,20 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao, ...@@ -110,15 +115,20 @@ public class CameraInfoDaoImpl extends AbstractBaseDao implements CameraInfoDao,
} }
@Override @Override
public UUID create(KObject object, KObject regionalCompany) { public UUID create(KObject object, KObject regionalCompany) {
KObject staff = AminoContextHolder.getContext().getStaff(); KObject staff = AminoContextHolder.getContext().getStaff();
object.set("id", UUID.randomUUID()); object.set("id", UUID.randomUUID());
Object cameraAccount = template.load("com.xyst.dinas.camera.dict.datamodel.CameraAccount", object.get("cameraAccount").getUuid("id")); Object cameraAccount = template.load("com.xyst.dinas.camera.dict.datamodel.CameraAccount", object.get("cameraAccount").getUuid("id"));
Object regionalStation = template.load("com.xyst.dinas.biz.datamodel.Station", object.get("regionalStation").getUuid("id")); if(object.getInt("cameraObject")==0){
Object regionalStation = template.load("com.xyst.dinas.biz.datamodel.Station", object.get("regionalStation").getUuid("id"));
object.set("regionalStation",regionalStation);
}else {
Object watershed = template.load("com.xyst.dinas.biz.datamodel.SandMiningArea", object.get("watershed").getUuid("id"));
object.set("watershed",watershed);
}
object.set("cameraAccount",cameraAccount); object.set("cameraAccount",cameraAccount);
object.set("regionalStation",regionalStation);
object.set(BaseConstants.CREATOR, staff); object.set(BaseConstants.CREATOR, staff);
object.set(BaseConstants.CREATE_TIME, new Date()); object.set(BaseConstants.CREATE_TIME, new Date());
object.set(BaseConstants.DEL, false); object.set(BaseConstants.DEL, false);
......
...@@ -27,12 +27,12 @@ public class CameraInfoServiceImpl implements CameraInfoService { ...@@ -27,12 +27,12 @@ public class CameraInfoServiceImpl implements CameraInfoService {
private BapContext bapContext; private BapContext bapContext;
@Override @Override
public Page<KObject> queryByPaging(Page<KObject> page, UUID stationId, UUID watershedId, String cameraName) throws Exception { public Page<KObject> queryByPaging(Page<KObject> page, UUID stationId, UUID watershed, String cameraName) throws Exception {
if(page.getPageNo()==0||page.getPageSize()==0) { if(page.getPageNo()==0||page.getPageSize()==0) {
throw new Exception("pageSize or offset is null"); throw new Exception("pageSize or offset is null");
} }
return cameraInfoDao.listCameraInfoPaging(page,stationId,watershedId,cameraName,getCurrentLoginRegionalCompany()); return cameraInfoDao.listCameraInfoPaging(page,stationId,watershed,cameraName,getCurrentLoginRegionalCompany());
} }
@Override @Override
......
...@@ -65,7 +65,7 @@ public class CameraInfoController { ...@@ -65,7 +65,7 @@ public class CameraInfoController {
if(kobject.getBigInteger("cameraObject").intValue()==0&&null==kobject.get("regionalStation").get("id")){ if(kobject.getBigInteger("cameraObject").intValue()==0&&null==kobject.get("regionalStation").get("id")){
return ResponseObj.error(400,"请选择具体的场站"); return ResponseObj.error(400,"请选择具体的场站");
} }
if(kobject.getBigInteger("cameraObject").intValue()==1&&null==kobject.getUuid("watershedId")){ if(kobject.getBigInteger("cameraObject").intValue()==1&&null==kobject.get("watershed").get("id")){
return ResponseObj.error(400,"请选择具体的流域"); return ResponseObj.error(400,"请选择具体的流域");
} }
if(null==kobject.get("cameraAccount").get("id")){ if(null==kobject.get("cameraAccount").get("id")){
...@@ -105,7 +105,7 @@ public class CameraInfoController { ...@@ -105,7 +105,7 @@ public class CameraInfoController {
if(kobject.getBigInteger("cameraObject").intValue()==0&&null==kobject.get("regionalStation").get("id")){ if(kobject.getBigInteger("cameraObject").intValue()==0&&null==kobject.get("regionalStation").get("id")){
return ResponseObj.error(400,"请选择具体的场站"); return ResponseObj.error(400,"请选择具体的场站");
} }
if(kobject.getBigInteger("cameraObject").intValue()==1&&null==kobject.getUuid("watershedId")){ if(kobject.getBigInteger("cameraObject").intValue()==1&&null==kobject.get("watershed").get("id")){
return ResponseObj.error(400,"请选择具体的流域"); return ResponseObj.error(400,"请选择具体的流域");
} }
if(null==kobject.get("cameraAccount").get("id")){ if(null==kobject.get("cameraAccount").get("id")){
......
...@@ -137,8 +137,8 @@ ...@@ -137,8 +137,8 @@
<m:attribute> <m:attribute>
<m:annotations/> <m:annotations/>
<m:id>79474200-7fb2-4e1d-8d36-677bd744c8fb</m:id> <m:id>79474200-7fb2-4e1d-8d36-677bd744c8fb</m:id>
<m:name>watershedId</m:name> <m:name>watershed</m:name>
<m:title>所属流域id</m:title> <m:title>所属流域</m:title>
<m:type>com.xyst.dinas.biz.datamodel.SandMiningArea</m:type> <m:type>com.xyst.dinas.biz.datamodel.SandMiningArea</m:type>
<m:description></m:description> <m:description></m:description>
<m:default></m:default> <m:default></m:default>
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<comment>所属场站</comment> <comment>所属场站</comment>
</column> </column>
</many-to-one> </many-to-one>
<many-to-one name="watershedId" entity-name="com.xyst.dinas.biz.datamodel.SandMiningArea" fetch="select"> <many-to-one name="watershed" entity-name="com.xyst.dinas.biz.datamodel.SandMiningArea" fetch="select">
<column name="watershed_id" not-null="false" > <column name="watershed_id" not-null="false" >
<comment>所属场站</comment> <comment>所属场站</comment>
</column> </column>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment