From 469a9f70986e1fe2144c4e65ceac1a27f2f0e795 Mon Sep 17 00:00:00 2001 From: wulin Date: Sun, 27 Sep 2020 15:02:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0equipment=5Finfo=E7=9A=84?= =?UTF-8?q?=E4=B8=89=E4=B8=AA=E7=B1=BB=E5=9E=8B=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquipmentController.java | 14 +++++++++----- .../modules/equipment/entity/EquipmentInfo.java | 10 ++++++++++ .../service/impl/EquipmentInfoServiceImpl.java | 6 +++--- .../mapper/equipment/EquipmentInfoMapper.xml | 17 ++++++++++++++++- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java index f3264b0b..948f2ae2 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java @@ -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() { @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(); diff --git a/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java b/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java index 6965a7f3..0713e273 100644 --- a/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java +++ b/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java @@ -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 + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java index 69db429a..af8717eb 100644 --- a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java +++ b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java @@ -102,13 +102,13 @@ public class EquipmentInfoServiceImpl extends ServiceImpl + + + - 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 @@ -65,6 +68,9 @@ no, user_id, sai_id, + type_id, + brand_id, + specs_id, count, is_delete, gmt_create, @@ -89,6 +95,9 @@ #{ no}, #{ userId}, #{ saiId}, + #{typeId}, + #{brandId}, + #{specsId]}, #{ count}, 0, now(), @@ -122,6 +131,9 @@ no = #{no}, user_id = #{userId}, sai_id = #{saiId}, + type_id=#{typeId}, + brand_id=#{brandId}, + specs_id=#{specsId]}, count = #{count} ,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} From 2b4e7023d3048064b1903e6911dc0987e7ad60be Mon Sep 17 00:00:00 2001 From: wulin Date: Sun, 27 Sep 2020 15:11:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DspecsId=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/entity/EquipmentInfo.java | 24 +++++++++++++++++++ .../mapper/equipment/EquipmentInfoMapper.xml | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java b/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java index 0713e273..0bc5bdf4 100644 --- a/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java +++ b/src/main/java/com/lz/modules/equipment/entity/EquipmentInfo.java @@ -434,6 +434,30 @@ public class EquipmentInfo implements java.io.Serializable { this.count = count; } + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + public Long getBrandId() { + return brandId; + } + + public void setBrandId(Long brandId) { + this.brandId = brandId; + } + + public Long getSpecsId() { + return specsId; + } + + public void setSpecsId(Long specsId) { + this.specsId = specsId; + } + @Override public String toString() { return "EquipmentInfo{" + diff --git a/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml b/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml index 08d0998d..03a9771b 100644 --- a/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml +++ b/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml @@ -168,7 +168,7 @@ sai_id = #{saiId}, type_id=#{typeId}, brand_id=#{brandId}, - specs_id=#{specsId]}, + specs_id=#{specsId}, count = #{count} ,gmt_modified = now() where id = #{id}