d65d0afa 张雷

请求增加项目ID

1 个父辈 234fb62a
...@@ -89,9 +89,10 @@ public class FmTwinController { ...@@ -89,9 +89,10 @@ public class FmTwinController {
89 public Result<List<FmTwinVO>> savePosition(@RequestBody JSONObject jsonObject) { 89 public Result<List<FmTwinVO>> savePosition(@RequestBody JSONObject jsonObject) {
90 Result<List<FmTwinVO>> result = new Result<List<FmTwinVO>>(); 90 Result<List<FmTwinVO>> result = new Result<List<FmTwinVO>>();
91 String twinId = jsonObject.getString("twinId"); 91 String twinId = jsonObject.getString("twinId");
92 String projectId = jsonObject.getString("projectId");
92 JSONObject json = jsonObject.getJSONObject("locationInfo"); 93 JSONObject json = jsonObject.getJSONObject("locationInfo");
93 FmTwinLocationEntity fmTwinLocation = JSONObject.parseObject(json.toString(), FmTwinLocationEntity.class); 94 FmTwinLocationEntity fmTwinLocation = JSONObject.parseObject(json.toString(), FmTwinLocationEntity.class);
94 boolean ok = fmTwinService.savePosition(twinId,fmTwinLocation); 95 boolean ok = fmTwinService.savePosition(twinId,projectId,fmTwinLocation);
95 if(ok){ 96 if(ok){
96 result.success("定位上传成功!"); 97 result.success("定位上传成功!");
97 }else{ 98 }else{
...@@ -118,9 +119,9 @@ public class FmTwinController { ...@@ -118,9 +119,9 @@ public class FmTwinController {
118 @AutoLog(value = "获取孪生体绑定的摄像头信息") 119 @AutoLog(value = "获取孪生体绑定的摄像头信息")
119 @ApiOperation(value="获取孪生体绑定的摄像头信息", notes="获取孪生体绑定的摄像头信息") 120 @ApiOperation(value="获取孪生体绑定的摄像头信息", notes="获取孪生体绑定的摄像头信息")
120 @GetMapping(value = "/getCameraInfo") 121 @GetMapping(value = "/getCameraInfo")
121 public Result<FmTwinCameraResultVO> getCameraInfo(String twinId) { 122 public Result<FmTwinCameraResultVO> getCameraInfo(String twinId,String projectId) {
122 Result<FmTwinCameraResultVO> result = new Result<FmTwinCameraResultVO>(); 123 Result<FmTwinCameraResultVO> result = new Result<FmTwinCameraResultVO>();
123 FmTwinCameraResultVO twinCameraResultVO = fmTwinService.getCameraInfoByTwinId(twinId); 124 FmTwinCameraResultVO twinCameraResultVO = fmTwinService.getCameraInfoByTwinId(twinId,projectId);
124 result.setResult(twinCameraResultVO); 125 result.setResult(twinCameraResultVO);
125 result.success("获取成功!"); 126 result.success("获取成功!");
126 return result; 127 return result;
...@@ -144,9 +145,9 @@ public class FmTwinController { ...@@ -144,9 +145,9 @@ public class FmTwinController {
144 @AutoLog(value = "获取孪生体绑定的设备信息") 145 @AutoLog(value = "获取孪生体绑定的设备信息")
145 @ApiOperation(value="获取孪生体绑定的设备信息", notes="获取孪生体绑定的设备信息") 146 @ApiOperation(value="获取孪生体绑定的设备信息", notes="获取孪生体绑定的设备信息")
146 @GetMapping(value = "/getEquipInfo") 147 @GetMapping(value = "/getEquipInfo")
147 public Result<FmTwinEquipResultVO> getEquipInfo(String twinId) { 148 public Result<FmTwinEquipResultVO> getEquipInfo(String twinId,String projectId) {
148 Result<FmTwinEquipResultVO> result = new Result<FmTwinEquipResultVO>(); 149 Result<FmTwinEquipResultVO> result = new Result<FmTwinEquipResultVO>();
149 FmTwinEquipResultVO twinEquipResultVO = fmTwinService.getEquipInfoByTwinId(twinId); 150 FmTwinEquipResultVO twinEquipResultVO = fmTwinService.getEquipInfoByTwinId(twinId,projectId);
150 result.setResult(twinEquipResultVO); 151 result.setResult(twinEquipResultVO);
151 result.success("获取成功!"); 152 result.success("获取成功!");
152 return result; 153 return result;
......
...@@ -33,6 +33,10 @@ public class FmTwinCamera { ...@@ -33,6 +33,10 @@ public class FmTwinCamera {
33 @Excel(name = "孪生体ID", width = 15) 33 @Excel(name = "孪生体ID", width = 15)
34 @ApiModelProperty(value = "孪生体ID") 34 @ApiModelProperty(value = "孪生体ID")
35 private java.lang.String twinId; 35 private java.lang.String twinId;
36 /**所属项目*/
37 @Excel(name = "所属项目", width = 15)
38 @ApiModelProperty(value = "所属项目")
39 private java.lang.String projectId;
36 /**摄像头名称*/ 40 /**摄像头名称*/
37 @Excel(name = "摄像头名称", width = 15) 41 @Excel(name = "摄像头名称", width = 15)
38 @ApiModelProperty(value = "摄像头名称") 42 @ApiModelProperty(value = "摄像头名称")
......
...@@ -33,6 +33,10 @@ public class FmTwinEquip { ...@@ -33,6 +33,10 @@ public class FmTwinEquip {
33 @Excel(name = "孪生体ID", width = 15) 33 @Excel(name = "孪生体ID", width = 15)
34 @ApiModelProperty(value = "孪生体ID") 34 @ApiModelProperty(value = "孪生体ID")
35 private java.lang.String twinId; 35 private java.lang.String twinId;
36 /**所属项目*/
37 @Excel(name = "所属项目", width = 15)
38 @ApiModelProperty(value = "所属项目")
39 private java.lang.String projectId;
36 /**设备ID*/ 40 /**设备ID*/
37 @Excel(name = "设备ID", width = 15) 41 @Excel(name = "设备ID", width = 15)
38 @ApiModelProperty(value = "设备ID") 42 @ApiModelProperty(value = "设备ID")
......
...@@ -33,6 +33,10 @@ public class FmTwinLocation { ...@@ -33,6 +33,10 @@ public class FmTwinLocation {
33 @Excel(name = "孪生体ID", width = 15) 33 @Excel(name = "孪生体ID", width = 15)
34 @ApiModelProperty(value = "孪生体ID") 34 @ApiModelProperty(value = "孪生体ID")
35 private java.lang.String twinId; 35 private java.lang.String twinId;
36 /**所属项目*/
37 @Excel(name = "所属项目", width = 15)
38 @ApiModelProperty(value = "所属项目")
39 private java.lang.String projectId;
36 /**位置X坐标*/ 40 /**位置X坐标*/
37 @Excel(name = "位置X坐标", width = 15) 41 @Excel(name = "位置X坐标", width = 15)
38 @ApiModelProperty(value = "位置X坐标") 42 @ApiModelProperty(value = "位置X坐标")
......
...@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
12 */ 12 */
13 public interface FmTwinCameraMapper extends BaseMapper<FmTwinCamera> { 13 public interface FmTwinCameraMapper extends BaseMapper<FmTwinCamera> {
14 14
15 FmTwinCameraSqlResult getCameraInfoByTwinId(@Param("twinId") String twinId); 15 FmTwinCameraSqlResult getCameraInfoByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
16 16
17 FmTwinCamera getOneCameraByTwinId(@Param("twinId") String twinId); 17 FmTwinCamera getOneCameraByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
18 } 18 }
......
1 package com.skua.modules.twin.mapper; 1 package com.skua.modules.twin.mapper;
2 2
3 import java.util.List;
4
5 import com.skua.modules.twin.vo.FmTwinEquipSqlResult; 3 import com.skua.modules.twin.vo.FmTwinEquipSqlResult;
6 import org.apache.ibatis.annotations.Param; 4 import org.apache.ibatis.annotations.Param;
7 import com.skua.modules.twin.entity.FmTwinEquip; 5 import com.skua.modules.twin.entity.FmTwinEquip;
...@@ -12,8 +10,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -12,8 +10,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
12 */ 10 */
13 public interface FmTwinEquipMapper extends BaseMapper<FmTwinEquip> { 11 public interface FmTwinEquipMapper extends BaseMapper<FmTwinEquip> {
14 12
15 FmTwinEquipSqlResult getEquipInfoByTwinId(@Param("twinId") String twinId); 13 FmTwinEquipSqlResult getEquipInfoByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
16 14
17 FmTwinEquip getOneEquipByTwinId(@Param("twinId") String twinId); 15 FmTwinEquip getOneEquipByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
18 16
19 } 17 }
......
...@@ -9,5 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,5 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9 */ 9 */
10 public interface FmTwinLocationMapper extends BaseMapper<FmTwinLocation> { 10 public interface FmTwinLocationMapper extends BaseMapper<FmTwinLocation> {
11 11
12 FmTwinLocation getOneByTwinId(@Param("twinId") String twinId); 12 FmTwinLocation getOneByTwinId(@Param("twinId") String twinId,@Param("projectId") String projectId);
13 } 13 }
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
18 LEFT JOIN fm_twin_camera c ON m.twin_id = c.twin_id 18 LEFT JOIN fm_twin_camera c ON m.twin_id = c.twin_id
19 WHERE 19 WHERE
20 m.twin_id = #{twinId} 20 m.twin_id = #{twinId}
21 and m.project_id = #{projectId}
21 LIMIT 1 22 LIMIT 1
22 </select> 23 </select>
23 24
24 <select id="getOneCameraByTwinId" resultType="com.skua.modules.twin.entity.FmTwinCamera"> 25 <select id="getOneCameraByTwinId" resultType="com.skua.modules.twin.entity.FmTwinCamera">
25 select * from fm_twin_camera where twin_id = #{twinId} 26 select * from fm_twin_camera where twin_id = #{twinId} and project_id = #{projectId} limit 1
26 </select> 27 </select>
27 28
28 </mapper> 29 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
17 LEFT JOIN fm_twin_equip e ON m.twin_id = e.twin_id 17 LEFT JOIN fm_twin_equip e ON m.twin_id = e.twin_id
18 WHERE 18 WHERE
19 m.twin_id = #{twinId} 19 m.twin_id = #{twinId}
20 and m.project_id = #{projectId}
20 LIMIT 1 21 LIMIT 1
21 </select> 22 </select>
22 23
23 <select id="getOneEquipByTwinId" resultType="com.skua.modules.twin.entity.FmTwinEquip"> 24 <select id="getOneEquipByTwinId" resultType="com.skua.modules.twin.entity.FmTwinEquip">
24 select * from fm_twin_equip where twin_id = #{twinId} 25 select * from fm_twin_equip where twin_id = #{twinId} and project_id = #{projectId} limit 1
25 </select> 26 </select>
26 27
27 </mapper> 28 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 <mapper namespace="com.skua.modules.twin.mapper.FmTwinLocationMapper"> 3 <mapper namespace="com.skua.modules.twin.mapper.FmTwinLocationMapper">
4 4
5 <select id="getOneByTwinId" resultType="com.skua.modules.twin.entity.FmTwinLocation"> 5 <select id="getOneByTwinId" resultType="com.skua.modules.twin.entity.FmTwinLocation">
6 select * from fm_twin_location where twin_id = #{twinId} limit 1 6 select * from fm_twin_location where twin_id = #{twinId} and project_id = #{projectId} limit 1
7 </select> 7 </select>
8 8
9 </mapper> 9 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -16,13 +16,13 @@ public interface IFmTwinService { ...@@ -16,13 +16,13 @@ public interface IFmTwinService {
16 16
17 List<FmTwinResultVO> queryList(FmTwinQueryVO fmTwinQueryVO); 17 List<FmTwinResultVO> queryList(FmTwinQueryVO fmTwinQueryVO);
18 18
19 boolean savePosition(String twinId, FmTwinLocationEntity fmTwinLocation); 19 boolean savePosition(String twinId, String projectId, FmTwinLocationEntity fmTwinLocation);
20 20
21 boolean saveNameAndType(FmTwinManage fmTwinManage); 21 boolean saveNameAndType(FmTwinManage fmTwinManage);
22 22
23 FmTwinCameraResultVO getCameraInfoByTwinId(String twinId); 23 FmTwinCameraResultVO getCameraInfoByTwinId(String twinId,String projectId);
24 24
25 FmTwinEquipResultVO getEquipInfoByTwinId(String twinId); 25 FmTwinEquipResultVO getEquipInfoByTwinId(String twinId,String projectId);
26 26
27 boolean boundCamera(FmTwinCamera fmTwinCamera); 27 boolean boundCamera(FmTwinCamera fmTwinCamera);
28 28
......
...@@ -79,16 +79,17 @@ public class FmTwinServiceImpl implements IFmTwinService { ...@@ -79,16 +79,17 @@ public class FmTwinServiceImpl implements IFmTwinService {
79 } 79 }
80 80
81 @Override 81 @Override
82 public boolean savePosition(String twinId, FmTwinLocationEntity twinLocationEntity) { 82 public boolean savePosition(String twinId, String projectId, FmTwinLocationEntity twinLocationEntity) {
83 FmTwinLocation fmTwinLocation = new FmTwinLocation(); 83 FmTwinLocation fmTwinLocation = new FmTwinLocation();
84 fmTwinLocation.setTwinId(twinId); 84 fmTwinLocation.setTwinId(twinId);
85 fmTwinLocation.setProjectId(projectId);
85 fmTwinLocation.setLocaX(twinLocationEntity.getLocaX()); 86 fmTwinLocation.setLocaX(twinLocationEntity.getLocaX());
86 fmTwinLocation.setLocaY(twinLocationEntity.getLocaY()); 87 fmTwinLocation.setLocaY(twinLocationEntity.getLocaY());
87 fmTwinLocation.setLocaZ(twinLocationEntity.getLocaZ()); 88 fmTwinLocation.setLocaZ(twinLocationEntity.getLocaZ());
88 fmTwinLocation.setRotateX(twinLocationEntity.getRotateX()); 89 fmTwinLocation.setRotateX(twinLocationEntity.getRotateX());
89 fmTwinLocation.setRotateY(twinLocationEntity.getRotateY()); 90 fmTwinLocation.setRotateY(twinLocationEntity.getRotateY());
90 fmTwinLocation.setRotateZ(twinLocationEntity.getRotateZ()); 91 fmTwinLocation.setRotateZ(twinLocationEntity.getRotateZ());
91 FmTwinLocation location = fmTwinLocationMapper.getOneByTwinId(twinId); 92 FmTwinLocation location = fmTwinLocationMapper.getOneByTwinId(twinId,projectId);
92 int count = 0; 93 int count = 0;
93 if(location==null){ 94 if(location==null){
94 count = fmTwinLocationMapper.insert(fmTwinLocation); 95 count = fmTwinLocationMapper.insert(fmTwinLocation);
...@@ -118,8 +119,8 @@ public class FmTwinServiceImpl implements IFmTwinService { ...@@ -118,8 +119,8 @@ public class FmTwinServiceImpl implements IFmTwinService {
118 } 119 }
119 120
120 @Override 121 @Override
121 public FmTwinCameraResultVO getCameraInfoByTwinId(String twinId) { 122 public FmTwinCameraResultVO getCameraInfoByTwinId(String twinId,String projectId) {
122 FmTwinCameraSqlResult twinCameraSqlResult = fmTwinCameraMapper.getCameraInfoByTwinId(twinId); 123 FmTwinCameraSqlResult twinCameraSqlResult = fmTwinCameraMapper.getCameraInfoByTwinId(twinId,projectId);
123 FmTwinCameraResultVO twinCameraResultVO = new FmTwinCameraResultVO(); 124 FmTwinCameraResultVO twinCameraResultVO = new FmTwinCameraResultVO();
124 CameraEntity twinCameraEntity = new CameraEntity(); 125 CameraEntity twinCameraEntity = new CameraEntity();
125 twinCameraResultVO.setTwinId(twinCameraSqlResult.getTwinId()); 126 twinCameraResultVO.setTwinId(twinCameraSqlResult.getTwinId());
...@@ -136,8 +137,8 @@ public class FmTwinServiceImpl implements IFmTwinService { ...@@ -136,8 +137,8 @@ public class FmTwinServiceImpl implements IFmTwinService {
136 } 137 }
137 138
138 @Override 139 @Override
139 public FmTwinEquipResultVO getEquipInfoByTwinId(String twinId) { 140 public FmTwinEquipResultVO getEquipInfoByTwinId(String twinId,String projectId) {
140 FmTwinEquipSqlResult twinEquipSqlResult = fmTwinEquipMapper.getEquipInfoByTwinId(twinId); 141 FmTwinEquipSqlResult twinEquipSqlResult = fmTwinEquipMapper.getEquipInfoByTwinId(twinId,projectId);
141 FmTwinEquipResultVO twinEquipResultVO = new FmTwinEquipResultVO(); 142 FmTwinEquipResultVO twinEquipResultVO = new FmTwinEquipResultVO();
142 twinEquipResultVO.setTwinId(twinEquipSqlResult.getTwinId()); 143 twinEquipResultVO.setTwinId(twinEquipSqlResult.getTwinId());
143 twinEquipResultVO.setTwinName(twinEquipSqlResult.getTwinName()); 144 twinEquipResultVO.setTwinName(twinEquipSqlResult.getTwinName());
...@@ -155,8 +156,7 @@ public class FmTwinServiceImpl implements IFmTwinService { ...@@ -155,8 +156,7 @@ public class FmTwinServiceImpl implements IFmTwinService {
155 @Override 156 @Override
156 public boolean boundCamera(FmTwinCamera fmTwinCamera) { 157 public boolean boundCamera(FmTwinCamera fmTwinCamera) {
157 int count = 0; 158 int count = 0;
158 String twinId = fmTwinCamera.getTwinId(); 159 FmTwinCamera fmTwinCameraEntity = fmTwinCameraMapper.getOneCameraByTwinId(fmTwinCamera.getTwinId(),fmTwinCamera.getProjectId());
159 FmTwinCamera fmTwinCameraEntity = fmTwinCameraMapper.getOneCameraByTwinId(twinId);
160 if(fmTwinCameraEntity!=null){ 160 if(fmTwinCameraEntity!=null){
161 fmTwinCamera.setId(fmTwinCameraEntity.getId()); 161 fmTwinCamera.setId(fmTwinCameraEntity.getId());
162 count = fmTwinCameraMapper.updateById(fmTwinCamera); 162 count = fmTwinCameraMapper.updateById(fmTwinCamera);
...@@ -173,8 +173,7 @@ public class FmTwinServiceImpl implements IFmTwinService { ...@@ -173,8 +173,7 @@ public class FmTwinServiceImpl implements IFmTwinService {
173 @Override 173 @Override
174 public boolean boundEquip(FmTwinEquip fmTwinEquip) { 174 public boolean boundEquip(FmTwinEquip fmTwinEquip) {
175 int count = 0; 175 int count = 0;
176 String twinId = fmTwinEquip.getTwinId(); 176 FmTwinEquip fmTwinEquipEntity = fmTwinEquipMapper.getOneEquipByTwinId(fmTwinEquip.getTwinId(),fmTwinEquip.getProjectId());
177 FmTwinEquip fmTwinEquipEntity = fmTwinEquipMapper.getOneEquipByTwinId(twinId);
178 if(fmTwinEquipEntity!=null){ 177 if(fmTwinEquipEntity!=null){
179 fmTwinEquip.setId(fmTwinEquipEntity.getId()); 178 fmTwinEquip.setId(fmTwinEquipEntity.getId());
180 count = fmTwinEquipMapper.updateById(fmTwinEquip); 179 count = fmTwinEquipMapper.updateById(fmTwinEquip);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!