diff --git a/src/main/database/add.sql b/src/main/database/add.sql index fd6f88e..f0159cb 100644 --- a/src/main/database/add.sql +++ b/src/main/database/add.sql @@ -39,5 +39,6 @@ CREATE TABLE `physical_server` ( `tenant_id` bigint DEFAULT NULL COMMENT '租户id', `project_id` bigint DEFAULT NULL COMMENT '项目id', `is_deleted` tinyint(1) DEFAULT NULL COMMENT '是否删除', + `display_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '展示名称', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; \ No newline at end of file diff --git a/src/main/java/com/bocloud/cmp/entity/PhysicalServer.java b/src/main/java/com/bocloud/cmp/entity/PhysicalServer.java index 0f508c5..ca8a06b 100644 --- a/src/main/java/com/bocloud/cmp/entity/PhysicalServer.java +++ b/src/main/java/com/bocloud/cmp/entity/PhysicalServer.java @@ -128,6 +128,9 @@ public class PhysicalServer extends Generic { @Column("creator_id") private Long creatorId; + @Column("mender_id") + private Long menderId; + @Column("tenant_id") private Long tenantId; diff --git a/src/main/java/com/bocloud/cmp/repository/PhysicalServerRepository.java b/src/main/java/com/bocloud/cmp/repository/PhysicalServerRepository.java deleted file mode 100644 index 5284ebf..0000000 --- a/src/main/java/com/bocloud/cmp/repository/PhysicalServerRepository.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.bocloud.cmp.repository; - -import com.bocloud.cmp.entity.PhysicalServer; -import com.megatron.common.utils.Common; -import com.megatron.common.utils.MapTools; -import com.megatron.database.core.intf.impl.BasicGenericDao; -import com.megatron.framework.core.CurrentService; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 物理服务器数据访问 - * - * @author wangyu - * @version 1.0 - * @since 2020年5月15日 - */ -@Repository("serverRepository") -public class PhysicalServerRepository extends BasicGenericDao { - - - public PhysicalServerRepository(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate npJdbcTemplate, CurrentService service) { - super(jdbcTemplate, npJdbcTemplate, service); - } - - public List listByVendor(Long vendorId) { - String sql = "select a.* from physical_server a where a.is_deleted = 0"; - Map params = new HashMap<>(8); - if (null != vendorId) { - sql += " and a.vendor_id = :vendorId"; - params.put(Common.VENDORID, vendorId); - } - return this.list(PhysicalServer.class, sql, params); - } - - public boolean removeByVendor(Long vendorId, Long userId) { - String sql = "update physical_server set is_deleted = true , gmt_modify = :gmtModify where is_deleted = 0 and vendor_id = :vendorId"; - Map params = MapTools.simpleMap(Common.VENDORID, vendorId); - params.put("gmtModify", new Date()); - return this.execute(sql, params) > 0; - } - - public boolean remove(Long id, Long userId) { - String sql = "update physical_server set is_deleted = true,gmt_modify = :gmtModify where is_deleted = 0 and id = :id"; - Map params = MapTools.simpleMap("id", id); - params.put("gmtModify", new Date()); - return this.execute(sql, params) > 0; - } - -}