1. 调整
This commit is contained in:
parent
e9544c8518
commit
28d17976a3
|
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,6 +66,9 @@ public class AppController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAsUserCollectionService asUserCollectionService;
|
private IAsUserCollectionService asUserCollectionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAsModelService asModelService;
|
||||||
|
|
||||||
@Value(value = "${baidu.identifyUrl}")
|
@Value(value = "${baidu.identifyUrl}")
|
||||||
private String identifyUrl;
|
private String identifyUrl;
|
||||||
|
|
||||||
|
@ -393,4 +397,18 @@ public class AppController extends BaseController
|
||||||
return AjaxResult.success(asDeviceService.getWeather(ipAddr));
|
return AjaxResult.success(asDeviceService.getWeather(ipAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据型号返回型号名称
|
||||||
|
*/
|
||||||
|
@GetMapping("/getModelName")
|
||||||
|
public AjaxResult getModelName(String[] asModels)
|
||||||
|
{
|
||||||
|
List<AsModel> asModelList = new ArrayList<>();
|
||||||
|
for (String model:asModels) {
|
||||||
|
AsModel asModel = asModelService.selectAsModelByModel(model);
|
||||||
|
asModelList.add(asModel);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(asModelList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,4 +156,12 @@ public class AsDevice extends BaseEntity
|
||||||
/** 是否默认展示:0-否,1-是 */
|
/** 是否默认展示:0-否,1-是 */
|
||||||
@Excel(name = "是否默认展示")
|
@Excel(name = "是否默认展示")
|
||||||
private String isDefault;
|
private String isDefault;
|
||||||
|
|
||||||
|
/** 蓝牙id,用于前端链接蓝牙 */
|
||||||
|
@Excel(name = "蓝牙id")
|
||||||
|
private String bluetoothId;
|
||||||
|
|
||||||
|
/** 蓝牙名称 */
|
||||||
|
@Excel(name = "蓝牙名称")
|
||||||
|
private String bluetoothName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.device.domain.vo;
|
package com.ruoyi.device.domain.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,14 @@ public interface AsModelMapper extends BaseMapper<AsModel>
|
||||||
*/
|
*/
|
||||||
public AsModel selectAsModelByModelId(Long modelId);
|
public AsModel selectAsModelByModelId(Long modelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据型号查询型号对象
|
||||||
|
*
|
||||||
|
* @param model 型号列表主键
|
||||||
|
* @return 型号列表
|
||||||
|
*/
|
||||||
|
public AsModel selectAsModelByModel(String model);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询型号列表列表
|
* 查询型号列表列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,6 +19,14 @@ public interface IAsModelService
|
||||||
*/
|
*/
|
||||||
public AsModel selectAsModelByModelId(Long modelId);
|
public AsModel selectAsModelByModelId(Long modelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据型号查询型号对象
|
||||||
|
*
|
||||||
|
* @param model 型号列表主键
|
||||||
|
* @return 型号列表
|
||||||
|
*/
|
||||||
|
public AsModel selectAsModelByModel(String model);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询型号列表列表
|
* 查询型号列表列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -441,10 +441,12 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
if(ObjectUtils.isEmpty(device)){
|
if(ObjectUtils.isEmpty(device)){
|
||||||
throw new ServiceException("该设备已经被删除");
|
throw new ServiceException("该设备已经被删除");
|
||||||
}
|
}
|
||||||
if(ObjectUtils.isNotEmpty(device.getUserId()) && "1".equals(device.getIsNetwork())){
|
if(ObjectUtils.isNotEmpty(device.getUserId()) && device.getUserId()>0){
|
||||||
throw new ServiceException("该设备已经绑定用户,请先!");
|
throw new ServiceException("该设备已经绑定用户,请先解绑!");
|
||||||
}
|
}
|
||||||
device.setUserId(asDevice.getUserId());
|
device.setUserId(asDevice.getUserId());
|
||||||
|
device.setBluetoothId(asDevice.getBluetoothId());
|
||||||
|
device.setBluetoothName(asDevice.getBluetoothName());
|
||||||
int i = asDeviceMapper.updateAsDevice(device);
|
int i = asDeviceMapper.updateAsDevice(device);
|
||||||
if(i>0){
|
if(i>0){
|
||||||
toggleDevice(asDevice.getUserId(), device.getDeviceId());
|
toggleDevice(asDevice.getUserId(), device.getDeviceId());
|
||||||
|
|
|
@ -58,6 +58,18 @@ public class AsModelServiceImpl extends ServiceImpl<AsModelMapper, AsModel> impl
|
||||||
return asModelMapper.selectAsModelByModelId(modelId);
|
return asModelMapper.selectAsModelByModelId(modelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据型号查询型号对象
|
||||||
|
*
|
||||||
|
* @param model 型号列表主键
|
||||||
|
* @return 型号列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AsModel selectAsModelByModel(String model)
|
||||||
|
{
|
||||||
|
return asModelMapper.selectAsModelByModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询型号列表列表
|
* 查询型号列表列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,10 +38,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="isNetwork" column="is_network" />
|
<result property="isNetwork" column="is_network" />
|
||||||
<result property="isDefault" column="is_default" />
|
<result property="isDefault" column="is_default" />
|
||||||
<result property="modeStr" column="mode_str" />
|
<result property="modeStr" column="mode_str" />
|
||||||
|
<result property="bluetoothId" column="bluetooth_id" />
|
||||||
|
<result property="bluetoothName" column="bluetooth_name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAsDeviceVo">
|
<sql id="selectAsDeviceVo">
|
||||||
select device_id, picture, device_name, classify_id, classify_name, model_id, model, mac, activation_time, online_status, user_id, user_name, nick_name, regular_watering, soil_moisture_open, soil_moisture_close, water_intensity, pulse_mode, pulse_mode_param, screen_rest_time, version, version_id, create_by, create_time, update_by, update_time, remark, regular_watering_json, soil_moisture, water_intensity_switch,is_network,is_default,mode_str from as_device
|
select device_id, picture, device_name, classify_id, classify_name, model_id, model, mac, activation_time, online_status, user_id, user_name, nick_name, regular_watering, soil_moisture_open, soil_moisture_close, water_intensity, pulse_mode, pulse_mode_param, screen_rest_time, version, version_id, create_by, create_time, update_by, update_time, remark, regular_watering_json, soil_moisture, water_intensity_switch,is_network,is_default,mode_str,bluetooth_id,bluetooth_name from as_device
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">
|
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">
|
||||||
|
@ -177,7 +179,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="isNetwork != null">is_network = #{isNetwork},</if>
|
<if test="isNetwork != null">is_network = #{isNetwork},</if>
|
||||||
<if test="isDefault != null">is_default = #{isDefault},</if>
|
<if test="isDefault != null">is_default = #{isDefault},</if>
|
||||||
<if test="modeStr != null">mode_str = #{modeStr}</if>
|
<if test="modeStr != null">mode_str = #{modeStr},</if>
|
||||||
|
<if test="bluetoothId != null">bluetooth_id = #{bluetoothId},</if>
|
||||||
|
<if test="bluetoothName != null">bluetooth_name = #{bluetoothName}</if>
|
||||||
</trim>
|
</trim>
|
||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
@ -46,6 +46,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select model_id, model from as_model where model = #{model} limit 1
|
select model_id, model from as_model where model = #{model} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAsModelByModel" parameterType="string" resultMap="AsModelResult">
|
||||||
|
<include refid="selectAsModelVo"/>
|
||||||
|
where model = #{model}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertAsModel" parameterType="AsModel" useGeneratedKeys="true" keyProperty="modelId">
|
<insert id="insertAsModel" parameterType="AsModel" useGeneratedKeys="true" keyProperty="modelId">
|
||||||
insert into as_model
|
insert into as_model
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user