This commit is contained in:
gmhao 2023-12-20 20:35:28 +08:00
parent a729039137
commit c568a0d9c4
13 changed files with 294 additions and 31 deletions

View File

@ -112,9 +112,9 @@ public class MaLabelBindController extends BaseController
*/
@ApiOperation(value = "查询标签绑定管理列表")
@Log(title = "机具设备标签ma_label_bind", businessType = BusinessType.DELETE)
@DeleteMapping("/{maId}")
public AjaxResult remove(@PathVariable Long maId)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
return toAjax(maLabelBindService.updateMaLabelBindByMaIds(maId));
return toAjax(maLabelBindService.updateMaLabelBindByMaIds(id));
}
}

View File

@ -0,0 +1,49 @@
package com.bonus.sgzb.base.controller;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.service.IMaMachineLabelService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "标签")
@RestController
@RequestMapping("/maMachineLabel")
public class MaMachineLabelController extends BaseController {
@Autowired
private IMaMachineLabelService maMachineLabelService;
/**
* 查询标签编号
* @param
* @return
*/
@ApiOperation(value = "查询标签编号")
@GetMapping("/list")
public TableDataInfo list()
{
List<MaMachineLabel> list = maMachineLabelService.selectMaMachineLabelList();
return getDataTable(list);
}
/**
* 标签生成ma_machine_label
*/
@Log(title = "标签生成ma_machine_label", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaMachineLabel maMachineLabel) {
return toAjax(maMachineLabelService.insertMaMachineLabel(maMachineLabel));
}
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ -17,34 +18,42 @@ public class MaLabelBind {
//机具ID
@Excel(name = "机具ID")
@ApiModelProperty(value = "种类id")
private Long maId;
//标签编号
@Excel(name = "标签编号")
@ApiModelProperty(value = "种类id")
private String labelCode;
//类型ID
@Excel(name = "类型ID")
@ApiModelProperty(value = "种类id")
private Long typeId;
//绑定时间
@Excel(name = "绑定时间")
@ApiModelProperty(value = "种类id")
private Date bindTime;
//绑定人
@Excel(name = "绑定人")
@ApiModelProperty(value = "种类id")
private String binder;
//是否绑定(0 , 1 )
@Excel(name = "是否绑定")
@ApiModelProperty(value = "种类id")
private String isBind;
//标签类型(数据字典)
@Excel(name = "标签类型(数据字典)")
@ApiModelProperty(value = "种类id")
private Long labelType;
//数据所属组织
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "种类id")
private String companyId;
}

View File

@ -0,0 +1,48 @@
package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MaMachineLabel extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标签ID */
@ApiModelProperty(value = "种类id")
private Long labelId;
/** 标签编号 */
@Excel(name = "标签编号")
@ApiModelProperty(value = "标签编号")
private String labelCode;
/** 类型ID */
@Excel(name = "类型ID")
@ApiModelProperty(value = "类型ID")
private Long maId;
/** 是否绑定 */
@Excel(name = "是否绑定")
@ApiModelProperty(value = "是否绑定")
private String isBind;
/** 标签类型(数据字典) */
@Excel(name = "标签类型(数据字典)")
@ApiModelProperty(value = "标签类型(数据字典)")
private Long labelType;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
private String companyId;
/* *//** 数据所属组织 *//*
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")
private List<> arryList;*/
}

View File

@ -43,8 +43,14 @@ public interface MaLabelBindMapper
* @param maLabelBindVO 机具设备标签ma_label_bind
* @return 结果
*/
public int insertMaLabelBind(MaLabelBindVO maLabelBindVO);
public int insertMaLabelBindS(MaLabelBindVO maLabelBindVO);
/**
* 查询机具设备ma_id
*
* @param maCode
* @return 结果
*/
// public int selectMaMachineMaId(String maCode);
/**
* 修改机具设备标签ma_label_bind
*
@ -64,10 +70,12 @@ public interface MaLabelBindMapper
/**
* 批量删除机具设备标签ma_label_bind
*
* @param maId 需要删除的数据主键集合
* @param id 需要删除的数据主键集合
* @return 结果
*/
public int updateMaLabelBindByMaIds(Long maId);
public int updateMaLabelBindByMaIds(Long id);
MaLabelBindVO selectMaMachineMaId(String maCode);
int insertLabelBind(MaLabelBind maLabelBind);
}

View File

@ -0,0 +1,22 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface MaMachineLabelMapper {
public List<MaMachineLabel> selectMaMachineLabelList();
/**
* 新增机具设备标签ma_machine_label
*
* @param maMachineLabel 机具设备标签ma_machine_label
* @return 结果
*/
public int insertMaMachineLabel(MaMachineLabel maMachineLabel);
}

View File

@ -0,0 +1,24 @@
package com.bonus.sgzb.base.service;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import java.util.List;
public interface IMaMachineLabelService {
/**
* 查询机具设备标签ma_machine_label
* @param
* @return 机具设备标签ma_machine_label
*/
List<MaMachineLabel> selectMaMachineLabelList();
/**
* 新增机具设备标签ma_machine_label
* @param maMachineLabel 机具设备标签ma_machine_label
* @return 结果
*/
public int insertMaMachineLabel(MaMachineLabel maMachineLabel);
}

View File

@ -3,9 +3,11 @@ package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.mapper.MaLabelBindMapper;
import com.bonus.sgzb.base.service.IMaLabelBindService;
import com.bonus.sgzb.base.vo.MaLabelBindVO;
import org.springframework.beans.factory.annotation.Autowired;
import com.bonus.sgzb.common.core.utils.StringHelper;
import lombok.extern.flogger.Flogger;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
@ -17,7 +19,7 @@ import java.util.List;
@Service
public class MaLabelBindServiceImpl implements IMaLabelBindService
{
@Autowired
@Resource
private MaLabelBindMapper maLabelBindMapper;
/**
@ -64,9 +66,14 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService
@Override
public int insertMaLabelBind(MaLabelBindVO maLabelBind)
{
maLabelBind.setBindTime("1");
maLabelBind.setStatus("1");
return maLabelBindMapper.insertMaLabelBind(maLabelBind);
int i = 0;
MaLabelBindVO bean = maLabelBindMapper.selectMaMachineMaId(maLabelBind.getMaCode());
if(StringHelper.isNotEmpty(bean.getMaId())){
maLabelBind.setMaId(bean.getMaId());
maLabelBind.setStatus("1");
i = maLabelBindMapper.insertMaLabelBindS(maLabelBind);
}
return i ;
}
/**
@ -84,14 +91,14 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService
/**
* 批量删除机具设备标签ma_label_bind
*
* @param maId 需要删除的机具设备标签ma_label_bind主键
* @param id 需要删除的机具设备标签ma_label_bind主键
* @return 结果
*/
@Override
public int updateMaLabelBindByMaIds(Long maId)
public int updateMaLabelBindByMaIds(Long id)
{
//Long ma=Long.parseLong(String.valueOf(maId));
return maLabelBindMapper.updateMaLabelBindByMaIds(maId);
return maLabelBindMapper.updateMaLabelBindByMaIds(id);
}
/**

View File

@ -0,0 +1,42 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.mapper.MaMachineLabelMapper;
import com.bonus.sgzb.base.service.IMaMachineLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("IMaMachineLabelService")
public class MaMachineLabelServiceImpl implements IMaMachineLabelService
{
@Autowired
private MaMachineLabelMapper maMachineLabelMapper;
/**
* 查询机具设备标签ma_machine_label列表
*
* @param
* @return 机具设备标签ma_machine_label
*/
@Override
public List<MaMachineLabel> selectMaMachineLabelList()
{
return maMachineLabelMapper.selectMaMachineLabelList();
}
/**
* 新增机具设备标签ma_machine_label
*
* @param maMachineLabel 机具设备标签ma_machine_label
* @return 结果
*/
@Override
public int insertMaMachineLabel(MaMachineLabel maMachineLabel)
{
return maMachineLabelMapper.insertMaMachineLabel(maMachineLabel);
}
}

View File

@ -39,7 +39,6 @@ public class MaLabelBindVO {
//是否绑定(0 , 1 )
@ApiModelProperty(value = "是否绑定(0 是, 1 否)")
private String isBind;
//规格型号
@ApiModelProperty(value = "规格型号")
private String typeName;
@ -69,4 +68,10 @@ public class MaLabelBindVO {
//是否绑定(0 , 1 )
@ApiModelProperty(value = "狀態")
private String status;
@ApiModelProperty(value = "用户姓名")
private String userName;
@ApiModelProperty(value = "中间表主键")
private String id;
}

View File

@ -17,7 +17,9 @@
<result property="kindName" column="kindName" />
<result property="isBind" column="is_bind" />
<result property="name" column="name" />
<result property="isBind" column="bind_time" />
<result property="bindTime" column="bind_time" />
<result property="userName" column="user_name" />
<result property="id" column="id" />
</resultMap>
<sql id="selectMaLabelBindVo">
@ -31,18 +33,19 @@
</sql>
<select id="selectMaLabelBindList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult">
SELECT a.ma_id,a.label_code,a.bind_time,a.label_type,mt.type_id,mt.type_name,
SELECT b.label_id,a.id,b.label_code,a.bind_time,b.label_type,mt.type_id,mt.type_name,
mt2.type_id as modelId , mt2.type_name as modelName,mt3.type_name as wpName,
mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code
FROM ma_label_bind a
mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code,user.user_name
FROM ma_machine_label b
left join ma_label_bind a on a.ma_id = b.ma_id
LEFT JOIN ma_type mt ON a.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id AND mt2.`level` = '3'
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id AND mt3.`level` = '2'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.`level` = '1'
LEFT JOIN ma_type_repair mtk ON mtk.type_id = mt.type_id
LEFT JOIN sys_dic dic ON dic.id = a.label_type
LEFT JOIN ma_machine ma on ma.ma_id = a.ma_id
WHERE mt.`level` = '4' AND mt.`del_flag` = '0' AND a.status = '1'
LEFT JOIN sys_dic dic ON dic.id = b.label_type
LEFT JOIN ma_machine ma ON ma.ma_id = a.ma_id
LEFT JOIN sys_user user on user.user_id =a.binder
<where>
<if test="labelCode != null and labelCode != ''"> and a.label_code = #{labelCode}</if>
<if test="typeId != null "> and a.type_id = #{typeId}</if>
@ -84,7 +87,7 @@
where ma_id = #{maId}
</select>
<insert id="insertMaLabelBindS" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" useGeneratedKeys="true" keyProperty="maId">
<insert id="insertMaLabelBindS" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
insert into ma_label_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maId != null">ma_id,</if>
@ -93,7 +96,7 @@
<if test="binder != null">binder,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
<if test="isBind != null">binder_time,</if>
<if test="bindTime != null">binder_time,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -126,28 +129,26 @@
<if test="binder != null">#{binder},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
<if test="isBind != null">#{binderTime},</if>
<if test="bindTime != null">#{binderTime},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
update ma_label_bind
<trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">ma_id = #{maId},</if>
<if test="labelCode != null">label_code = #{labelCode},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="binder != null">binder = #{binder},</if>
<if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if>
</trim>
where ma_id = #{maId}
</update>
<update id="updateMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
update ma_label_bind
<trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">label_code = #{labelCode},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="bindTime != null">bind_time = #{bindTime},</if>
<if test="binder != null">binder = #{binder},</if>
<if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if>
@ -160,6 +161,12 @@
</delete>
<update id="updateMaLabelBindByMaIds" parameterType="Long">
update ma_label_bind set status = '0' where ma_id = #{maId}
update ma_label_bind set status = '0' where ma_id = #{id}
</update>
<select id="selectMaMachineMaId" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
select ma_id as maId
from ma_machine
where ma_code = #{maCode}
</select>
</mapper>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.base.mapper.MaMachineLabelMapper">
<resultMap type="com.bonus.sgzb.base.domain.MaMachineLabel" id="MaMachineLabelResult">
<result property="labelId" column="label_id" />
<result property="labelCode" column="label_code" />
<result property="maId" column="ma_id" />
<result property="isBind" column="is_bind" />
<result property="labelType" column="label_type" />
<result property="companyId" column="company_id" />
</resultMap>
<sql id="selectMaMachineLabelVo">
select label_id, label_code, type_id, is_bind, label_type, company_id
from ma_machine_label
</sql>
<select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" resultMap="MaMachineLabelResult">
select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label
where is_bind ='0'
</select>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if>
<if test="maId != null">ma_id,</if>
<if test="isBind != null">is_bind,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelCode != null">#{labelCode},</if>
<if test="maId != null">#{maId},</if>
<if test="isBind != null">#{isBind},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
</mapper>

View File

@ -80,7 +80,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="pId != null pId != ''">#{pId},</if>
<if test="pId != null">#{pId},</if>
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="description != null">#{description},</if>