This commit is contained in:
龚祖望 2023-12-07 09:48:21 +08:00
commit 3d1b8008a2
2 changed files with 12 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import com.aiit.xiuos.model.UserInfo;
import com.aiit.xiuos.service.FzDeviceInfoService; import com.aiit.xiuos.service.FzDeviceInfoService;
import com.aiit.xiuos.tdengine.TDengineJDBCUtil; import com.aiit.xiuos.tdengine.TDengineJDBCUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -52,7 +53,13 @@ public class FzDeviceManageController {
@GetMapping("/select") @GetMapping("/select")
public ResultRespons selectDevice(@RequestParam("type") String type, HttpServletRequest request){ public ResultRespons selectDevice(@RequestParam("type") String type, HttpServletRequest request){
List<FzDeviceInfo> fzDeviceInfos = fzDeviceInfoService.selectByType(type); List<FzDeviceInfo> fzDeviceInfos =null;
if(StringUtils.isEmpty(type)){
fzDeviceInfos=fzDeviceInfoService.selectAll();
}else{
fzDeviceInfos= fzDeviceInfoService.selectByType(type);
}
return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",fzDeviceInfos); return new ResultRespons(Constant.SUCCESS_CODE,"查询设备成功!",fzDeviceInfos);
} }

View File

@ -21,15 +21,15 @@ public interface FzDeviceInfoMapper {
int updateByPrimaryKey(FzDeviceInfo record); int updateByPrimaryKey(FzDeviceInfo record);
@Select("select * from fz_device_info") @Select("select * from fz_device_info order by fz_device_user")
List<FzDeviceInfo> selectAll(); List<FzDeviceInfo> selectAll();
@Select("select * from fz_device_info where fz_device_type =#{type}") @Select("select * from fz_device_info where fz_device_type =#{type} order by fz_device_user")
List<FzDeviceInfo> selectByType(@Param("type") String type); List<FzDeviceInfo> selectByType(@Param("type") String type);
@Select("select * from fz_device_info where fz_device_status =#{status}") @Select("select * from fz_device_info where fz_device_status =#{status} order by fz_device_user")
List<FzDeviceInfo> selectByStatus(@Param("status") String status); List<FzDeviceInfo> selectByStatus(@Param("status") String status);
@Select("select * from fz_device_info where fz_device_user =#{user}") @Select("select * from fz_device_info where fz_device_user =#{user} order by fz_device_user")
List<FzDeviceInfo> selectByUser(@Param("user") String user); List<FzDeviceInfo> selectByUser(@Param("user") String user);
} }