1cf23567 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 20a50c69 c861f32c
......@@ -159,26 +159,33 @@ public class EquipmentSparepartTypeController {
if (equipmentSparepartTypeEntity == null) {
result.error500("未找到对应实体");
} else {
if(StringUtils.isNotEmpty( equipmentSparepartType.getParentId() )){
/*if(StringUtils.isNotEmpty( equipmentSparepartType.getParentId() )){
EquipmentSparepartType parentSparepartType = equipmentSparepartTypeService.getById( equipmentSparepartType.getParentId() );
equipmentSparepartType.setAncestors( parentSparepartType.getAncestors() +","+ equipmentSparepartType.getId()) ;
// 跟新父节点节点状态
//更新父级叶子节点状态
if( parentSparepartType.getIsLeaf()){
parentSparepartType.setIsLeaf(false);
equipmentSparepartTypeService.updateById( parentSparepartType );
}
}
boolean ok = equipmentSparepartTypeService.updateById(equipmentSparepartType);
}*/
//批量更改祖籍信息
equipmentSparepartTypeService.updateAncestors(equipmentSparepartTypeEntity.getAncestors(), equipmentSparepartType.getAncestors() );
String parentAncestors = null;
//更新父级叶子节点状态
/* String parentId = equipmentSparepartType.getParentId();
String parentId = equipmentSparepartType.getParentId();
if(StringUtils.isNotEmpty(parentId)) {
EquipmentSparepartType parentEquipmentSparepartTypeEntity = equipmentSparepartTypeService.getById(parentId);
parentEquipmentSparepartTypeEntity.putIsLeaf(false);
equipmentSparepartTypeService.updateById(parentEquipmentSparepartTypeEntity);
}*/
//获取祖籍信息
parentAncestors = parentEquipmentSparepartTypeEntity.getAncestors();
}
//批量更改祖籍信息
//equipmentSparepartTypeService.updateAncestors(equipmentSparepartTypeEntity.getAncestors(), equipmentSparepartType.getAncestors() );
//修改信息
equipmentSparepartType.setAncestors( parentAncestors +","+ equipmentSparepartType.getId()) ;
//批量修改是否药剂
equipmentSparepartTypeService.batchUpateMedicament( equipmentSparepartType.getId() ,equipmentSparepartType.getMedicament());
boolean ok = equipmentSparepartTypeService.updateById(equipmentSparepartType);
if (ok) {
result.success("修改成功!");
}
......
......@@ -3,6 +3,7 @@ package com.skua.modules.supplies.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -71,11 +72,11 @@ public class EquipmentSparepartType {
*/
@Excel(name = "是否叶子节点,1:是 0:不是", width = 15)
@ApiModelProperty(value = "是否叶子节点,1:是 0:不是")
private boolean isLeaf = true;
private Boolean isLeaf = true;
@Excel(name = "是否药剂,1:是 0:不是", width = 15)
@ApiModelProperty(value = "是否药剂,1:是 0:不是")
private boolean medicament = false;
private Boolean medicament ;
/**
* 创建人
......@@ -112,12 +113,20 @@ public class EquipmentSparepartType {
@ApiModelProperty(value = "删除状态 0正常 1已删除")
private Integer delFlag;
public boolean getIsLeaf() {
public Boolean getLeaf() {
return isLeaf;
}
public void setIsLeaf(boolean isLeaf) {
this.isLeaf = isLeaf;
public void setLeaf(Boolean leaf) {
isLeaf = leaf;
}
public Boolean getMedicament() {
return medicament;
}
public void setMedicament(Boolean medicament) {
this.medicament = medicament;
}
public void putIsLeaf(Boolean isLeaf) {
......@@ -126,4 +135,10 @@ public class EquipmentSparepartType {
}
}
public String getAncestors() {
if(StringUtils.isEmpty(ancestors)){
ancestors = id;
}
return ancestors;
}
}
......
......@@ -15,4 +15,11 @@ public interface EquipmentSparepartTypeMapper extends BaseMapper<EquipmentSparep
* @param newAncestors
*/
public void updateAncestors(@Param("oldAncestors") String oldAncestors,@Param("newAncestors") String newAncestors);
/***
* 批量修改子类的药剂属性
* @param parentId
* @return
*/
int batchUpateMedicament(@Param("parentId") String parentId,@Param("medicament") Boolean medicament);
}
......
......@@ -6,4 +6,12 @@
<update id="updateAncestors">
update equipment_sparepart_type set ancestors = REPLACE(ancestors,#{oldAncestors}, #{newAncestors});
</update>
</mapper>
\ No newline at end of file
<!-- 批量修改子类的药剂属性 -->
<update id="batchUpateMedicament">
update equipment_sparepart_type set medicament = #{medicament} where ancestors like CONCAT(CONCAT('%', #{parentId}),'%')
</update>
</mapper>
......
......@@ -49,4 +49,10 @@ public interface IEquipmentSparepartTypeService extends IService<EquipmentSparep
* @return
*/
List<EquipmentSparepartTypeVO> querySparepartTypeListByTree(EquipmentSparepartType equipmentSparepartType);
/***
*批量修改子类的药剂属性
* @param parentId
*/
int batchUpateMedicament(String parentId,Boolean medicament);
}
......
......@@ -88,6 +88,14 @@ public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSpar
return voList;
}
/***
* 批量修改子类的药剂属性
* @param parentId
*/
public int batchUpateMedicament(String parentId,Boolean medicament){
return this.baseMapper.batchUpateMedicament(parentId,medicament);
}
/***
* 查询物料类别集合-返回列表
* @param equipmentSparepartType
* @return
......@@ -100,8 +108,8 @@ public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSpar
queryWrapper.like("item_text",itemText);
}
List<EquipmentSparepartType> equipmentSparepartTypeList = this.list(queryWrapper);
if (equipmentSparepartType.isMedicament()) {//查询药剂类别
queryWrapper.eq("medicament",equipmentSparepartType.isMedicament());
if (equipmentSparepartType.getMedicament() != null) {//查询药剂类别
queryWrapper.eq("medicament",equipmentSparepartType.getMedicament());
//药剂的物料分类
List<EquipmentSparepartType> medicamentList = this.list(queryWrapper);
equipmentSparepartTypeList = this.equipmentSparepartTypeListByMedicament(equipmentSparepartTypeList , medicamentList );
......
......@@ -3,6 +3,7 @@ package com.skua.modules.supplies.vo;
import java.util.ArrayList;
import java.util.List;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.supplies.entity.EquipmentSparepartType;
import io.swagger.annotations.ApiModelProperty;
......@@ -41,7 +42,7 @@ public class EquipmentSparepartTypeVO {
this.remark = entity.getRemark();
this.sort = entity.getSort();
this.isLeaf = entity.getIsLeaf();
this.medicament = entity.isMedicament();
this.medicament = entity.getMedicament();
if (!entity.getIsLeaf()) {
this.children = new ArrayList<>();
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!