增加equipment_info的三个类型的id

This commit is contained in:
wulin 2020-09-27 15:02:02 +08:00
parent 66a22e6b08
commit 469a9f7098
4 changed files with 38 additions and 9 deletions

View File

@ -62,23 +62,27 @@ public class EquipmentController extends AbstractController {
return R.ok();
}
FindEquipmentResModel model = new FindEquipmentResModel();
/*//下面的逻辑有bug下周修复20200925
EquipmentType equipmentType = iEquipmentTypeService.selectByType(equipmentInfo.getType());
EquipmentBrand equipmentBrand = equipmentBrandService.selectByBrand(equipmentInfo.getBrandName());
EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectSpecs(equipmentInfo.getSpecType());
EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectSpecs(equipmentInfo.getSpecType());*/
BeanUtils.copyProperties(equipmentInfo,model);
model.setState(equipmentInfo.getEquipmentState());
if(equipmentInfo.getSaiId()!=null){
model.setUserId(equipmentInfo.getSaiId());
model.setEmployee(false);
}
Optional.ofNullable(equipmentType).ifPresent(equipmentType1 -> model.setTypeId(equipmentType1.getId()));
model.setTypeId(equipmentInfo.getTypeId());
model.setBrandId(equipmentInfo.getBrandId());
model.setSpecId(equipmentInfo.getSpecsId());
/*Optional.ofNullable(equipmentType).ifPresent(equipmentType1 -> model.setTypeId(equipmentType1.getId()));
Optional.ofNullable(equipmentBrand).ifPresent(equipmentBrand1 -> model.setBrandId(equipmentBrand1.getId()));
Optional.ofNullable(equipmentSpecs).ifPresent(new Consumer<EquipmentSpecs>() {
@Override
public void accept(EquipmentSpecs equipmentSpecs1) {
model.setSpecId(equipmentSpecs1.getId());
}
});
});*/
// addRecord(equipmentInfo);
return R.ok().put("data", model);
@ -109,8 +113,8 @@ public class EquipmentController extends AbstractController {
try {
iEquipmentInfoService.changeEquipmentInfo(dto,getUser());
} catch (Exception e) {
log.error("绑定设备异常",e);
return R.error();
log.error("绑定设备异常{}",e);
return R.error(e.getMessage());
}
return R.ok();

View File

@ -67,6 +67,13 @@ public class EquipmentInfo implements java.io.Serializable {
private Long saiId;
//第几次盘点
private Integer count;
//类型id
private Long typeId;
//品牌id
private Long brandId;
//规格id
private Long specsId;
/**
* 主键id
* @return
@ -454,6 +461,9 @@ public class EquipmentInfo implements java.io.Serializable {
",userId=" + userId +
",saiId=" + saiId +
",count=" + count +
",typeId=" + typeId +
",brandId=" + brandId +
",specsId=" + specsId +
"}";
}
}

View File

@ -102,13 +102,13 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
EquipmentBrand equipmentBrand = equipmentBrandMapper.selectEquipmentBrandById(dto.getBrandId());
EquipmentSpecs equipmentSpecs = equipmentSpecsMapper.selectEquipmentSpecsById(dto.getSpecId());
if(equipmentType==null){
throw new ZSException("设备类型错误");
throw new ZSException("设备类型错误,不存在或被删除");
}
if(equipmentBrand==null){
throw new ZSException("设备品牌错误");
throw new ZSException("设备品牌错误,不存在或被删除");
}
if(equipmentSpecs==null){
throw new ZSException("设备规格错误");
throw new ZSException("设备规格错误,不存在或被删除");
}
EquipmentInfo info = equipmentInfoMapper.selectEquipmentInfoById(dto.getId());

View File

@ -28,12 +28,15 @@
<result column="user_id" property="userId"/>
<result column="sai_id" property="saiId"/>
<result column="count" property="count"/>
<result column="type_id" property="typeId"/>
<result column="brand_id" property="brandId"/>
<result column="specs_di" property="specsId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, brand_name AS brandName, spec_type AS specType, type AS type, num AS num, unit AS unit, user AS user, owner AS owner, qr AS qr, original_code AS originalCode, code AS code, mark AS mark, gmt_outbound AS gmtOutbound, gmt_inbound AS gmtInbound, equipment_state AS equipmentState, buy_amount AS buyAmount, sale_amount AS saleAmount, no AS no, user_id AS userId, sai_id AS saiId, count AS count
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, brand_name AS brandName, spec_type AS specType, type AS type, num AS num, unit AS unit, user AS user, owner AS owner, qr AS qr, original_code AS originalCode, code AS code, mark AS mark, gmt_outbound AS gmtOutbound, gmt_inbound AS gmtInbound, equipment_state AS equipmentState, buy_amount AS buyAmount, sale_amount AS saleAmount, no AS no, user_id AS userId, sai_id AS saiId, count AS count, type_id AS typeId, brand_id AS brandId, specs_id AS specsId
</sql>
@ -65,6 +68,9 @@
<if test="no != null">no, </if>
<if test="userId != null">user_id, </if>
<if test="saiId != null">sai_id, </if>
<if test="typeId != null">type_id, </if>
<if test="brandId != null">brand_id, </if>
<if test="specsId != null">specs_id, </if>
<if test="count != null">count, </if>
is_delete,
gmt_create,
@ -89,6 +95,9 @@
<if test="no != null">#{ no}, </if>
<if test="userId != null">#{ userId}, </if>
<if test="saiId != null">#{ saiId}, </if>
<if test="typeId != null">#{typeId}, </if>
<if test="brandId != null">#{brandId}, </if>
<if test="specsId != null">#{specsId]}, </if>
<if test="count != null">#{ count}, </if>
0,
now(),
@ -122,6 +131,9 @@
<if test="no != null">no = #{no},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="saiId != null">sai_id = #{saiId},</if>
<if test="typeId != null">type_id=#{typeId}, </if>
<if test="brandId != null">brand_id=#{brandId}, </if>
<if test="specsId != null">specs_id=#{specsId]}, </if>
<if test="count != null">count = #{count}</if>
</trim>
,gmt_modified = now()
@ -154,6 +166,9 @@
no = #{no},
user_id = #{userId},
sai_id = #{saiId},
type_id=#{typeId},
brand_id=#{brandId},
specs_id=#{specsId]},
count = #{count}
,gmt_modified = now()
where id = #{id}