feat(asset): 新增RFID标签管理功能基础CRUD
- 创建AmsRfidTag实体类定义标签相关属性字段 - 实现AmsRfidTagController控制器提供完整的CRUD操作接口 - 开发AmsRfidTagService业务层处理标签数据逻辑 - 创建AmsRfidTagMapper数据访问层实现数据库操作 - 设计标签列表页面展示标签信息及筛选功能 - 添加标签新增表单页面支持标签基本信息录入 - 实现标签修改编辑页面提供数据更新功能 - 集成权限控制和数据验证机制 - 支持标签数据导出Excel功能 - 实现批量删除和单个删除标签功能main
parent
78e83ee66d
commit
56ea5c13f5
@ -0,0 +1,140 @@
|
||||
package com.ruoyi.asset.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.asset.domain.AmsRfidTag;
|
||||
import com.ruoyi.asset.service.IAmsRfidTagService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* RFID标签Controller
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-05
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/asset/tag")
|
||||
public class AmsRfidTagController extends BaseController
|
||||
{
|
||||
private String prefix = "asset/tag";
|
||||
|
||||
@Autowired
|
||||
private IAmsRfidTagService amsRfidTagService;
|
||||
|
||||
@RequiresPermissions("asset:tag:view")
|
||||
@GetMapping()
|
||||
public String tag()
|
||||
{
|
||||
return prefix + "/tag";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询RFID标签列表
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
startPage();
|
||||
List<AmsRfidTag> list = amsRfidTagService.selectAmsRfidTagList(amsRfidTag);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出RFID标签列表
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:export")
|
||||
@Log(title = "RFID标签", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
List<AmsRfidTag> list = amsRfidTagService.selectAmsRfidTagList(amsRfidTag);
|
||||
ExcelUtil<AmsRfidTag> util = new ExcelUtil<AmsRfidTag>(AmsRfidTag.class);
|
||||
return util.exportExcel(list, "RFID标签数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看RFID标签详情
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:view")
|
||||
@GetMapping("/view/{tagId}")
|
||||
public String view(@PathVariable("tagId") Long tagId, ModelMap mmap)
|
||||
{
|
||||
AmsRfidTag amsRfidTag = amsRfidTagService.selectAmsRfidTagByTagId(tagId);
|
||||
mmap.put("amsRfidTag", amsRfidTag);
|
||||
return prefix + "/view";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增RFID标签
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:add")
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存RFID标签
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:add")
|
||||
@Log(title = "RFID标签", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
return toAjax(amsRfidTagService.insertAmsRfidTag(amsRfidTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改RFID标签
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:edit")
|
||||
@GetMapping("/edit/{tagId}")
|
||||
public String edit(@PathVariable("tagId") Long tagId, ModelMap mmap)
|
||||
{
|
||||
AmsRfidTag amsRfidTag = amsRfidTagService.selectAmsRfidTagByTagId(tagId);
|
||||
mmap.put("amsRfidTag", amsRfidTag);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存RFID标签
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:edit")
|
||||
@Log(title = "RFID标签", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
return toAjax(amsRfidTagService.updateAmsRfidTag(amsRfidTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除RFID标签
|
||||
*/
|
||||
@RequiresPermissions("asset:tag:remove")
|
||||
@Log(title = "RFID标签", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(amsRfidTagService.deleteAmsRfidTagByTagIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.asset.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.asset.domain.AmsRfidTag;
|
||||
|
||||
/**
|
||||
* RFID标签Mapper接口
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-05
|
||||
*/
|
||||
public interface AmsRfidTagMapper
|
||||
{
|
||||
/**
|
||||
* 查询RFID标签
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return RFID标签
|
||||
*/
|
||||
public AmsRfidTag selectAmsRfidTagByTagId(Long tagId);
|
||||
|
||||
/**
|
||||
* 查询RFID标签列表
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return RFID标签集合
|
||||
*/
|
||||
public List<AmsRfidTag> selectAmsRfidTagList(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 新增RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAmsRfidTag(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 修改RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAmsRfidTag(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 删除RFID标签
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsRfidTagByTagId(Long tagId);
|
||||
|
||||
/**
|
||||
* 批量删除RFID标签
|
||||
*
|
||||
* @param tagIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsRfidTagByTagIds(String[] tagIds);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.asset.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.asset.domain.AmsRfidTag;
|
||||
|
||||
/**
|
||||
* RFID标签Service接口
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-05
|
||||
*/
|
||||
public interface IAmsRfidTagService
|
||||
{
|
||||
/**
|
||||
* 查询RFID标签
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return RFID标签
|
||||
*/
|
||||
public AmsRfidTag selectAmsRfidTagByTagId(Long tagId);
|
||||
|
||||
/**
|
||||
* 查询RFID标签列表
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return RFID标签集合
|
||||
*/
|
||||
public List<AmsRfidTag> selectAmsRfidTagList(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 新增RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAmsRfidTag(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 修改RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAmsRfidTag(AmsRfidTag amsRfidTag);
|
||||
|
||||
/**
|
||||
* 批量删除RFID标签
|
||||
*
|
||||
* @param tagIds 需要删除的RFID标签主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsRfidTagByTagIds(String tagIds);
|
||||
|
||||
/**
|
||||
* 删除RFID标签信息
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsRfidTagByTagId(Long tagId);
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.asset.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.asset.mapper.AmsRfidTagMapper;
|
||||
import com.ruoyi.asset.domain.AmsRfidTag;
|
||||
import com.ruoyi.asset.service.IAmsRfidTagService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* RFID标签Service业务层处理
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-05
|
||||
*/
|
||||
@Service
|
||||
public class AmsRfidTagServiceImpl implements IAmsRfidTagService
|
||||
{
|
||||
@Autowired
|
||||
private AmsRfidTagMapper amsRfidTagMapper;
|
||||
|
||||
/**
|
||||
* 查询RFID标签
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return RFID标签
|
||||
*/
|
||||
@Override
|
||||
public AmsRfidTag selectAmsRfidTagByTagId(Long tagId)
|
||||
{
|
||||
return amsRfidTagMapper.selectAmsRfidTagByTagId(tagId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询RFID标签列表
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return RFID标签
|
||||
*/
|
||||
@Override
|
||||
public List<AmsRfidTag> selectAmsRfidTagList(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
return amsRfidTagMapper.selectAmsRfidTagList(amsRfidTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAmsRfidTag(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
amsRfidTag.setCreateTime(DateUtils.getNowDate());
|
||||
return amsRfidTagMapper.insertAmsRfidTag(amsRfidTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改RFID标签
|
||||
*
|
||||
* @param amsRfidTag RFID标签
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAmsRfidTag(AmsRfidTag amsRfidTag)
|
||||
{
|
||||
amsRfidTag.setUpdateTime(DateUtils.getNowDate());
|
||||
return amsRfidTagMapper.updateAmsRfidTag(amsRfidTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除RFID标签
|
||||
*
|
||||
* @param tagIds 需要删除的RFID标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAmsRfidTagByTagIds(String tagIds)
|
||||
{
|
||||
return amsRfidTagMapper.deleteAmsRfidTagByTagIds(Convert.toStrArray(tagIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除RFID标签信息
|
||||
*
|
||||
* @param tagId RFID标签主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAmsRfidTagByTagId(Long tagId)
|
||||
{
|
||||
return amsRfidTagMapper.deleteAmsRfidTagByTagId(tagId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
<?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.ruoyi.asset.mapper.AmsRfidTagMapper">
|
||||
|
||||
<resultMap type="AmsRfidTag" id="AmsRfidTagResult">
|
||||
<result property="tagId" column="tag_id" />
|
||||
<result property="tagCode" column="tag_code" />
|
||||
<result property="epcCode" column="epc_code" />
|
||||
<result property="tagStatus" column="tag_status" />
|
||||
<result property="bindStatus" column="bind_status" />
|
||||
<result property="assetId" column="asset_id" />
|
||||
<result property="assetCode" column="asset_code" />
|
||||
<result property="assetName" column="asset_name" />
|
||||
<result property="bindTime" column="bind_time" />
|
||||
<result property="bindUserId" column="bind_user_id" />
|
||||
<result property="bindUserName" column="bind_user_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAmsRfidTagVo">
|
||||
select tag_id, tag_code, epc_code, tag_status, bind_status, asset_id, asset_code, asset_name, bind_time, bind_user_id, bind_user_name, create_by, create_time, update_by, update_time, remark, del_flag from ams_rfid_tag
|
||||
</sql>
|
||||
|
||||
<select id="selectAmsRfidTagList" parameterType="AmsRfidTag" resultMap="AmsRfidTagResult">
|
||||
<include refid="selectAmsRfidTagVo"/>
|
||||
<where>
|
||||
<if test="tagCode != null and tagCode != ''"> and tag_code = #{tagCode}</if>
|
||||
<if test="epcCode != null and epcCode != ''"> and epc_code = #{epcCode}</if>
|
||||
<if test="tagStatus != null and tagStatus != ''"> and tag_status = #{tagStatus}</if>
|
||||
<if test="bindStatus != null and bindStatus != ''"> and bind_status = #{bindStatus}</if>
|
||||
<if test="assetId != null "> and asset_id = #{assetId}</if>
|
||||
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if>
|
||||
<if test="assetName != null and assetName != ''"> and asset_name like concat('%', #{assetName}, '%')</if>
|
||||
<if test="bindTime != null "> and bind_time = #{bindTime}</if>
|
||||
<if test="bindUserId != null "> and bind_user_id = #{bindUserId}</if>
|
||||
<if test="bindUserName != null and bindUserName != ''"> and bind_user_name like concat('%', #{bindUserName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAmsRfidTagByTagId" parameterType="Long" resultMap="AmsRfidTagResult">
|
||||
<include refid="selectAmsRfidTagVo"/>
|
||||
where tag_id = #{tagId}
|
||||
</select>
|
||||
|
||||
<insert id="insertAmsRfidTag" parameterType="AmsRfidTag" useGeneratedKeys="true" keyProperty="tagId">
|
||||
insert into ams_rfid_tag
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tagCode != null and tagCode != ''">tag_code,</if>
|
||||
<if test="epcCode != null and epcCode != ''">epc_code,</if>
|
||||
<if test="tagStatus != null and tagStatus != ''">tag_status,</if>
|
||||
<if test="bindStatus != null and bindStatus != ''">bind_status,</if>
|
||||
<if test="assetId != null">asset_id,</if>
|
||||
<if test="assetCode != null">asset_code,</if>
|
||||
<if test="assetName != null">asset_name,</if>
|
||||
<if test="bindTime != null">bind_time,</if>
|
||||
<if test="bindUserId != null">bind_user_id,</if>
|
||||
<if test="bindUserName != null">bind_user_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tagCode != null and tagCode != ''">#{tagCode},</if>
|
||||
<if test="epcCode != null and epcCode != ''">#{epcCode},</if>
|
||||
<if test="tagStatus != null and tagStatus != ''">#{tagStatus},</if>
|
||||
<if test="bindStatus != null and bindStatus != ''">#{bindStatus},</if>
|
||||
<if test="assetId != null">#{assetId},</if>
|
||||
<if test="assetCode != null">#{assetCode},</if>
|
||||
<if test="assetName != null">#{assetName},</if>
|
||||
<if test="bindTime != null">#{bindTime},</if>
|
||||
<if test="bindUserId != null">#{bindUserId},</if>
|
||||
<if test="bindUserName != null">#{bindUserName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAmsRfidTag" parameterType="AmsRfidTag">
|
||||
update ams_rfid_tag
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="tagCode != null and tagCode != ''">tag_code = #{tagCode},</if>
|
||||
<if test="epcCode != null and epcCode != ''">epc_code = #{epcCode},</if>
|
||||
<if test="tagStatus != null and tagStatus != ''">tag_status = #{tagStatus},</if>
|
||||
<if test="bindStatus != null and bindStatus != ''">bind_status = #{bindStatus},</if>
|
||||
<if test="assetId != null">asset_id = #{assetId},</if>
|
||||
<if test="assetCode != null">asset_code = #{assetCode},</if>
|
||||
<if test="assetName != null">asset_name = #{assetName},</if>
|
||||
<if test="bindTime != null">bind_time = #{bindTime},</if>
|
||||
<if test="bindUserId != null">bind_user_id = #{bindUserId},</if>
|
||||
<if test="bindUserName != null">bind_user_name = #{bindUserName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where tag_id = #{tagId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAmsRfidTagByTagId" parameterType="Long">
|
||||
delete from ams_rfid_tag where tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAmsRfidTagByTagIds" parameterType="String">
|
||||
delete from ams_rfid_tag where tag_id in
|
||||
<foreach item="tagId" collection="array" open="(" separator="," close=")">
|
||||
#{tagId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue