This commit is contained in:
zhouzy062 2023-12-21 09:59:46 +08:00
commit dd36503472
24 changed files with 700 additions and 65 deletions

View File

@ -112,9 +112,9 @@ public class MaLabelBindController extends BaseController
*/ */
@ApiOperation(value = "查询标签绑定管理列表") @ApiOperation(value = "查询标签绑定管理列表")
@Log(title = "机具设备标签ma_label_bind", businessType = BusinessType.DELETE) @Log(title = "机具设备标签ma_label_bind", businessType = BusinessType.DELETE)
@DeleteMapping("/{maId}") @DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long maId) 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; package com.bonus.sgzb.base.domain;
import com.bonus.sgzb.common.core.annotation.Excel; import com.bonus.sgzb.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -17,34 +18,42 @@ public class MaLabelBind {
//机具ID //机具ID
@Excel(name = "机具ID") @Excel(name = "机具ID")
@ApiModelProperty(value = "种类id")
private Long maId; private Long maId;
//标签编号 //标签编号
@Excel(name = "标签编号") @Excel(name = "标签编号")
@ApiModelProperty(value = "种类id")
private String labelCode; private String labelCode;
//类型ID //类型ID
@Excel(name = "类型ID") @Excel(name = "类型ID")
@ApiModelProperty(value = "种类id")
private Long typeId; private Long typeId;
//绑定时间 //绑定时间
@Excel(name = "绑定时间") @Excel(name = "绑定时间")
@ApiModelProperty(value = "种类id")
private Date bindTime; private Date bindTime;
//绑定人 //绑定人
@Excel(name = "绑定人") @Excel(name = "绑定人")
@ApiModelProperty(value = "种类id")
private String binder; private String binder;
//是否绑定(0 , 1 ) //是否绑定(0 , 1 )
@Excel(name = "是否绑定") @Excel(name = "是否绑定")
@ApiModelProperty(value = "种类id")
private String isBind; private String isBind;
//标签类型(数据字典) //标签类型(数据字典)
@Excel(name = "标签类型(数据字典)") @Excel(name = "标签类型(数据字典)")
@ApiModelProperty(value = "种类id")
private Long labelType; private Long labelType;
//数据所属组织 //数据所属组织
@Excel(name = "数据所属组织") @Excel(name = "数据所属组织")
@ApiModelProperty(value = "种类id")
private String companyId; 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 * @param maLabelBindVO 机具设备标签ma_label_bind
* @return 结果 * @return 结果
*/ */
public int insertMaLabelBind(MaLabelBindVO maLabelBindVO); public int insertMaLabelBindS(MaLabelBindVO maLabelBindVO);
/**
* 查询机具设备ma_id
*
* @param maCode
* @return 结果
*/
// public int selectMaMachineMaId(String maCode);
/** /**
* 修改机具设备标签ma_label_bind * 修改机具设备标签ma_label_bind
* *
@ -64,10 +70,12 @@ public interface MaLabelBindMapper
/** /**
* 批量删除机具设备标签ma_label_bind * 批量删除机具设备标签ma_label_bind
* *
* @param maId 需要删除的数据主键集合 * @param id 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int updateMaLabelBindByMaIds(Long maId); public int updateMaLabelBindByMaIds(Long id);
MaLabelBindVO selectMaMachineMaId(String maCode);
int insertLabelBind(MaLabelBind maLabelBind); 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

@ -2,6 +2,7 @@ package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaTypeFile; import com.bonus.sgzb.base.domain.MaTypeFile;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -12,8 +13,7 @@ import java.util.List;
* @date 2023-12-11 * @date 2023-12-11
*/ */
@Mapper @Mapper
public interface MaTypeFileMapper public interface MaTypeFileMapper {
{
/** /**
* 查询机具类型文件ma_type_file * 查询机具类型文件ma_type_file
* *
@ -52,7 +52,7 @@ public interface MaTypeFileMapper
* @param typeId 机具类型文件ma_type_file主键 * @param typeId 机具类型文件ma_type_file主键
* @return 结果 * @return 结果
*/ */
public int deleteMaTypeFileByTypeId(Long typeId); public int deleteMaTypeFileByTypeId(@Param("typeId") Long typeId, @Param("fileType") String fileType);
/** /**
* 批量删除机具类型文件ma_type_file * 批量删除机具类型文件ma_type_file

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.mapper.MaLabelBindMapper;
import com.bonus.sgzb.base.service.IMaLabelBindService; import com.bonus.sgzb.base.service.IMaLabelBindService;
import com.bonus.sgzb.base.vo.MaLabelBindVO; 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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -17,7 +19,7 @@ import java.util.List;
@Service @Service
public class MaLabelBindServiceImpl implements IMaLabelBindService public class MaLabelBindServiceImpl implements IMaLabelBindService
{ {
@Autowired @Resource
private MaLabelBindMapper maLabelBindMapper; private MaLabelBindMapper maLabelBindMapper;
/** /**
@ -64,9 +66,14 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService
@Override @Override
public int insertMaLabelBind(MaLabelBindVO maLabelBind) public int insertMaLabelBind(MaLabelBindVO maLabelBind)
{ {
maLabelBind.setBindTime("1"); int i = 0;
maLabelBind.setStatus("1"); MaLabelBindVO bean = maLabelBindMapper.selectMaMachineMaId(maLabelBind.getMaCode());
return maLabelBindMapper.insertMaLabelBind(maLabelBind); 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 * 批量删除机具设备标签ma_label_bind
* *
* @param maId 需要删除的机具设备标签ma_label_bind主键 * @param id 需要删除的机具设备标签ma_label_bind主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateMaLabelBindByMaIds(Long maId) public int updateMaLabelBindByMaIds(Long id)
{ {
//Long ma=Long.parseLong(String.valueOf(maId)); //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

@ -105,21 +105,23 @@ public class MaTypeServiceImpl implements ITypeService {
int i = maTypeMapper.updateType(maType); int i = maTypeMapper.updateType(maType);
// 图片路径保存 // 图片路径保存
if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) {
typeFileMapper.deleteMaTypeFileByTypeId(typeId,"1");
MaTypeFile typeFile = new MaTypeFile(); MaTypeFile typeFile = new MaTypeFile();
typeFile.setTypeId(typeId); typeFile.setTypeId(typeId);
typeFile.setFileName(maType.getPhotoName()); typeFile.setFileName(maType.getPhotoName());
typeFile.setFileUrl(maType.getPhotoUrl()); typeFile.setFileUrl(maType.getPhotoUrl());
typeFile.setFileType("1"); typeFile.setFileType("1");
typeFileMapper.updateMaTypeFile(typeFile); typeFileMapper.insertMaTypeFile(typeFile);
} }
// 文档路径保存 // 文档路径保存
if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) { if (StringUtils.isNotEmpty(maType.getDocumentName()) && StringUtils.isNotEmpty(maType.getDocumentUrl())) {
typeFileMapper.deleteMaTypeFileByTypeId(typeId,"2");
MaTypeFile typeFile1 = new MaTypeFile(); MaTypeFile typeFile1 = new MaTypeFile();
typeFile1.setTypeId(typeId); typeFile1.setTypeId(typeId);
typeFile1.setFileName(maType.getDocumentName()); typeFile1.setFileName(maType.getDocumentName());
typeFile1.setFileUrl(maType.getDocumentUrl()); typeFile1.setFileUrl(maType.getDocumentUrl());
typeFile1.setFileType("2"); typeFile1.setFileType("2");
typeFileMapper.updateMaTypeFile(typeFile1); typeFileMapper.insertMaTypeFile(typeFile1);
} }
// 库管员配置 // 库管员配置
if (maType.getKeeperUserId() >= 0L) { if (maType.getKeeperUserId() >= 0L) {

View File

@ -39,7 +39,6 @@ public class MaLabelBindVO {
//是否绑定(0 , 1 ) //是否绑定(0 , 1 )
@ApiModelProperty(value = "是否绑定(0 是, 1 否)") @ApiModelProperty(value = "是否绑定(0 是, 1 否)")
private String isBind; private String isBind;
//规格型号 //规格型号
@ApiModelProperty(value = "规格型号") @ApiModelProperty(value = "规格型号")
private String typeName; private String typeName;
@ -69,4 +68,10 @@ public class MaLabelBindVO {
//是否绑定(0 , 1 ) //是否绑定(0 , 1 )
@ApiModelProperty(value = "狀態") @ApiModelProperty(value = "狀態")
private String status; 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="kindName" column="kindName" />
<result property="isBind" column="is_bind" /> <result property="isBind" column="is_bind" />
<result property="name" column="name" /> <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> </resultMap>
<sql id="selectMaLabelBindVo"> <sql id="selectMaLabelBindVo">
@ -31,18 +33,19 @@
</sql> </sql>
<select id="selectMaLabelBindList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult"> <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, 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 mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code,user.user_name
FROM ma_label_bind a 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 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 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 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 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 ma_type_repair mtk ON mtk.type_id = mt.type_id
LEFT JOIN sys_dic dic ON dic.id = a.label_type 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 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_user user on user.user_id =a.binder
<where> <where>
<if test="labelCode != null and labelCode != ''"> and a.label_code = #{labelCode}</if> <if test="labelCode != null and labelCode != ''"> and a.label_code = #{labelCode}</if>
<if test="typeId != null "> and a.type_id = #{typeId}</if> <if test="typeId != null "> and a.type_id = #{typeId}</if>
@ -84,7 +87,7 @@
where ma_id = #{maId} where ma_id = #{maId}
</select> </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 insert into ma_label_bind
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maId != null">ma_id,</if> <if test="maId != null">ma_id,</if>
@ -93,7 +96,7 @@
<if test="binder != null">binder,</if> <if test="binder != null">binder,</if>
<if test="labelType != null">label_type,</if> <if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</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> <if test="status != null">status,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -126,28 +129,26 @@
<if test="binder != null">#{binder},</if> <if test="binder != null">#{binder},</if>
<if test="labelType != null">#{labelType},</if> <if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</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> <if test="status != null">#{status},</if>
</trim> </trim>
</insert> </insert>
<update id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO"> <update id="insertMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
update ma_label_bind update ma_label_bind
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">ma_id = #{maId},</if>
<if test="labelCode != null">label_code = #{labelCode},</if> <if test="labelCode != null">label_code = #{labelCode},</if>
<if test="typeId != null">type_id = #{typeId},</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="binder != null">binder = #{binder},</if>
<if test="labelType != null">label_type = #{labelType},</if> <if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if> <if test="companyId != null">company_id = #{companyId},</if>
</trim> </trim>
where ma_id = #{maId}
</update> </update>
<update id="updateMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO"> <update id="updateMaLabelBind" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO">
update ma_label_bind update ma_label_bind
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="labelCode != null">label_code = #{labelCode},</if> <if test="labelCode != null">label_code = #{labelCode},</if>
<if test="typeId != null">type_id = #{typeId},</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="binder != null">binder = #{binder},</if>
<if test="labelType != null">label_type = #{labelType},</if> <if test="labelType != null">label_type = #{labelType},</if>
<if test="companyId != null">company_id = #{companyId},</if> <if test="companyId != null">company_id = #{companyId},</if>
@ -160,6 +161,12 @@
</delete> </delete>
<update id="updateMaLabelBindByMaIds" parameterType="Long"> <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> </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> </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 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteMaTypeFileByTypeId" parameterType="Long"> <delete id="deleteMaTypeFileByTypeId" parameterType="Long">
delete from ma_type_file where type_id = #{typeId} delete from ma_type_file where type_id = #{typeId} and file_type = #{fileType}
</delete> </delete>
<delete id="deleteMaTypeFileByTypeIds" parameterType="String"> <delete id="deleteMaTypeFileByTypeIds" parameterType="String">

View File

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

View File

@ -22,13 +22,13 @@ public class SelectController {
private SelectService service; private SelectService service;
@ApiOperation(value = "往来单位下拉选") @ApiOperation(value = "往来单位下拉选")
@PostMapping("getUnitData") @PostMapping("getUnitCbx")
public AjaxResult getUnitData(SelectDto dto) { public AjaxResult getUnitData(SelectDto dto) {
return service.getUnitData(dto); return service.getUnitData(dto);
} }
@ApiOperation(value = "工程下拉选") @ApiOperation(value = "工程下拉选")
@PostMapping("getProData") @PostMapping("getSectionEngineeringCbx")
public AjaxResult getProData(SelectDto dto) { public AjaxResult getProData(SelectDto dto) {
return service.getProData(dto); return service.getProData(dto);
} }
@ -39,13 +39,6 @@ public class SelectController {
return service.getMaTypeData(dto); return service.getMaTypeData(dto);
} }
@ApiOperation(value = "机具类型下拉树")
@PostMapping("getMaTypeTreeData")
public AjaxResult getMaTypeTreeData(SelectDto dto){
// return service.getMaTypeTreeData(dto);
return null;
}
@ApiOperation(value = "数据字典下拉选") @ApiOperation(value = "数据字典下拉选")
@PostMapping("getDictByPidCbx") @PostMapping("getDictByPidCbx")
public AjaxResult getDictByPidCbx(SelectDto dto){ public AjaxResult getDictByPidCbx(SelectDto dto){
@ -75,4 +68,46 @@ public class SelectController {
public AjaxResult getUnitTypeCbx(SelectDto dto){ public AjaxResult getUnitTypeCbx(SelectDto dto){
return service.getUnitTypeCbx(dto); return service.getUnitTypeCbx(dto);
} }
@ApiOperation(value = "设备类型树")
@PostMapping("getDeviceTypeTree")
public AjaxResult getDeviceTypeTree(SelectDto dto){
return service.getDeviceTypeTree(dto);
}
@ApiOperation(value = "资产属性")
@PostMapping("getAssetAttributesCbx")
public AjaxResult getAssetAttributesCbx(SelectDto dto){
return service.getAssetAttributesCbx(dto);
}
@ApiOperation(value = "机具厂家")
@PostMapping("getDeviceFactoryCbx")
public AjaxResult getDeviceFactoryCbx(SelectDto dto){
return service.getDeviceFactoryCbx(dto);
}
@ApiOperation(value = "工程项目")
@PostMapping("getProCbx")
public AjaxResult getProCbx(SelectDto dto){
return service.getProCbx(dto);
}
@ApiOperation(value = "配件所属上级树")
@PostMapping("getAccessoryTree")
public AjaxResult getAccessoryTree(SelectDto dto){
return service.getAccessoryTree(dto);
}
@ApiOperation(value = "货架")
@PostMapping("getGoodsShelvesCbx")
public AjaxResult getGoodsShelvesCbx(SelectDto dto){
return service.getGoodsShelvesCbx(dto);
}
@ApiOperation(value = "用户/维修员/库管员/采购员")
@PostMapping("getUserByRoleIdCbx")
public AjaxResult getUserByRoleIdCbx(SelectDto dto){
return service.getUserByRoleIdCbx(dto);
}
} }

View File

@ -2,6 +2,8 @@ package com.bonus.sgzb.system.domain;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author 10488 * @author 10488
*/ */
@ -19,4 +21,8 @@ public class SelectDto {
/** 层级*/ /** 层级*/
private String level; private String level;
/** 角色权限字符串*/
private String roleKey;
} }

View File

@ -84,4 +84,76 @@ public interface SelectMapper {
* @date 2023/12/20 18:01 * @date 2023/12/20 18:01
*/ */
List<SelectVo> getUnitTypeCbx(SelectDto dto); List<SelectVo> getUnitTypeCbx(SelectDto dto);
/**
* @param dto
* @return List<TreeNode>
* @description 设备类型树
* @author cwchen
* @date 2023/12/20 18:15
*/
List<TreeNode> getDeviceTypeTree(SelectDto dto);
/**
* @param dto
* @return List<SelectVo>
* @description 资产属性
* @author cwchen
* @date 2023/12/20 19:48
*/
List<SelectVo> getAssetAttributesCbx(SelectDto dto);
/**
* @param dto
* @return List<SelectVo>
* @description 机具厂家
* @author cwchen
* @date 2023/12/20 19:57
*/
List<SelectVo> getDeviceFactoryCbx(SelectDto dto);
/**
* @param dto
* @return List<SelectVo>
* @description 工程项目
* @author cwchen
* @date 2023/12/20 20:01
*/
List<SelectVo> getProCbx(SelectDto dto);
/**
* @param dto
* @return List<TreeNode>
* @description 配件所属上级树
* @author cwchen
* @date 2023/12/20 20:26
*/
List<TreeNode> getAccessoryTree(SelectDto dto);
/**
* @param dto
* @return List<TreeNode>
* @description 货架
* @author cwchen
* @date 2023/12/20 20:36
*/
List<TreeNode> getGoodsShelvesCbx(SelectDto dto);
/**
* @param dto
* @return List<SelectVo>
* @description 用户/维修员/库管员/采购员-下拉选
* @author cwchen
* @date 2023/12/20 20:54
*/
List<SelectVo> getUserByRoleIdCbxSelect(SelectDto dto);
/**
* @param dto
* @return List<TreeNode>
* @description 用户/维修员/库管员/采购员-
* @author cwchen
* @date 2023/12/20 21:02
*/
List<TreeNode> getUserByRoleIdCbxTree(SelectDto dto);
} }

View File

@ -36,15 +36,6 @@ public interface SelectService {
*/ */
AjaxResult getMaTypeData(SelectDto dto); AjaxResult getMaTypeData(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 机具类型-下拉树
* @author cwchen
* @date 2023/12/20 16:10
*/
// AjaxResult getMaTypeTreeData(SelectDto dto);
/** /**
* @param dto * @param dto
* @return AjaxResult * @return AjaxResult
@ -89,4 +80,67 @@ public interface SelectService {
* @date 2023/12/20 18:00 * @date 2023/12/20 18:00
*/ */
AjaxResult getUnitTypeCbx(SelectDto dto); AjaxResult getUnitTypeCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 设备类型树
* @author cwchen
* @date 2023/12/20 18:14
*/
AjaxResult getDeviceTypeTree(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 资产属性
* @author cwchen
* @date 2023/12/20 19:47
*/
AjaxResult getAssetAttributesCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 机具厂家
* @author cwchen
* @date 2023/12/20 19:56
*/
AjaxResult getDeviceFactoryCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 工程项目
* @author cwchen
* @date 2023/12/20 20:01
*/
AjaxResult getProCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 配件所属上级树
* @author cwchen
* @date 2023/12/20 20:25
*/
AjaxResult getAccessoryTree(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 货架
* @author cwchen
* @date 2023/12/20 20:36
*/
AjaxResult getGoodsShelvesCbx(SelectDto dto);
/**
* @param dto
* @return AjaxResult
* @description 用户/维修员/库管员/采购员
* @author cwchen
* @date 2023/12/20 20:48
*/
AjaxResult getUserByRoleIdCbx(SelectDto dto);
} }

View File

@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author 10488 * @author 10488
@ -120,4 +121,118 @@ public class SelectServiceImpl implements SelectService {
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Override
public AjaxResult getDeviceTypeTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getDeviceTypeTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("单位树/归属部门/所属上级-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getAssetAttributesCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getAssetAttributesCbx(dto);
} catch (Exception e) {
log.error("资产属性-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getDeviceFactoryCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getDeviceFactoryCbx(dto);
} catch (Exception e) {
log.error("机具厂家-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getProCbx(SelectDto dto) {
List<SelectVo> list = new ArrayList<>();
try {
list = mapper.getProCbx(dto);
} catch (Exception e) {
log.error("工程项目-查询失败", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getAccessoryTree(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getAccessoryTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("配件所属上级树-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getGoodsShelvesCbx(SelectDto dto) {
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
try {
list = mapper.getGoodsShelvesCbx(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
} catch (Exception e) {
log.error("货架-查询失败", e);
}
return AjaxResult.success(groupList);
}
@Override
public AjaxResult getUserByRoleIdCbx(SelectDto dto) {
try {
if(Objects.equals("1",dto.getType())){
// 用户/维修员/库管员/采购员-下拉选
List<SelectVo> list = new ArrayList<>();
list = mapper.getUserByRoleIdCbxSelect(dto);
return AjaxResult.success(list);
}else if(Objects.equals("2",dto.getType())){
List<TreeNode> groupList = new ArrayList<>();
List<TreeNode> list = new ArrayList<>();
// 用户/维修员/库管员/采购员-
list = mapper.getUserByRoleIdCbxTree(dto);
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
TreeBuild treeBuild = new TreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
}
return AjaxResult.success(groupList);
}
} catch (Exception e) {
log.error("用户/维修员/库管员/采购员-查询失败",e);
}
return AjaxResult.success(null);
}
} }

View File

@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<!--工程--> <!--标段工程-->
<select id="getProData" resultType="com.bonus.sgzb.system.domain.SelectVo"> <select id="getProData" resultType="com.bonus.sgzb.system.domain.SelectVo">
/*根据往来单位id关联协议查询工程*/ /*根据往来单位id关联协议查询工程*/
<if test="id != null and id != ''"> <if test="id != null and id != ''">
@ -88,4 +88,90 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id LEFT JOIN sys_dic sd2 ON sd.id = sd2.p_id
WHERE sd.`value` = #{parentValue} AND sd.p_id = 0 WHERE sd.`value` = #{parentValue} AND sd.p_id = 0
</select> </select>
<!--设备类型树-->
<select id="getDeviceTypeTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT type_id AS id,
type_name AS label,
parent_id AS parentId
FROM ma_type
WHERE del_flag = '0'
<if test="level!=null and level!=''">
<if test="level == 2">
AND level IN ('1','2')
</if>
<if test="level == 3">
AND level IN ('1','2','3')
</if>
<if test="level == 4">
AND level IN ('1','2','3','4')
</if>
</if>
ORDER BY create_time
</select>
<!--资产属性-->
<select id="getAssetAttributesCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT prop_id AS id,
prop_name AS `name`
FROM ma_prop_info
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--机具厂家-->
<select id="getDeviceFactoryCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT supplier_id AS id,
supplier AS `name`
FROM ma_supplier_info
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--工程项目-->
<select id="getProCbx" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT pro_id AS id,
pro_name AS `name`
FROM bm_project_info
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--配件所属上级树-->
<select id="getAccessoryTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT pa_id AS id,
pa_name AS label,
parent_id AS parentId
FROM ma_part_type
WHERE del_flag = '0'
ORDER BY create_time
</select>
<!--货架-->
<select id="getGoodsShelvesCbx" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT house_id AS id,
house_name AS label,
parent_id AS parentId
FROM ma_house_info
WHERE del_flag = '0' AND status = '0'
</select>
<!--用户/维修员/库管员/采购员-下拉选-->
<select id="getUserByRoleIdCbxSelect" resultType="com.bonus.sgzb.system.domain.SelectVo">
SELECT su.user_id AS id,
su.user_name AS `name`
FROM sys_role sr
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
</select>
<!--用户/维修员/库管员/采购员--->
<select id="getUserByRoleIdCbxTree" resultType="com.bonus.sgzb.system.domain.TreeNode">
SELECT dept_id AS id,
parent_id AS parentId,
dept_name AS label
FROM sys_dept
WHERE del_flag = '0'
UNION ALL
SELECT su.user_id AS id,
su.dept_id AS parentId,
su.user_name AS label
FROM sys_role sr
LEFT JOIN sys_user_role sur ON sr.role_id = sur.role_id
LEFT JOIN sys_user su ON sur.user_id = su.user_id AND su.del_flag = '0'
WHERE sr.role_key = #{roleKey} AND sr.del_flag = '0'
</select>
</mapper> </mapper>

View File

@ -233,7 +233,7 @@
size="mini" size="mini"
type="warning" type="warning"
icon="el-icon-edit" icon="el-icon-edit"
:disabled="scope.row.repairStatusCode !== 43" :disabled="scope.row.repairStatusCode !== '43'"
@click="handleUpdate(scope.row, 'update')" @click="handleUpdate(scope.row, 'update')"
v-hasPermi="['store:labelType:edit']" v-hasPermi="['store:labelType:edit']"
>维修</el-button >维修</el-button
@ -261,7 +261,7 @@
<!-- 维修对话框 --> <!-- 维修对话框 -->
<el-dialog <el-dialog
:visible.sync="open" :visible.sync="open"
width="1000px" width="1400px"
append-to-body append-to-body
:before-close="onClose" :before-close="onClose"
> >

View File

@ -524,6 +524,8 @@ export default {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "绑定"; this.title = "绑定";
this.form.id = this.ids[0].id;
this.form.typeId = this.ids[0].typeId;
this.form.maId = this.ids[0].maId; this.form.maId = this.ids[0].maId;
this.form.labelType = this.ids[0].labelType; this.form.labelType = this.ids[0].labelType;
this.form.labelCode = this.ids[0].labelCode; this.form.labelCode = this.ids[0].labelCode;