机具编码标签绑定

This commit is contained in:
dingjie 2023-12-23 20:52:59 +08:00
parent b6bd220662
commit fa9ad0f28f
7 changed files with 54 additions and 15 deletions

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain; package com.bonus.sgzb.base.api.domain;
import com.bonus.sgzb.common.core.annotation.Excel; import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -49,12 +49,17 @@ public class MaLabelBind {
//标签类型(数据字典) //标签类型(数据字典)
@Excel(name = "标签类型(数据字典)") @Excel(name = "标签类型(数据字典)")
@ApiModelProperty(value = "种类id") @ApiModelProperty(value = "种类id")
private Long labelType; private Integer labelType;
//数据所属组织 //数据所属组织
@Excel(name = "数据所属组织") @Excel(name = "数据所属组织")
@ApiModelProperty(value = "种类id") @ApiModelProperty(value = "种类id")
private String companyId; private String companyId;
//数据所属组织
@Excel(name = "0已解绑 1已绑定")
@ApiModelProperty(value = "0已解绑 1已绑定")
private String status;
} }

View File

@ -2,7 +2,7 @@ package com.bonus.sgzb.base.mapper;
import java.util.List; import java.util.List;
import com.bonus.sgzb.base.api.domain.MaMachine; import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.domain.MaLabelBind; import com.bonus.sgzb.base.api.domain.MaLabelBind;
import com.bonus.sgzb.base.vo.MaLabelBindVO; import com.bonus.sgzb.base.vo.MaLabelBindVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -2,16 +2,14 @@ package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.api.domain.MaMachine; import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.domain.MaLabelBind; import com.bonus.sgzb.base.api.domain.MaLabelBind;
import com.bonus.sgzb.base.domain.MaPropSet; import com.bonus.sgzb.base.domain.MaPropSet;
import com.bonus.sgzb.base.mapper.MaLabelBindMapper; import com.bonus.sgzb.base.mapper.MaLabelBindMapper;
import com.bonus.sgzb.base.mapper.MaMachineMapper; import com.bonus.sgzb.base.mapper.MaMachineMapper;
import com.bonus.sgzb.base.mapper.MaPropInfoMapper; import com.bonus.sgzb.base.mapper.MaPropInfoMapper;
import com.bonus.sgzb.base.mapper.MaTypeMapper; import com.bonus.sgzb.base.mapper.MaTypeMapper;
import com.bonus.sgzb.base.service.MaMachineService; import com.bonus.sgzb.base.service.MaMachineService;
import com.bonus.sgzb.base.vo.MaLabelBindVO;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@ -167,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<insert id="maMachineAdd" parameterType="com.bonus.sgzb.base.api.domain.MaMachine"> <insert id="maMachineAdd" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" useGeneratedKeys="true" keyProperty="maId">
insert into ma_machine ( insert into ma_machine (
<if test="typeId != null and typeId != '' ">type_id,</if> <if test="typeId != null and typeId != '' ">type_id,</if>
<if test="maCode != null and maCode != '' ">ma_code,</if> <if test="maCode != null and maCode != '' ">ma_code,</if>

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.mapper; package com.bonus.sgzb.material.mapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaLabelBind;
import com.bonus.sgzb.base.api.domain.MaMachine; import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaMachineLabel; import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.MaType;
@ -107,4 +108,6 @@ public interface PurchaseMacodeInfoMapper {
int selectLableNumByMonth(Date nowDate); int selectLableNumByMonth(Date nowDate);
int insertMaMachineLabel(MaMachineLabel maMachineLabel); int insertMaMachineLabel(MaMachineLabel maMachineLabel);
int insertMaLabelBind(MaLabelBind maLabelBind);
} }

View File

@ -7,10 +7,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachine; import com.bonus.sgzb.base.api.domain.*;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
@ -125,6 +122,22 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
maMachine.setCreateTime(new Date()); maMachine.setCreateTime(new Date());
maMachine.setCreateBy(SecurityUtils.getUsername()); maMachine.setCreateBy(SecurityUtils.getUsername());
purchaseMacodeInfoMapper.maMachineAdd(maMachine); purchaseMacodeInfoMapper.maMachineAdd(maMachine);
maLabel.setIsBind("1");
maLabel.setLabelCode(maCode);
maLabel.setMaId(maMachine.getMaId());
maLabel.setCreateTime(new Date());
purchaseMacodeInfoMapper.insertMaMachineLabel(maLabel);
MaLabelBind maLabelBind = new MaLabelBind();
maLabelBind.setStatus("1");
maLabelBind.setIsBind("1");
maLabelBind.setMaId(maMachine.getMaId());
maLabelBind.setTypeId(maLabelBind.getTypeId());
maLabelBind.setBindTime(new Date());
maLabelBind.setLabelType(9);
purchaseMacodeInfoMapper.insertMaLabelBind(maLabelBind);
} }
purchaseMacodeInfo.setStatus("0"); purchaseMacodeInfo.setStatus("0");
@ -231,9 +244,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
}else { }else {
code = format + "-000" + lableNum; code = format + "-000" + lableNum;
} }
maMachineLabel.setIsBind("0");
maMachineLabel.setLabelCode(code);
purchaseMacodeInfoMapper.insertMaMachineLabel(maMachineLabel);
return code; return code;
} }

View File

@ -150,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where assets_code = #{fixCode} where assets_code = #{fixCode}
</select> </select>
<insert id="maMachineAdd"> <insert id="maMachineAdd" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" useGeneratedKeys="true" keyProperty="maId">
insert into ma_machine ( insert into ma_machine (
<if test="typeId != null and typeId != '' ">type_id,</if> <if test="typeId != null and typeId != '' ">type_id,</if>
<if test="maCode != null and maCode != '' ">ma_code,</if> <if test="maCode != null and maCode != '' ">ma_code,</if>
@ -254,6 +254,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
now() now()
</trim> </trim>
</insert> </insert>
<insert id="insertMaLabelBind">
insert into ma_label_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maId != null">ma_id,</if>
<if test="labelCode != null">label_code,</if>
<if test="typeId != null">type_id,</if>
<if test="binder != null">binder,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
<if test="bindTime != null">binder_time,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maId != null">#{maId},</if>
<if test="labelCode != null">#{labelCode},</if>
<if test="typeId != null">#{typeId},</if>
<if test="binder != null">#{binder},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
<if test="bindTime != null">#{bindTime},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<select id="selectTypeByTypeId" resultType="com.bonus.sgzb.base.api.domain.MaType"> <select id="selectTypeByTypeId" resultType="com.bonus.sgzb.base.api.domain.MaType">
select type_id typeId, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price, select type_id typeId, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price,