增加修改type,brand,specs名称的时候同步修改equipment_info表中对应的名称
This commit is contained in:
commit
a18edeef4e
@ -9,6 +9,7 @@ import com.lz.modules.equipment.entity.EquipmentBrandReq;
|
||||
import com.lz.modules.equipment.entity.EquipmentType;
|
||||
import com.lz.modules.equipment.entity.resp.EquipmentBrandResp;
|
||||
import com.lz.modules.equipment.service.EquipmentBrandService;
|
||||
import com.lz.modules.equipment.service.IEquipmentInfoService;
|
||||
import com.lz.modules.equipment.service.IEquipmentTypeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -39,6 +40,9 @@ public class EquipmentBrandController {
|
||||
@Autowired
|
||||
private IEquipmentTypeService equipmentTypeService;
|
||||
|
||||
@Resource
|
||||
private IEquipmentInfoService equipmentInfoService;
|
||||
|
||||
/**
|
||||
* 添加品牌表页面
|
||||
*
|
||||
@ -91,6 +95,7 @@ public class EquipmentBrandController {
|
||||
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(req.getId());
|
||||
BeanUtils.copyProperty(equipmentBrand, req, true);
|
||||
equipmentBrandService.updateEquipmentBrandById(equipmentBrand);
|
||||
equipmentInfoService.updateCoverEquipmentInfoByBrandId(equipmentBrand.getId(), equipmentBrand.getBrand());
|
||||
return R.ok("编辑成功");
|
||||
}
|
||||
|
||||
|
||||
@ -64,23 +64,27 @@ 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());
|
||||
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);
|
||||
|
||||
@ -112,8 +116,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();
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import com.lz.modules.equipment.entity.EquipmentType;
|
||||
import com.lz.modules.equipment.entity.resp.EquipmentSpecsResp;
|
||||
import com.lz.modules.equipment.service.EquipmentBrandService;
|
||||
import com.lz.modules.equipment.service.EquipmentSpecsService;
|
||||
import com.lz.modules.equipment.service.IEquipmentInfoService;
|
||||
import com.lz.modules.equipment.service.IEquipmentTypeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -40,6 +41,9 @@ public class EquipmentSpecsController {
|
||||
@Autowired
|
||||
private EquipmentBrandService equipmentBrandService;
|
||||
|
||||
@Resource
|
||||
private IEquipmentInfoService equipmentInfoService;
|
||||
|
||||
/**
|
||||
* 添加规格表页面
|
||||
*
|
||||
@ -97,6 +101,7 @@ public class EquipmentSpecsController {
|
||||
equipmentSpecs.setGmtCreate(equipmentSpecs.getGmtCreate());
|
||||
equipmentSpecs.setGmtModified(new Date());
|
||||
equipmentSpecsService.updateEquipmentSpecsById(equipmentSpecs);
|
||||
equipmentInfoService.updateCoverEquipmentInfoBySpecsId(equipmentSpecs.getId(), equipmentSpecs.getSpecs());
|
||||
return R.ok("编辑成功");
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.utils.BeanUtils;
|
||||
import com.lz.modules.equipment.entity.EquipmentType;
|
||||
import com.lz.modules.equipment.entity.EquipmentTypeReq;
|
||||
import com.lz.modules.equipment.service.IEquipmentInfoService;
|
||||
import com.lz.modules.equipment.service.IEquipmentTypeService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -29,6 +30,9 @@ public class EquipmentTypeController {
|
||||
@Resource
|
||||
private IEquipmentTypeService equipmentTypeService;
|
||||
|
||||
@Resource
|
||||
private IEquipmentInfoService equipmentInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加类型表页面
|
||||
@ -79,6 +83,8 @@ public class EquipmentTypeController {
|
||||
EquipmentType equipmentType = equipmentTypeService.selectEquipmentTypeById(req.getId());
|
||||
BeanUtils.copyProperty(equipmentType,req,true);
|
||||
equipmentTypeService.updateEquipmentTypeById(equipmentType);
|
||||
//更新所有再记录中所有的类型名称
|
||||
equipmentInfoService.updateCoverEquipmentInfoByTypeId(equipmentType.getId(), equipmentType.getType());
|
||||
return R.ok("编辑成功");
|
||||
}
|
||||
|
||||
|
||||
@ -54,4 +54,8 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
|
||||
int selectCountByNotFind(@Param("num") Integer num);
|
||||
|
||||
int selectCountAllDepartment(@Param("num") Integer num);
|
||||
|
||||
int updateCoverEquipmentInfoByTypeId(@Param("id") Long id, @Param("type") String type);
|
||||
int updateCoverEquipmentInfoByBrandId(@Param("id") Long id, @Param("brand") String brand);
|
||||
int updateCoverEquipmentInfoBySpecsId(@Param("id") Long id, @Param("specs") String specs);
|
||||
}
|
||||
@ -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
|
||||
@ -427,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{" +
|
||||
@ -454,6 +485,9 @@ public class EquipmentInfo implements java.io.Serializable {
|
||||
",userId=" + userId +
|
||||
",saiId=" + saiId +
|
||||
",count=" + count +
|
||||
",typeId=" + typeId +
|
||||
",brandId=" + brandId +
|
||||
",specsId=" + specsId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -61,4 +61,10 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
|
||||
int selectCountByNotFind(Integer num);
|
||||
|
||||
int selectCountAllDepartment(int num);
|
||||
|
||||
int updateCoverEquipmentInfoByTypeId(Long id, String type);
|
||||
|
||||
int updateCoverEquipmentInfoByBrandId(Long id, String brand);
|
||||
|
||||
int updateCoverEquipmentInfoBySpecsId(Long id, String specs);
|
||||
}
|
||||
@ -108,13 +108,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());
|
||||
@ -302,4 +302,19 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
|
||||
public int selectCountAllDepartment(int num) {
|
||||
return equipmentInfoMapper.selectCountAllDepartment(num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCoverEquipmentInfoByTypeId(Long id, String type){
|
||||
return equipmentInfoMapper.updateCoverEquipmentInfoByTypeId(id, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCoverEquipmentInfoByBrandId(Long id, String brand){
|
||||
return equipmentInfoMapper.updateCoverEquipmentInfoByBrandId(id, brand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCoverEquipmentInfoBySpecsId(Long id, String specs){
|
||||
return equipmentInfoMapper.updateCoverEquipmentInfoBySpecsId(id, specs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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}
|
||||
@ -278,5 +293,17 @@
|
||||
select ifnull(count(*),0) from equipment_info where is_delete = 0 and count =#{num} and depart_id is not null and depart_id > 0
|
||||
</select>
|
||||
|
||||
<update id="updateCoverEquipmentInfoByTypeId" parameterType="java.lang.Long">
|
||||
update equipment_info set type = #{type} where type_id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateCoverEquipmentInfoByBrandId" parameterType="java.lang.Long">
|
||||
update equipment_info set brand_name = #{brand} where type_id=#{id}
|
||||
</update>
|
||||
|
||||
<update id="updateCoverEquipmentInfoBySpecsId" parameterType="java.lang.Long">
|
||||
update equipment_info set spec_type = #{specs} where type_id=#{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user