设备型号管理
This commit is contained in:
parent
b600d08344
commit
4a38fb84a0
@ -105,7 +105,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -60,7 +60,16 @@
|
||||
<version>3.8.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,110 @@
|
||||
package com.fastbee.data.controller.deviceModel;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.enums.BusinessType;
|
||||
import com.fastbee.deviceModel.domain.DeviceModel;
|
||||
import com.fastbee.deviceModel.service.IDeviceModelService;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备型号Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deviceModel/model")
|
||||
@Api(tags = "设备型号")
|
||||
public class DeviceModelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceModelService deviceModelService;
|
||||
|
||||
/**
|
||||
* 查询设备型号列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询设备型号列表")
|
||||
public TableDataInfo list(DeviceModel deviceModel)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备型号列表
|
||||
*/
|
||||
@ApiOperation("导出设备型号列表")
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceModel deviceModel)
|
||||
{
|
||||
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
||||
ExcelUtil<DeviceModel> util = new ExcelUtil<DeviceModel>(DeviceModel.class);
|
||||
util.exportExcel(response, list, "设备型号数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备型号详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:query')")
|
||||
@GetMapping(value = "/{modelId}")
|
||||
@ApiOperation("获取设备型号详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("modelId") Long modelId)
|
||||
{
|
||||
return success(deviceModelService.selectDeviceModelByModelId(modelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备型号
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增设备型号")
|
||||
public AjaxResult add(@RequestBody DeviceModel deviceModel)
|
||||
{
|
||||
return toAjax(deviceModelService.insertDeviceModel(deviceModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备型号
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改设备型号")
|
||||
public AjaxResult edit(@RequestBody DeviceModel deviceModel)
|
||||
{
|
||||
return toAjax(deviceModelService.updateDeviceModel(deviceModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备型号
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('deviceModel:model:remove')")
|
||||
@DeleteMapping("/{modelIds}")
|
||||
@ApiOperation("删除设备型号")
|
||||
public AjaxResult remove(@PathVariable Long[] modelIds)
|
||||
{
|
||||
return toAjax(deviceModelService.deleteDeviceModelByModelIds(modelIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.fastbee.deviceModel.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备型号对象 iot_device_model
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-17
|
||||
*/
|
||||
@ApiModel(value = "DeviceModel",description = "设备型号 iot_device_model")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeviceModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long modelId;
|
||||
|
||||
/** 型号 */
|
||||
@Excel(name = "型号")
|
||||
@ApiModelProperty("型号")
|
||||
private String model;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
@ApiModelProperty("图片")
|
||||
private String image;
|
||||
|
||||
/** 删除标志(0代表存在,2代表删除) */
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.deviceModel.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.deviceModel.domain.DeviceModel;
|
||||
|
||||
/**
|
||||
* 设备型号Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-17
|
||||
*/
|
||||
public interface DeviceModelMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备型号
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 设备型号
|
||||
*/
|
||||
public DeviceModel selectDeviceModelByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询设备型号列表
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 设备型号集合
|
||||
*/
|
||||
public List<DeviceModel> selectDeviceModelList(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 新增设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceModel(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 修改设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceModel(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 删除设备型号
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceModelByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 批量删除设备型号
|
||||
*
|
||||
* @param modelIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceModelByModelIds(Long[] modelIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.fastbee.deviceModel.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.deviceModel.domain.DeviceModel;
|
||||
|
||||
/**
|
||||
* 设备型号Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-17
|
||||
*/
|
||||
public interface IDeviceModelService
|
||||
{
|
||||
/**
|
||||
* 查询设备型号
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 设备型号
|
||||
*/
|
||||
public DeviceModel selectDeviceModelByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询设备型号列表
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 设备型号集合
|
||||
*/
|
||||
public List<DeviceModel> selectDeviceModelList(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 新增设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceModel(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 修改设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceModel(DeviceModel deviceModel);
|
||||
|
||||
/**
|
||||
* 批量删除设备型号
|
||||
*
|
||||
* @param modelIds 需要删除的设备型号主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceModelByModelIds(Long[] modelIds);
|
||||
|
||||
/**
|
||||
* 删除设备型号信息
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceModelByModelId(Long modelId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.fastbee.deviceModel.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.deviceModel.mapper.DeviceModelMapper;
|
||||
import com.fastbee.deviceModel.domain.DeviceModel;
|
||||
import com.fastbee.deviceModel.service.IDeviceModelService;
|
||||
|
||||
/**
|
||||
* 设备型号Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-17
|
||||
*/
|
||||
@Service
|
||||
public class DeviceModelServiceImpl implements IDeviceModelService
|
||||
{
|
||||
@Autowired
|
||||
private DeviceModelMapper deviceModelMapper;
|
||||
|
||||
/**
|
||||
* 查询设备型号
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 设备型号
|
||||
*/
|
||||
@Override
|
||||
public DeviceModel selectDeviceModelByModelId(Long modelId)
|
||||
{
|
||||
return deviceModelMapper.selectDeviceModelByModelId(modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备型号列表
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 设备型号
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceModel> selectDeviceModelList(DeviceModel deviceModel)
|
||||
{
|
||||
return deviceModelMapper.selectDeviceModelList(deviceModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDeviceModel(DeviceModel deviceModel)
|
||||
{
|
||||
deviceModel.setCreateTime(DateUtils.getNowDate());
|
||||
return deviceModelMapper.insertDeviceModel(deviceModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备型号
|
||||
*
|
||||
* @param deviceModel 设备型号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDeviceModel(DeviceModel deviceModel)
|
||||
{
|
||||
deviceModel.setUpdateTime(DateUtils.getNowDate());
|
||||
return deviceModelMapper.updateDeviceModel(deviceModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备型号
|
||||
*
|
||||
* @param modelIds 需要删除的设备型号主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceModelByModelIds(Long[] modelIds)
|
||||
{
|
||||
return deviceModelMapper.deleteDeviceModelByModelIds(modelIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备型号信息
|
||||
*
|
||||
* @param modelId 设备型号主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceModelByModelId(Long modelId)
|
||||
{
|
||||
return deviceModelMapper.deleteDeviceModelByModelId(modelId);
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?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.fastbee.deviceModel.mapper.DeviceModelMapper">
|
||||
|
||||
<resultMap type="DeviceModel" id="DeviceModelResult">
|
||||
<result property="modelId" column="model_id" />
|
||||
<result property="model" column="model" />
|
||||
<result property="image" column="image" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceModelVo">
|
||||
select model_id, model, image, del_flag, create_time, create_by, update_time, update_by from iot_device_model
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceModelList" parameterType="DeviceModel" resultMap="DeviceModelResult">
|
||||
<include refid="selectDeviceModelVo"/>
|
||||
<where>
|
||||
<if test="model != null and model != ''"> and model = #{model}</if>
|
||||
<if test="image != null and image != ''"> and image = #{image}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceModelByModelId" parameterType="Long" resultMap="DeviceModelResult">
|
||||
<include refid="selectDeviceModelVo"/>
|
||||
where model_id = #{modelId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceModel" parameterType="DeviceModel" useGeneratedKeys="true" keyProperty="modelId">
|
||||
insert into iot_device_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="model != null">model,</if>
|
||||
<if test="image != null">image,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="model != null">#{model},</if>
|
||||
<if test="image != null">#{image},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceModel" parameterType="DeviceModel">
|
||||
update iot_device_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="model != null">model = #{model},</if>
|
||||
<if test="image != null">image = #{image},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where model_id = #{modelId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceModelByModelId" parameterType="Long">
|
||||
delete from iot_device_model where model_id = #{modelId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeviceModelByModelIds" parameterType="String">
|
||||
delete from iot_device_model where model_id in
|
||||
<foreach item="modelId" collection="array" open="(" separator="," close=")">
|
||||
#{modelId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user