设备标签二改 新增下拉框

This commit is contained in:
gmhao 2023-12-22 17:07:32 +08:00
parent 04d79ac8b0
commit 2495ce88f5
4 changed files with 40 additions and 9 deletions

View File

@ -4,8 +4,10 @@ package com.bonus.sgzb.base.api.domain;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value="com.bonus.sgzb.base.api.domain.MaMachine")
@Data
public class MaMachine extends BaseEntity {
/**
* 机具ID
@ -149,9 +151,7 @@ public class MaMachine extends BaseEntity {
private String labelCode;
public long getMaId() {
return maId;
}
public void setMaId(long maId) {
this.maId = maId;

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.base.mapper;
import java.util.List;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.domain.MaLabelBind;
import com.bonus.sgzb.base.vo.MaLabelBindVO;
import org.apache.ibatis.annotations.Mapper;
@ -44,6 +45,14 @@ public interface MaLabelBindMapper
* @return 结果
*/
public int insertMaLabelBindS(MaLabelBindVO maLabelBindVO);
/**
* 新增机具设备标签ma_label_bind
*
* @param maMachine 机具设备标签ma_label_bind
* @return 结果
*/
public int insertMaLabel(MaMachine maMachine);
/**
* 查询机具设备ma_id
*

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.mapper.MaLabelBindMapper;
import com.bonus.sgzb.base.service.IMaLabelBindService;
import com.bonus.sgzb.base.vo.MaLabelBindVO;
@ -8,6 +9,7 @@ import lombok.extern.flogger.Flogger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -58,7 +60,7 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService
return maLabelBindMapper.selecthistoryList(maLabelBindVO);
}
/**
* 新增机具设备标签ma_label_bind
* 绑定机具设备标签ma_label_bind
*
* @param maLabelBind 机具设备标签ma_label_bind
* @return 结果
@ -69,9 +71,14 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService
int i = 0;
int b =0;
MaLabelBindVO bean = maLabelBindMapper.selectMaMachineMaId(maLabelBind.getMaCode());
if(StringHelper.isNotEmpty(bean.getMaId())){
maLabelBind.setMaId(bean.getMaId());
maLabelBind.setTypeId(bean.getTypeId());
if(null != bean){
return b;
}else {
MaMachine maMachine =new MaMachine();
maMachine.setMaCode(maLabelBind.getMaCode());
maMachine.setTypeId(maLabelBind.getTypeId());
maLabelBindMapper.insertMaLabel(maMachine);
maLabelBind.setMaId(String.valueOf(maMachine.getMaId()));
maLabelBind.setStatus("1");
maLabelBind.setIsBind("1");
b=maLabelBindMapper.updateMaLabelBindMaIds(maLabelBind);

View File

@ -176,4 +176,19 @@
ma_id = #{maId},is_bind =#{isBind}
where label_id =#{labelId}
</update>
<insert id="insertMaLabels">
insert into ma_maLabel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeId != null">type_id,</if>
<if test="maCode != null">ma_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeId != null">#{typeId},</if>
<if test="labelCode != null">#{maCode},</if>
</trim>
</insert>
<insert id="insertMaLabel" useGeneratedKeys="true" keyProperty="maId">
insert into ma_machine (type_id,ma_code,create_time)
values (#{typeId},#{maCode},now());
</insert>
</mapper>