mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-19 17:35:54 +08:00
设备授权添加状态和筛选
This commit is contained in:
@@ -60,6 +60,8 @@ public class ProductAuthorizeServiceImpl implements IProductAuthorizeService {
|
||||
*/
|
||||
@Override
|
||||
public int insertProductAuthorize(ProductAuthorize productAuthorize) {
|
||||
// 1=未使用,2=使用中
|
||||
productAuthorize.setStatus(1);
|
||||
productAuthorize.setCreateTime(DateUtils.getNowDate());
|
||||
return productAuthorizeMapper.insertProductAuthorize(productAuthorize);
|
||||
}
|
||||
@@ -72,6 +74,10 @@ public class ProductAuthorizeServiceImpl implements IProductAuthorizeService {
|
||||
*/
|
||||
@Override
|
||||
public int updateProductAuthorize(ProductAuthorize productAuthorize) {
|
||||
if(productAuthorize.getDeviceId()!=null && productAuthorize.getDeviceId()!=0){
|
||||
// 1=未使用,2=使用中
|
||||
productAuthorize.setStatus(2);
|
||||
}
|
||||
productAuthorize.setUpdateTime(DateUtils.getNowDate());
|
||||
return productAuthorizeMapper.updateProductAuthorize(productAuthorize);
|
||||
}
|
||||
@@ -113,6 +119,8 @@ public class ProductAuthorizeServiceImpl implements IProductAuthorizeService {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
for (int i = 0; i < createNum; i++) {
|
||||
ProductAuthorize authorize = new ProductAuthorize();
|
||||
// 1=未使用,2=使用中
|
||||
authorize.setStatus(1);
|
||||
authorize.setProductId(productId);
|
||||
authorize.setCreateBy(user.getUserName());
|
||||
authorize.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
@@ -154,6 +154,11 @@ public class ProductServiceImpl implements IProductService
|
||||
if(thingsCount==0){
|
||||
return AjaxResult.error("发布失败,请先添加产品的物模型");
|
||||
}
|
||||
// 产品下物模型的标识符必须唯一
|
||||
int repeatCount=productMapper.thingsRepeatCountInProduct(model.getProductId());
|
||||
if(repeatCount>1){
|
||||
return AjaxResult.error("发布失败,产品物模型的标识符必须唯一");
|
||||
}
|
||||
}else{
|
||||
return AjaxResult.error("状态更新失败,状态值有误");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user