|
@@ -3,9 +3,13 @@ package com.ruoyi.web.controller.business;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.ruoyi.business.domain.*;
|
|
|
import com.ruoyi.business.mapper.*;
|
|
|
+import com.ruoyi.business.req.DeviceReq;
|
|
|
+import com.ruoyi.business.res.DeviceRes;
|
|
|
import com.ruoyi.business.res.HomeCountsRes;
|
|
|
import com.ruoyi.business.service.IBusinessService;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -17,10 +21,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+
|
|
|
@RestController
|
|
|
@Slf4j
|
|
|
@RequestMapping("/business")
|
|
|
-public class BusinessController {
|
|
|
+public class BusinessController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private BizDeviceMapper bizDeviceMapper;
|
|
@@ -69,7 +74,6 @@ public class BusinessController {
|
|
|
*
|
|
|
* 接口1:获取首页的统计信息(通过类型区分是实验室的还是连续检测的)
|
|
|
* @param type 1:化验室,2:连续检测
|
|
|
- * @return
|
|
|
*/
|
|
|
@GetMapping("/homeCountsInfo/{type}")
|
|
|
public R<HomeCountsRes> homeCountsInfo(@PathVariable Integer type){
|
|
@@ -79,4 +83,33 @@ public class BusinessController {
|
|
|
DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
return R.ok(homeCountsRes);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 接口2:获取水厂列表信息
|
|
|
+ */
|
|
|
+ @GetMapping("/waterWorkerList")
|
|
|
+ public R<List<BizWaterWork>> waterWorkerList(){
|
|
|
+ log.info("进入了 获取水厂列表信息 接口");
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
|
+ List<BizWaterWork> bizWaterWorks = this.bizWaterWorkMapper.selectBizWaterWorkList(BizWaterWork.builder().delFlag("0").worksStatus("0").build());//只获取关联设备的水厂。
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
+ return R.ok(bizWaterWorks);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 接口3:分页获取设备列表(通过类型区分是实验室的还是连续检测的)
|
|
|
+ */
|
|
|
+ @GetMapping("/devicePageList")
|
|
|
+ public TableDataInfo devicePageList(DeviceReq deviceReq){
|
|
|
+ log.info("进入了 分页获取设备列表(通过类型区分是实验室的还是连续检测的) 接口,类型是{}", JSON.toJSONString(deviceReq));
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
|
+ startPage();
|
|
|
+ List<DeviceRes> list = this.businessService.devicePageList(deviceReq);
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
}
|