修改物料包功能
This commit is contained in:
parent
1f5d32cbbf
commit
0d0ac7a463
|
@ -1,6 +1,7 @@
|
||||||
package com.sqx.modules.material.entity;
|
package com.sqx.modules.material.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
@ -12,6 +13,7 @@ import java.util.Date;
|
||||||
/**
|
/**
|
||||||
* 物料包表
|
* 物料包表
|
||||||
*/
|
*/
|
||||||
|
@TableName(value ="material")
|
||||||
@Data
|
@Data
|
||||||
public class Material implements Serializable {
|
public class Material implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
||||||
materialQueryWrapper.eq("goods_id", material.getGoodsId());
|
materialQueryWrapper.eq("goods_id", material.getGoodsId());
|
||||||
// 根据查询封装器查询物料按摩信息
|
// 根据查询封装器查询物料按摩信息
|
||||||
Material materials = baseMapper.selectOne(materialQueryWrapper);
|
Material materials = baseMapper.selectOne(materialQueryWrapper);
|
||||||
if(!materials.getId().equals(material.getId()) ){
|
if(materials!=null && !materials.getId().equals(material.getId()) ){
|
||||||
return Result.error("当前商品已绑定物料包,请重新选择!");
|
return Result.error("当前商品已绑定物料包,请重新选择!");
|
||||||
}
|
}
|
||||||
return Result.success().put("data",materialMapper.insertIgnoreNull(material));
|
return Result.success().put("data",materialMapper.insertIgnoreNull(material));
|
||||||
|
@ -106,14 +106,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
||||||
*/
|
*/
|
||||||
public Result updateIgnoreNull(Material material) {
|
public Result updateIgnoreNull(Material material) {
|
||||||
material.setUpdateTime(new Date());
|
material.setUpdateTime(new Date());
|
||||||
QueryWrapper<Material> materialQueryWrapper = new QueryWrapper();
|
// QueryWrapper<Material> materialQueryWrapper = new QueryWrapper();
|
||||||
// 设置查询条件,根据物料ID查询物料按摩信息
|
// // 设置查询条件,根据物料ID查询物料按摩信息
|
||||||
materialQueryWrapper.eq("goods_id", material.getGoodsId());
|
// materialQueryWrapper.eq("goods_id", material.getGoodsId());
|
||||||
// 根据查询封装器查询物料按摩信息
|
// // 根据查询封装器查询物料按摩信息
|
||||||
Material materials = baseMapper.selectOne(materialQueryWrapper);
|
// Material materials = baseMapper.selectOne(materialQueryWrapper);
|
||||||
if(ObjectUtil.isNotEmpty(materials) && !materials.getId().equals(material.getId()) ){
|
// if(ObjectUtil.isNotEmpty(materials) && !materials.getId().equals(material.getId()) ){
|
||||||
return Result.error("当前商品已绑定物料包,请重新选择!");
|
// return Result.error("当前商品已绑定物料包,请重新选择!");
|
||||||
}
|
// }
|
||||||
return Result.success().put("data",materialMapper.updateIgnoreNull(material));
|
return Result.success().put("data",materialMapper.updateIgnoreNull(material));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue