d65d0afa 张雷

请求增加项目ID

1 个父辈 234fb62a
......@@ -89,9 +89,10 @@ public class FmTwinController {
public Result<List<FmTwinVO>> savePosition(@RequestBody JSONObject jsonObject) {
Result<List<FmTwinVO>> result = new Result<List<FmTwinVO>>();
String twinId = jsonObject.getString("twinId");
String projectId = jsonObject.getString("projectId");
JSONObject json = jsonObject.getJSONObject("locationInfo");
FmTwinLocationEntity fmTwinLocation = JSONObject.parseObject(json.toString(), FmTwinLocationEntity.class);
boolean ok = fmTwinService.savePosition(twinId,fmTwinLocation);
boolean ok = fmTwinService.savePosition(twinId,projectId,fmTwinLocation);
if(ok){
result.success("定位上传成功!");
}else{
......@@ -118,9 +119,9 @@ public class FmTwinController {
@AutoLog(value = "获取孪生体绑定的摄像头信息")
@ApiOperation(value="获取孪生体绑定的摄像头信息", notes="获取孪生体绑定的摄像头信息")
@GetMapping(value = "/getCameraInfo")
public Result<FmTwinCameraResultVO> getCameraInfo(String twinId) {
public Result<FmTwinCameraResultVO> getCameraInfo(String twinId,String projectId) {
Result<FmTwinCameraResultVO> result = new Result<FmTwinCameraResultVO>();
FmTwinCameraResultVO twinCameraResultVO = fmTwinService.getCameraInfoByTwinId(twinId);
FmTwinCameraResultVO twinCameraResultVO = fmTwinService.getCameraInfoByTwinId(twinId,projectId);
result.setResult(twinCameraResultVO);
result.success("获取成功!");
return result;
......@@ -144,9 +145,9 @@ public class FmTwinController {
@AutoLog(value = "获取孪生体绑定的设备信息")
@ApiOperation(value="获取孪生体绑定的设备信息", notes="获取孪生体绑定的设备信息")
@GetMapping(value = "/getEquipInfo")
public Result<FmTwinEquipResultVO> getEquipInfo(String twinId) {
public Result<FmTwinEquipResultVO> getEquipInfo(String twinId,String projectId) {
Result<FmTwinEquipResultVO> result = new Result<FmTwinEquipResultVO>();
FmTwinEquipResultVO twinEquipResultVO = fmTwinService.getEquipInfoByTwinId(twinId);
FmTwinEquipResultVO twinEquipResultVO = fmTwinService.getEquipInfoByTwinId(twinId,projectId);
result.setResult(twinEquipResultVO);
result.success("获取成功!");
return result;
......
......@@ -33,6 +33,10 @@ public class FmTwinCamera {
@Excel(name = "孪生体ID", width = 15)
@ApiModelProperty(value = "孪生体ID")
private java.lang.String twinId;
/**所属项目*/
@Excel(name = "所属项目", width = 15)
@ApiModelProperty(value = "所属项目")
private java.lang.String projectId;
/**摄像头名称*/
@Excel(name = "摄像头名称", width = 15)
@ApiModelProperty(value = "摄像头名称")
......
......@@ -33,6 +33,10 @@ public class FmTwinEquip {
@Excel(name = "孪生体ID", width = 15)
@ApiModelProperty(value = "孪生体ID")
private java.lang.String twinId;
/**所属项目*/
@Excel(name = "所属项目", width = 15)
@ApiModelProperty(value = "所属项目")
private java.lang.String projectId;
/**设备ID*/
@Excel(name = "设备ID", width = 15)
@ApiModelProperty(value = "设备ID")
......
......@@ -33,6 +33,10 @@ public class FmTwinLocation {
@Excel(name = "孪生体ID", width = 15)
@ApiModelProperty(value = "孪生体ID")
private java.lang.String twinId;
/**所属项目*/
@Excel(name = "所属项目", width = 15)
@ApiModelProperty(value = "所属项目")
private java.lang.String projectId;
/**位置X坐标*/
@Excel(name = "位置X坐标", width = 15)
@ApiModelProperty(value = "位置X坐标")
......
......@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FmTwinCameraMapper extends BaseMapper<FmTwinCamera> {
FmTwinCameraSqlResult getCameraInfoByTwinId(@Param("twinId") String twinId);
FmTwinCameraSqlResult getCameraInfoByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
FmTwinCamera getOneCameraByTwinId(@Param("twinId") String twinId);
FmTwinCamera getOneCameraByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
}
......
package com.skua.modules.twin.mapper;
import java.util.List;
import com.skua.modules.twin.vo.FmTwinEquipSqlResult;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.twin.entity.FmTwinEquip;
......@@ -12,8 +10,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FmTwinEquipMapper extends BaseMapper<FmTwinEquip> {
FmTwinEquipSqlResult getEquipInfoByTwinId(@Param("twinId") String twinId);
FmTwinEquipSqlResult getEquipInfoByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
FmTwinEquip getOneEquipByTwinId(@Param("twinId") String twinId);
FmTwinEquip getOneEquipByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
}
......
......@@ -9,5 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FmTwinLocationMapper extends BaseMapper<FmTwinLocation> {
FmTwinLocation getOneByTwinId(@Param("twinId") String twinId);
FmTwinLocation getOneByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
}
......
......@@ -18,11 +18,12 @@
LEFT JOIN fm_twin_camera c ON m.twin_id = c.twin_id
WHERE
m.twin_id = #{twinId}
and m.project_id = #{projectId}
LIMIT 1
</select>
<select id="getOneCameraByTwinId" resultType="com.skua.modules.twin.entity.FmTwinCamera">
select * from fm_twin_camera where twin_id = #{twinId}
select * from fm_twin_camera where twin_id = #{twinId} and project_id = #{projectId} limit 1
</select>
</mapper>
\ No newline at end of file
......
......@@ -17,11 +17,12 @@
LEFT JOIN fm_twin_equip e ON m.twin_id = e.twin_id
WHERE
m.twin_id = #{twinId}
and m.project_id = #{projectId}
LIMIT 1
</select>
<select id="getOneEquipByTwinId" resultType="com.skua.modules.twin.entity.FmTwinEquip">
select * from fm_twin_equip where twin_id = #{twinId}
select * from fm_twin_equip where twin_id = #{twinId} and project_id = #{projectId} limit 1
</select>
</mapper>
\ No newline at end of file
......
......@@ -3,7 +3,7 @@
<mapper namespace="com.skua.modules.twin.mapper.FmTwinLocationMapper">
<select id="getOneByTwinId" resultType="com.skua.modules.twin.entity.FmTwinLocation">
select * from fm_twin_location where twin_id = #{twinId} limit 1
select * from fm_twin_location where twin_id = #{twinId} and project_id = #{projectId} limit 1
</select>
</mapper>
\ No newline at end of file
......
......@@ -16,13 +16,13 @@ public interface IFmTwinService {
List<FmTwinResultVO> queryList(FmTwinQueryVO fmTwinQueryVO);
boolean savePosition(String twinId, FmTwinLocationEntity fmTwinLocation);
boolean savePosition(String twinId, String projectId, FmTwinLocationEntity fmTwinLocation);
boolean saveNameAndType(FmTwinManage fmTwinManage);
FmTwinCameraResultVO getCameraInfoByTwinId(String twinId);
FmTwinCameraResultVO getCameraInfoByTwinId(String twinId,String projectId);
FmTwinEquipResultVO getEquipInfoByTwinId(String twinId);
FmTwinEquipResultVO getEquipInfoByTwinId(String twinId,String projectId);
boolean boundCamera(FmTwinCamera fmTwinCamera);
......
......@@ -79,16 +79,17 @@ public class FmTwinServiceImpl implements IFmTwinService {
}
@Override
public boolean savePosition(String twinId, FmTwinLocationEntity twinLocationEntity) {
public boolean savePosition(String twinId, String projectId, FmTwinLocationEntity twinLocationEntity) {
FmTwinLocation fmTwinLocation = new FmTwinLocation();
fmTwinLocation.setTwinId(twinId);
fmTwinLocation.setProjectId(projectId);
fmTwinLocation.setLocaX(twinLocationEntity.getLocaX());
fmTwinLocation.setLocaY(twinLocationEntity.getLocaY());
fmTwinLocation.setLocaZ(twinLocationEntity.getLocaZ());
fmTwinLocation.setRotateX(twinLocationEntity.getRotateX());
fmTwinLocation.setRotateY(twinLocationEntity.getRotateY());
fmTwinLocation.setRotateZ(twinLocationEntity.getRotateZ());
FmTwinLocation location = fmTwinLocationMapper.getOneByTwinId(twinId);
FmTwinLocation location = fmTwinLocationMapper.getOneByTwinId(twinId,projectId);
int count = 0;
if(location==null){
count = fmTwinLocationMapper.insert(fmTwinLocation);
......@@ -118,8 +119,8 @@ public class FmTwinServiceImpl implements IFmTwinService {
}
@Override
public FmTwinCameraResultVO getCameraInfoByTwinId(String twinId) {
FmTwinCameraSqlResult twinCameraSqlResult = fmTwinCameraMapper.getCameraInfoByTwinId(twinId);
public FmTwinCameraResultVO getCameraInfoByTwinId(String twinId,String projectId) {
FmTwinCameraSqlResult twinCameraSqlResult = fmTwinCameraMapper.getCameraInfoByTwinId(twinId,projectId);
FmTwinCameraResultVO twinCameraResultVO = new FmTwinCameraResultVO();
CameraEntity twinCameraEntity = new CameraEntity();
twinCameraResultVO.setTwinId(twinCameraSqlResult.getTwinId());
......@@ -136,8 +137,8 @@ public class FmTwinServiceImpl implements IFmTwinService {
}
@Override
public FmTwinEquipResultVO getEquipInfoByTwinId(String twinId) {
FmTwinEquipSqlResult twinEquipSqlResult = fmTwinEquipMapper.getEquipInfoByTwinId(twinId);
public FmTwinEquipResultVO getEquipInfoByTwinId(String twinId,String projectId) {
FmTwinEquipSqlResult twinEquipSqlResult = fmTwinEquipMapper.getEquipInfoByTwinId(twinId,projectId);
FmTwinEquipResultVO twinEquipResultVO = new FmTwinEquipResultVO();
twinEquipResultVO.setTwinId(twinEquipSqlResult.getTwinId());
twinEquipResultVO.setTwinName(twinEquipSqlResult.getTwinName());
......@@ -155,8 +156,7 @@ public class FmTwinServiceImpl implements IFmTwinService {
@Override
public boolean boundCamera(FmTwinCamera fmTwinCamera) {
int count = 0;
String twinId = fmTwinCamera.getTwinId();
FmTwinCamera fmTwinCameraEntity = fmTwinCameraMapper.getOneCameraByTwinId(twinId);
FmTwinCamera fmTwinCameraEntity = fmTwinCameraMapper.getOneCameraByTwinId(fmTwinCamera.getTwinId(),fmTwinCamera.getProjectId());
if(fmTwinCameraEntity!=null){
fmTwinCamera.setId(fmTwinCameraEntity.getId());
count = fmTwinCameraMapper.updateById(fmTwinCamera);
......@@ -173,8 +173,7 @@ public class FmTwinServiceImpl implements IFmTwinService {
@Override
public boolean boundEquip(FmTwinEquip fmTwinEquip) {
int count = 0;
String twinId = fmTwinEquip.getTwinId();
FmTwinEquip fmTwinEquipEntity = fmTwinEquipMapper.getOneEquipByTwinId(twinId);
FmTwinEquip fmTwinEquipEntity = fmTwinEquipMapper.getOneEquipByTwinId(fmTwinEquip.getTwinId(),fmTwinEquip.getProjectId());
if(fmTwinEquipEntity!=null){
fmTwinEquip.setId(fmTwinEquipEntity.getId());
count = fmTwinEquipMapper.updateById(fmTwinEquip);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!