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 34f7c035..c9aab97f 100644
--- a/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java
+++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java
@@ -4,7 +4,9 @@ import com.lz.common.emun.EquipmentState;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.annotation.Login;
+import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
+import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.equipment.dao.TCountMapper;
import com.lz.modules.equipment.entity.*;
@@ -58,6 +60,8 @@ public class EquipmentController extends AbstractController {
private SpecialApplyInfoService specialApplyInfoService;
@Autowired
private TCountMapper tCountMapper;
+ @Autowired
+ private DepartmentsStaffRelateService departmentsStaffRelateService;
@GetMapping("findEquipmentById")
@RequiresPermissions("user:device:pandian")
@@ -67,10 +71,6 @@ public class EquipmentController extends AbstractController {
return R.ok();
}
FindEquipmentResModel model = new FindEquipmentResModel();
- /*//下面的逻辑有bug下周修复20200925 20200927修复,注释掉
- EquipmentType equipmentType = iEquipmentTypeService.selectByType(equipmentInfo.getType());
- EquipmentBrand equipmentBrand = equipmentBrandService.selectByBrand(equipmentInfo.getBrandName());
- EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectSpecs(equipmentInfo.getSpecType());*/
BeanUtils.copyProperties(equipmentInfo,model);
model.setState(equipmentInfo.getEquipmentState());
if(equipmentInfo.getSaiId()!=null){
@@ -80,20 +80,22 @@ public class EquipmentController extends AbstractController {
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());
- }
- });*/
+
+ Long departmentId = -1L;
+ if(equipmentInfo.getSaiId()!=null){
+ SpecialApplyInfo specialApplyInfo = specialApplyInfoService.selectSpecialApplyInfoById(equipmentInfo.getSaiId());
+ }
+ if(equipmentInfo.getUserId()!=null){
+ DepartmentsStaffRelateEntity entity = departmentsStaffRelateService.selectByStaffId(equipmentInfo.getUserId());
+ }
+ model.setDepartId(departmentId);
int i = tCountMapper.selectMaxNum();
if(equipmentInfo.getCount()
-* 菜单权限表
*
*设备表
* @author quyixiao
-* @since 2020-08-10
+* @since 2021-01-05
*/
@Data
@TableName("equipment_info")
+@ApiModel(value = "设备表")
public class EquipmentInfo implements java.io.Serializable {
//主键id
@TableId(value = "id", type = IdType.AUTO)
private Long id;
//是否删除
+ @ApiModelProperty(value = "是否删除", name = "isDelete")
private Integer isDelete;
//生成时间
+ @ApiModelProperty(value = "生成时间", name = "gmtCreate")
private Date gmtCreate;
//修改时间
+ @ApiModelProperty(value = "修改时间", name = "gmtModified")
private Date gmtModified;
//设备类型描述
+ @ApiModelProperty(value = "设备类型描述", name = "brandName")
private String brandName;
//设备规格
+ @ApiModelProperty(value = "设备规格", name = "specType")
private String specType;
//设备类别
+ @ApiModelProperty(value = "设备类别", name = "type")
private String type;
//数量
+ @ApiModelProperty(value = "数量", name = "num")
private Long num;
//单位 件/台
+ @ApiModelProperty(value = "单位 件/台", name = "unit")
private String unit;
//使用方
+ @ApiModelProperty(value = "使用方", name = "user")
private String user;
//所属方
+ @ApiModelProperty(value = "所属方", name = "owner")
private String owner;
//设备本身标识
+ @ApiModelProperty(value = "设备本身标识", name = "qr")
private String qr;
//设备原有标识
+ @ApiModelProperty(value = "设备原有标识", name = "originalCode")
private String originalCode;
//现有生成标识
+ @ApiModelProperty(value = "现有生成标识", name = "code")
private String code;
//备注
+ @ApiModelProperty(value = "备注", name = "mark")
private String mark;
//最后一次出库时间
+ @ApiModelProperty(value = "最后一次出库时间", name = "gmtOutbound")
private Date gmtOutbound;
//第一次入库时间
+ @ApiModelProperty(value = "第一次入库时间", name = "gmtInbound")
private Date gmtInbound;
//0:入库 1:售出 2:不可用 3:调拨 4:申领
+ @ApiModelProperty(value = "0:入库 1:售出 2:不可用 3:调拨 4:申领", name = "equipmentState")
private Integer equipmentState;
//买入金额
+ @ApiModelProperty(value = "买入金额", name = "buyAmount")
private BigDecimal buyAmount;
//出售价格
+ @ApiModelProperty(value = "出售价格", name = "saleAmount")
private BigDecimal saleAmount;
//流水审批编号
+ @ApiModelProperty(value = "流水审批编号", name = "no")
private String no;
//使用人id
+ @ApiModelProperty(value = "使用人id", name = "userId")
private Long userId;
//special_apply_info 表id
+ @ApiModelProperty(value = "special_apply_info 表id", name = "saiId")
private Long saiId;
+ //-1代表未分类 0代表库存 其他代表部门id
+ @ApiModelProperty(value = "-1代表未分类 0代表库存 其他代表部门id", name = "departId")
+ private Long departId;
//第几次盘点
+ @ApiModelProperty(value = "第几次盘点", name = "count")
private Integer count;
-
//类型id
+ @ApiModelProperty(value = "类型id", name = "typeId")
private Long typeId;
//品牌id
+ @ApiModelProperty(value = "品牌id", name = "brandId")
private Long brandId;
//规格id
+ @ApiModelProperty(value = "规格id", name = "specsId")
private Long specsId;
/**
* 主键id
@@ -419,6 +448,21 @@ public class EquipmentInfo implements java.io.Serializable {
this.saiId = saiId;
}
+ /**
+ * -1代表未分类 0代表库存 其他代表部门id
+ * @return
+ */
+ public Long getDepartId() {
+ return departId;
+ }
+ /**
+ * -1代表未分类 0代表库存 其他代表部门id
+ * @param departId
+ */
+ public void setDepartId(Long departId) {
+ this.departId = departId;
+ }
+
/**
* 第几次盘点
* @return
@@ -434,26 +478,47 @@ public class EquipmentInfo implements java.io.Serializable {
this.count = count;
}
+ /**
+ * 类型id
+ * @return
+ */
public Long getTypeId() {
return typeId;
}
-
+ /**
+ * 类型id
+ * @param typeId
+ */
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
+ /**
+ * 品牌id
+ * @return
+ */
public Long getBrandId() {
return brandId;
}
-
+ /**
+ * 品牌id
+ * @param brandId
+ */
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
+ /**
+ * 规格id
+ * @return
+ */
public Long getSpecsId() {
return specsId;
}
-
+ /**
+ * 规格id
+ * @param specsId
+ */
public void setSpecsId(Long specsId) {
this.specsId = specsId;
}
@@ -484,6 +549,7 @@ public class EquipmentInfo implements java.io.Serializable {
",no=" + no +
",userId=" + userId +
",saiId=" + saiId +
+ ",departId=" + departId +
",count=" + count +
",typeId=" + typeId +
",brandId=" + brandId +
diff --git a/src/main/java/com/lz/modules/equipment/entity/model/FindEquipmentResModel.java b/src/main/java/com/lz/modules/equipment/entity/model/FindEquipmentResModel.java
index dde41fa9..dc0451d2 100644
--- a/src/main/java/com/lz/modules/equipment/entity/model/FindEquipmentResModel.java
+++ b/src/main/java/com/lz/modules/equipment/entity/model/FindEquipmentResModel.java
@@ -87,4 +87,7 @@ public class FindEquipmentResModel {
@ApiModelProperty(value = "是否为员工使用", name = "employee")
private boolean employee = true;
+
+ private Long departId;
+
}
diff --git a/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml b/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml
index 289c1c13..f2de8b1c 100644
--- a/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml
+++ b/src/main/resources/mapper/equipment/EquipmentInfoMapper.xml
@@ -27,6 +27,7 @@
+
@@ -36,7 +37,7 @@
- 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
+ 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, depart_id AS departId, count AS count, type_id AS typeId, brand_id AS brandId, specs_id AS specsId
@@ -46,7 +47,6 @@
select * from equipment_info where id=#{id} and is_delete = 0 limit 1
-
insert into equipment_info(
brand_name,
@@ -68,10 +68,11 @@
no,
user_id,
sai_id,
+ depart_id,
+ count,
type_id,
brand_id,
specs_id,
- count,
is_delete,
gmt_create,
gmt_modified
@@ -95,10 +96,11 @@
#{ no},
#{ userId},
#{ saiId},
- #{typeId},
- #{brandId},
- #{specsId},
+ #{ departId},
#{ count},
+ #{ typeId},
+ #{ brandId},
+ #{ specsId},
0,
now(),
now()
@@ -131,10 +133,11 @@
no = #{no},
user_id = #{userId},
sai_id = #{saiId},
- type_id=#{typeId},
- brand_id=#{brandId},
- specs_id=#{specsId},
- count = #{count}
+ depart_id = #{departId},
+ count = #{count},
+ type_id = #{typeId},
+ brand_id = #{brandId},
+ specs_id = #{specsId}
,gmt_modified = now()
where id = #{id}
@@ -166,10 +169,11 @@
no = #{no},
user_id = #{userId},
sai_id = #{saiId},
- type_id=#{typeId},
- brand_id=#{brandId},
- specs_id=#{specsId},
- count = #{count}
+ depart_id = #{departId},
+ count = #{count},
+ type_id = #{typeId},
+ brand_id = #{brandId},
+ specs_id = #{specsId}
,gmt_modified = now()
where id = #{id}
diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java
index cb20fd61..d299f592 100644
--- a/src/test/java/com/lz/mysql/MysqlMain.java
+++ b/src/test/java/com/lz/mysql/MysqlMain.java
@@ -85,7 +85,7 @@ public class MysqlMain {
List list = new ArrayList();
- list.add(new TablesBean("lz_result_score"));
+ list.add(new TablesBean("equipment_info"));
List list2 = new ArrayList();