mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 17:05:55 +08:00
设备授权添加状态和筛选
This commit is contained in:
@@ -42,6 +42,10 @@ public class ProductAuthorize extends BaseEntity
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 状态(1-未发布,2-已发布,不能修改) */
|
||||
@Excel(name = "状态", readConverterExp = "1=-未分配,2-使用中")
|
||||
private Integer status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
@@ -53,6 +57,14 @@ public class ProductAuthorize extends BaseEntity
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setAuthorizeId(Long authorizeId)
|
||||
{
|
||||
this.authorizeId = authorizeId;
|
||||
|
||||
@@ -116,4 +116,11 @@ public interface ProductMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int thingsCountInProduct(Long productId);
|
||||
|
||||
/**
|
||||
* 产品下的物模型标识符重复数
|
||||
* @param productId 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int thingsRepeatCountInProduct(Long productId);
|
||||
}
|
||||
|
||||
@@ -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