|
@ -1,20 +1,19 @@
|
|
|
package com.yihu.iot.service.product;
|
|
|
|
|
|
import com.yihu.iot.dao.product.IotProductBaseInfoDao;
|
|
|
import com.yihu.iot.dao.product.IotProductBaseInfoPropertyDao;
|
|
|
import com.yihu.jw.entity.iot.product.IotProductBaseInfoDO;
|
|
|
import com.yihu.jw.entity.iot.product.IotProductBaseInfoPropertyDO;
|
|
|
import com.yihu.jw.restmodel.iot.device.WlyyPatientDeviceVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoPropertyVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
|
|
|
import com.yihu.jw.restmodel.iot.product.IotProductVO;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.rm.iot.IotRequestMapping;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import static cn.hutool.core.util.ObjectUtil.hasEmpty;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 类描述:
|
|
@ -53,7 +52,7 @@ public class IotProductBaseInfoPropertyService extends BaseJpaService<IotProduct
|
|
|
*/
|
|
|
public MixEnvelop<IotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyVO> update(IotProductBaseInfoPropertyVO iotProductBaseInfoPropertyVO) {
|
|
|
IotProductBaseInfoPropertyDO iotProductBaseInfoPropertyDO = convertToModel(iotProductBaseInfoPropertyVO, IotProductBaseInfoPropertyDO.class);
|
|
|
iotProductBaseInfoPropertyDao.delete(iotProductBaseInfoPropertyVO.getId());//主键删除
|
|
|
iotProductBaseInfoPropertyDao.deleteByProductId(iotProductBaseInfoPropertyVO.getProductId());
|
|
|
iotProductBaseInfoPropertyDao.save(iotProductBaseInfoPropertyDO);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update);
|
|
|
}
|
|
@ -81,7 +80,33 @@ public class IotProductBaseInfoPropertyService extends BaseJpaService<IotProduct
|
|
|
* @date 2023/5/5 16:47
|
|
|
*/
|
|
|
public IotProductBaseInfoPropertyVO findProductPropertyByProductId(String productId) {
|
|
|
IotProductBaseInfoPropertyDO res = iotProductBaseInfoPropertyDao.findProductPropertyByProductId(productId);
|
|
|
return convertToModel(res, IotProductBaseInfoPropertyVO.class);
|
|
|
|
|
|
String sql="SELECT\n" +
|
|
|
"a.id,\n" +
|
|
|
"a.product_id \"productId\",\n" +
|
|
|
"a.`name` \"nameCode\",\n" +
|
|
|
"(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Device_common_name' AND q.`dict_code`=a.`name` ) \"name\", \n" +
|
|
|
"a.`combination` \"combinationCode\",\n" +
|
|
|
"(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Combination_method' AND q.`dict_code`=a.`combination` )\"combination\", \n" +
|
|
|
"a.`device_use` \"deviceUseCode\",\n" +
|
|
|
"(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='device_use' AND q.`dict_code`=a.`device_use` )\"deviceUse\", \n" +
|
|
|
"a.`network` \"networkCode\",\n" +
|
|
|
"(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Network_transmission' AND q.`dict_code`=a.`network` )\"network\", \n" +
|
|
|
"a.`location` \"locationCode\",\n" +
|
|
|
"(SELECT q.`dict_value` FROM `iot-base`.wlyy_hospital_sys_dict q WHERE q.dict_name='Drop_location' AND q.`dict_code`=a.`location` )\"location\",\n" +
|
|
|
"a.dictionaries\n" +
|
|
|
"FROM\n" +
|
|
|
" iot_product_base_info_property a" +
|
|
|
" where 1=1 ";
|
|
|
if (StringUtils.isNotBlank(productId)){
|
|
|
sql += " and a.product_id='"+productId+"'";
|
|
|
}
|
|
|
List<IotProductBaseInfoPropertyVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(IotProductBaseInfoPropertyVO.class));
|
|
|
if (list.isEmpty()){
|
|
|
return null;
|
|
|
}else {
|
|
|
return list.get(0);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|