瀏覽代碼

设备管理API更新

shudonghui 1 年之前
父節點
當前提交
5872d63025

+ 58 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/SysDeviceBrand.java

@@ -0,0 +1,58 @@
+package com.qmth.sop.business.entity;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.base.BaseEntity;
+import com.qmth.sop.common.contant.SystemConstant;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 设备品牌表 模型.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:06
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@ApiModel(value = "sys_device_brand对象", description = "设备品牌表")
+public class SysDeviceBrand extends BaseEntity implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+  	@ApiModelProperty(value = "品牌")
+	@NotBlank(message = "品牌不能为空")
+  	private String brand;
+
+	/**
+	 * 品牌
+	 */	
+  	public void setBrand(String brand) {
+		this.brand = brand;
+  	}
+ 	/**
+	 * 品牌
+	 */	 	
+  	public String getBrand() {
+		return brand;
+  	}
+
+	@ApiModelProperty(value = "型号列表")
+	@TableField(exist = false)
+	List<SysDeviceModel> list=new ArrayList<>();
+
+	public List<SysDeviceModel> getList() {
+		return list;
+	}
+
+	public void setList(List<SysDeviceModel> list) {
+		this.list = list;
+	}
+}

+ 60 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/SysDeviceModel.java

@@ -0,0 +1,60 @@
+package com.qmth.sop.business.entity;
+
+import java.io.Serializable;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.base.BaseEntity;
+import com.qmth.sop.common.contant.SystemConstant;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 设备品牌型号表 模型.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@ApiModel(value = "sys_device_model对象", description = "设备品牌型号表")
+public class SysDeviceModel extends BaseEntity implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+  	@ApiModelProperty(value = "品牌ID")
+	@JsonSerialize(using = ToStringSerializer.class)
+	@NotNull(message = "品牌ID不能为空")
+  	private long brandId;
+
+  	@ApiModelProperty(value = "型号")
+	@NotBlank(message = "型号不能为空")
+  	private String model;
+
+	/**
+	 * 品牌ID
+	 */	
+  	public void setBrandId(long brandId) {
+		this.brandId = brandId;
+  	}
+ 	/**
+	 * 品牌ID
+	 */	 	
+  	public long getBrandId() {
+		return brandId;
+  	}
+	/**
+	 * 型号
+	 */	
+  	public void setModel(String model) {
+		this.model = model;
+  	}
+ 	/**
+	 * 型号
+	 */	 	
+  	public String getModel() {
+		return model;
+  	}
+}

+ 28 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/SysDeviceBrandMapper.java

@@ -0,0 +1,28 @@
+package com.qmth.sop.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.entity.SysDeviceBrand;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Param;
+import java.util.Map;
+
+/**
+ * 设备品牌表 Mapper 接口.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:07
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDeviceBrandMapper extends BaseMapper<SysDeviceBrand> {
+
+	/**
+	 * 查询列表
+	 * @param iPage
+	 * @return
+	 */
+	public IPage<SysDeviceBrand> query(IPage<Map> iPage, @Param("query") String query);
+
+}

+ 28 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/SysDeviceModelMapper.java

@@ -0,0 +1,28 @@
+package com.qmth.sop.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.entity.SysDeviceModel;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Param;
+import java.util.Map;
+
+/**
+ * 设备品牌型号表 Mapper 接口.
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDeviceModelMapper extends BaseMapper<SysDeviceModel> {
+
+	/**
+	 * 查询列表
+	 * @param iPage
+	 * @return
+	 */
+	public IPage<SysDeviceModel> query(IPage<Map> iPage, @Param("query") String query);
+
+}

+ 43 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysDeviceBrandService.java

@@ -0,0 +1,43 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.SysDeviceBrand;
+import java.util.Map;
+
+/**
+ * 设备品牌表 服务类
+ *
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDeviceBrandService extends IService<SysDeviceBrand>{
+
+    /**
+    * 查询列表
+    *
+    * @param iPage
+    * @return
+    */
+    IPage<SysDeviceBrand> query(IPage<Map> iPage,String query);
+
+    /**
+    * 新增修改设备品牌表
+    *
+    * @param sysDeviceBrand
+    */
+    Boolean saveSysDeviceBrand(SysDeviceBrand sysDeviceBrand);
+
+
+    /**
+    * 删除设备品牌表
+    *
+    * @param id
+    */
+    Boolean delete(Long id);
+
+
+}

+ 43 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysDeviceModelService.java

@@ -0,0 +1,43 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.SysDeviceModel;
+import java.util.Map;
+
+/**
+ * 设备品牌型号表 服务类
+ *
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+public interface SysDeviceModelService extends IService<SysDeviceModel>{
+
+    /**
+    * 查询列表
+    *
+    * @param iPage
+    * @return
+    */
+    IPage<SysDeviceModel> query(IPage<Map> iPage,String query);
+
+    /**
+    * 新增修改设备品牌型号表
+    *
+    * @param sysDeviceModel
+    */
+    Boolean saveSysDeviceModel(SysDeviceModel sysDeviceModel);
+
+
+    /**
+    * 删除设备品牌型号表
+    *
+    * @param id
+    */
+    Boolean delete(Long id);
+
+
+}

+ 88 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysDeviceBrandServiceImpl.java

@@ -0,0 +1,88 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.entity.SysDeviceBrand;
+import com.qmth.sop.business.entity.SysUser;
+import com.qmth.sop.business.mapper.SysDeviceBrandMapper;
+import com.qmth.sop.business.service.SysDeviceBrandService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.FieldUniqueEnum;
+import com.qmth.sop.common.util.ResultUtil;
+import com.qmth.sop.common.util.ServletUtil;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * 设备品牌表 服务实现.
+ *
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Service
+public class SysDeviceBrandServiceImpl extends ServiceImpl<SysDeviceBrandMapper, SysDeviceBrand> implements SysDeviceBrandService{
+
+
+		/**
+		* 查询列表
+		*
+		* @param iPage
+		* @return
+		*/
+		@Override
+		public IPage<SysDeviceBrand> query(IPage<Map> iPage,String query) {
+				return this.baseMapper.query(iPage,query);
+		}
+		/**
+		* 新增修改设备品牌表
+		*
+		* @param sysDeviceBrand
+		*/
+		@Override
+		@Transactional
+		public Boolean saveSysDeviceBrand(SysDeviceBrand sysDeviceBrand) {
+			try {
+				SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+				if (Objects.isNull(sysDeviceBrand.getId())) {// 新增
+					sysDeviceBrand.insertInfo(sysUser.getId());
+				} else { // 修改
+					sysDeviceBrand.updateInfo(sysUser.getId());
+				}
+				return saveOrUpdate(sysDeviceBrand);
+			} catch (Exception e) {
+				if (e instanceof DuplicateKeyException) {
+				String errorColumn = e.getCause().toString();
+				String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+				throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+				} else if (e instanceof ApiException) {
+				ResultUtil.error((ApiException) e, e.getMessage());
+				} else {
+				ResultUtil.error(e.getMessage());
+				}
+			}
+			return null;
+
+		}
+
+		/**
+		* 删除设备品牌表
+		*
+		* @param id
+		*/
+		@Override
+		@Transactional
+		public Boolean delete(Long id) {
+			return this.removeById(id);
+		}
+
+}

+ 88 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysDeviceModelServiceImpl.java

@@ -0,0 +1,88 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.entity.SysDeviceModel;
+import com.qmth.sop.business.entity.SysUser;
+import com.qmth.sop.business.mapper.SysDeviceModelMapper;
+import com.qmth.sop.business.service.SysDeviceModelService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.FieldUniqueEnum;
+import com.qmth.sop.common.util.ResultUtil;
+import com.qmth.sop.common.util.ServletUtil;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * 设备品牌型号表 服务实现.
+ *
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Service
+public class SysDeviceModelServiceImpl extends ServiceImpl<SysDeviceModelMapper, SysDeviceModel> implements SysDeviceModelService{
+
+
+		/**
+		* 查询列表
+		*
+		* @param iPage
+		* @return
+		*/
+		@Override
+		public IPage<SysDeviceModel> query(IPage<Map> iPage,String query) {
+				return this.baseMapper.query(iPage,query);
+		}
+		/**
+		* 新增修改设备品牌型号表
+		*
+		* @param sysDeviceModel
+		*/
+		@Override
+		@Transactional
+		public Boolean saveSysDeviceModel(SysDeviceModel sysDeviceModel) {
+			try {
+				SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+				if (Objects.isNull(sysDeviceModel.getId())) {// 新增
+					sysDeviceModel.insertInfo(sysUser.getId());
+				} else { // 修改
+					sysDeviceModel.updateInfo(sysUser.getId());
+				}
+				return saveOrUpdate(sysDeviceModel);
+			} catch (Exception e) {
+				if (e instanceof DuplicateKeyException) {
+				String errorColumn = e.getCause().toString();
+				String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
+				throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
+				} else if (e instanceof ApiException) {
+				ResultUtil.error((ApiException) e, e.getMessage());
+				} else {
+				ResultUtil.error(e.getMessage());
+				}
+			}
+			return null;
+
+		}
+
+		/**
+		* 删除设备品牌型号表
+		*
+		* @param id
+		*/
+		@Override
+		@Transactional
+		public Boolean delete(Long id) {
+			return this.removeById(id);
+		}
+
+}

+ 38 - 0
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -242,3 +242,41 @@ ALTER TABLE `sys_device`
     CHANGE COLUMN `name` `device_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备编号' AFTER `id`,
     ADD COLUMN `model` varchar(255) NOT NULL COMMENT '型号' AFTER `brand`,
     ADD COLUMN `bound` varchar(20) NULL COMMENT '出库/入库' AFTER `scan_count`;
+
+CREATE TABLE `sys_device_brand` (
+                                    `id` bigint NOT NULL COMMENT '主键',
+                                    `brand` varchar(100) NOT NULL COMMENT '品牌',
+                                    `create_id` bigint DEFAULT NULL COMMENT '创建人id',
+                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
+                                    `update_id` bigint DEFAULT NULL COMMENT '更新人id',
+                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
+                                    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='设备品牌表';
+CREATE TABLE `sys_device_model` (
+                                    `id` bigint NOT NULL COMMENT '主键',
+                                    `brand_id` bigint NOT NULL COMMENT '品牌ID',
+                                    `model` varchar(255) NOT NULL COMMENT '型号',
+                                    `create_id` bigint DEFAULT NULL COMMENT '创建人id',
+                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
+                                    `update_id` bigint DEFAULT NULL COMMENT '更新人id',
+                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
+                                    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='设备品牌型号表';
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1044, '设备品牌表列表接口', '/api/sys/device/brand/list', 'URL', 64, 25, 'SYS', NULL, 1, 1, 0);
+UPDATE `sys_privilege` SET `name` = '设备配置', `url` = 'device', `type` = 'MENU', `parent_id` = 2, `sequence` = 3, `property` = NULL, `related` = '', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 5;
+UPDATE `sys_privilege` SET `name` = '列表', `url` = 'List', `type` = 'LIST', `parent_id` = 5, `sequence` = 1, `property` = 'AUTH', `related` = '275', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 85;
+UPDATE `sys_privilege` SET `name` = '查询条件', `url` = 'Condition', `type` = 'CONDITION', `parent_id` = 5, `sequence` = 1, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 86;
+UPDATE `sys_privilege` SET `name` = '新增', `url` = 'Add', `type` = 'BUTTON', `parent_id` = 5, `sequence` = 1, `property` = 'AUTH', `related` = '270', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 87;
+UPDATE `sys_privilege` SET `name` = '作废', `url` = 'Cancel', `type` = 'BUTTON', `parent_id` = 5, `sequence` = 2, `property` = 'AUTH', `related` = '271', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 88;
+UPDATE `sys_privilege` SET `name` = '查询', `url` = 'Select', `type` = 'BUTTON', `parent_id` = 5, `sequence` = 3, `property` = 'AUTH', `related` = '275', `enable` = 1, `default_auth` = 0, `front_display` = 1 WHERE `id` = 105;
+UPDATE `sys_privilege` SET `name` = '设备新增修改', `url` = '/api/sys/device/save', `type` = 'URL', `parent_id` = 5, `sequence` = 1, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 270;
+UPDATE `sys_privilege` SET `name` = '设备作废', `url` = '/api/sys/device/delete', `type` = 'URL', `parent_id` = 5, `sequence` = 2, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 271;
+UPDATE `sys_privilege` SET `name` = '设备禁用', `url` = '/api/sys/device/disable', `type` = 'URL', `parent_id` = 5, `sequence` = 3, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 272;
+UPDATE `sys_privilege` SET `name` = '设备查询条件', `url` = '/api/sys/device/get', `type` = 'URL', `parent_id` = 5, `sequence` = 4, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 273;
+UPDATE `sys_privilege` SET `name` = '设备列表', `url` = '/api/sys/device/list', `type` = 'URL', `parent_id` = 5, `sequence` = 5, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 274;
+UPDATE `sys_privilege` SET `name` = '设备查询条件', `url` = '/api/sys/device/query', `type` = 'URL', `parent_id` = 5, `sequence` = 6, `property` = 'AUTH', `related` = NULL, `enable` = 1, `default_auth` = 1, `front_display` = 0 WHERE `id` = 275;
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1045, '设备启用', '/api/sys/device/enable', 'URL', 5, 7, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1046, '设备导入', '/api/sys/device/import', 'URL', 5, 8, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1047, '启用', 'Select', 'BUTTON', 5, 4, 'AUTH', '1045', 1, 0, 1);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1048, '禁用', 'Select', 'BUTTON', 5, 5, 'AUTH', '272', 1, 0, 1);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1049, '导入', 'Select', 'BUTTON', 5, 6, 'AUTH', '1046', 1, 0, 1);

+ 10 - 0
sop-business/src/main/resources/mapper/SysDeviceBrandMapper.xml

@@ -0,0 +1,10 @@
+<?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.qmth.sop.business.mapper.SysDeviceBrandMapper">
+
+    <select id="query" resultType="com.qmth.sop.business.entity.SysDeviceBrand">
+        select * from sys_device_brand a
+
+        order by a.create_time desc
+    </select>
+</mapper>

+ 10 - 0
sop-business/src/main/resources/mapper/SysDeviceModelMapper.xml

@@ -0,0 +1,10 @@
+<?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.qmth.sop.business.mapper.SysDeviceModelMapper">
+
+    <select id="query" resultType="com.qmth.sop.business.entity.SysDeviceModel">
+        select * from sys_device_model a
+
+        order by a.create_time desc
+    </select>
+</mapper>

+ 99 - 0
sop-server/src/main/java/com/qmth/sop/server/api/SysDeviceBrandController.java

@@ -0,0 +1,99 @@
+package com.qmth.sop.server.api;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.sop.business.bean.result.EditResult;
+import com.qmth.sop.business.entity.SysDeviceBrand;
+import com.qmth.sop.business.entity.SysDeviceModel;
+import com.qmth.sop.business.service.SysDeviceBrandService;
+import com.qmth.sop.business.service.SysDeviceModelService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.util.CollectionUtils; 
+import org.springframework.validation.BindingResult; 
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 设备品牌表 控制器
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Api(tags = "设备品牌表 Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX+"/sys/device/brand")
+public class SysDeviceBrandController {
+
+
+    @Resource
+    SysDeviceBrandService sysDeviceBrandService;
+    @Resource
+    SysDeviceModelService sysDeviceModelService;
+    
+    @ApiOperation(value = "设备品牌表查询接口")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备品牌表查询结果", response = SysDeviceBrand.class)})
+    public Result query(
+                @ApiParam(value = "模糊查询条件", required = false) @RequestParam(required = false) String query,
+                @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        IPage<SysDeviceBrand> resultIPage = sysDeviceBrandService.query(new Page<>(pageNumber, pageSize),query);
+
+        return ResultUtil.ok(resultIPage);
+    }
+
+    
+    @ApiOperation(value = "设备品牌表新增修改接口")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result save(@Valid @ApiParam(value = "设备品牌表信息", required = true) @RequestBody(required = true) SysDeviceBrand sysDeviceBrand, BindingResult bindingResult) throws InterruptedException {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        return ResultUtil.ok(sysDeviceBrandService.saveSysDeviceBrand(sysDeviceBrand));
+    }
+
+
+    
+    @ApiOperation(value = "设备品牌表删除接口")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result delete(@ApiParam(value = "设备品牌表id", required = true) @RequestParam(required = true) long id) {
+        return ResultUtil.ok(sysDeviceBrandService.delete(id));
+    }
+
+
+    
+    @ApiOperation(value = "设备品牌表获取单个接口")
+    @RequestMapping(value = "/get", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备品牌表信息", response = SysDeviceBrand.class)})
+    public Result get(@ApiParam(value = "设备品牌表id", required = true) @RequestParam long id) {
+        return ResultUtil.ok(sysDeviceBrandService.getById(id));
+    }
+
+    //获取品牌列表
+    @ApiOperation(value = "设备品牌表列表接口")
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备品牌表列表", response = SysDeviceBrand.class)})
+    public Result list() {
+        List<SysDeviceBrand> list = sysDeviceBrandService.list();
+        list.forEach(e-> e.setList(sysDeviceModelService.list(new QueryWrapper<SysDeviceModel>().lambda().eq(SysDeviceModel::getBrandId,e.getId()))));
+        return ResultUtil.ok(list);
+
+    }
+}

+ 8 - 0
sop-server/src/main/java/com/qmth/sop/server/api/SysDeviceController.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.server.api;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.annotation.Aac;
@@ -26,6 +27,7 @@ import javax.validation.Valid;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * 设备配置表 控制器
@@ -127,4 +129,10 @@ public class SysDeviceController {
         return ResultUtil.ok(tbTask.getId());
     }
 
+    @ApiOperation(value = "设备配置表列表接口")
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备配置表列表", response = SysDevice.class)})
+    public Result list(@ApiParam(value = "查询条件", required = false) @RequestParam(required = false) Boolean enable) {
+        return ResultUtil.ok(sysDeviceService.list(new QueryWrapper<SysDevice>().lambda().eq(Objects.nonNull(enable),SysDevice::getEnable, enable)));
+    }
 }

+ 85 - 0
sop-server/src/main/java/com/qmth/sop/server/api/SysDeviceModelController.java

@@ -0,0 +1,85 @@
+package com.qmth.sop.server.api;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.sop.business.bean.result.EditResult;
+import com.qmth.sop.business.entity.SysDeviceModel;
+import com.qmth.sop.business.service.SysDeviceModelService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.util.CollectionUtils; 
+import org.springframework.validation.BindingResult; 
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 设备品牌型号表 控制器
+ * 
+ * @author: shudonghui
+ * @date: 2023-08-25 10:29:08
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Api(tags = "设备品牌型号表 Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX+"/sys/device/model")
+public class SysDeviceModelController {
+
+
+    @Resource
+    SysDeviceModelService sysDeviceModelService;
+
+    
+    @ApiOperation(value = "设备品牌型号表查询接口")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备品牌型号表查询结果", response = SysDeviceModel.class)})
+    public Result query(
+                @ApiParam(value = "模糊查询条件", required = false) @RequestParam(required = false) String query,
+                @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        IPage<SysDeviceModel> resultIPage = sysDeviceModelService.query(new Page<>(pageNumber, pageSize),query);
+
+        return ResultUtil.ok(resultIPage);
+    }
+
+    
+    @ApiOperation(value = "设备品牌型号表新增修改接口")
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result save(@Valid @ApiParam(value = "设备品牌型号表信息", required = true) @RequestBody(required = true) SysDeviceModel sysDeviceModel, BindingResult bindingResult) throws InterruptedException {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        return ResultUtil.ok(sysDeviceModelService.saveSysDeviceModel(sysDeviceModel));
+    }
+
+
+    
+    @ApiOperation(value = "设备品牌型号表删除接口")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result delete(@ApiParam(value = "设备品牌型号表id", required = true) @RequestParam(required = true) long id) {
+        return ResultUtil.ok(sysDeviceModelService.delete(id));
+    }
+
+
+    
+    @ApiOperation(value = "设备品牌型号表获取单个接口")
+    @RequestMapping(value = "/get", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "设备品牌型号表信息", response = SysDeviceModel.class)})
+    public Result get(@ApiParam(value = "设备品牌型号表id", required = true) @RequestParam long id) {
+        return ResultUtil.ok(sysDeviceModelService.getById(id));
+    }
+
+
+}