From 3756b0a012a89f3df7b76163fb0141ef743bfc4e Mon Sep 17 00:00:00 2001 From: tangpeng Date: Tue, 18 Jun 2019 11:54:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=BA=E6=88=BF=E5=92=8C?= =?UTF-8?q?=E6=9C=BA=E6=9F=9C=E5=88=97=E8=A1=A8=E5=AD=90=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/assets/assetsCabinet/add.html | 4 +- .../assets/assetsCabinet/assetsCabinet.html | 20 +- .../assets/assetsMachineRoom/add.html | 224 +++++++++++------- .../assetsMachineRoom/assetsMachineRoom.html | 4 +- .../assets/assetsMachineRoom/edit.html | 52 +++- .../ruoyi/assets/domain/AssetsCabinet.java | 13 + .../assets/domain/AssetsMachineRoom.java | 22 +- .../mapper/assets/AssetsCabinetMapper.xml | 3 +- .../mapper/assets/AssetsMachineRoomMapper.xml | 136 +++++------ 9 files changed, 298 insertions(+), 180 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/add.html b/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/add.html index 5320fb942..a466a738f 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/add.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/add.html @@ -71,13 +71,13 @@ required: true, minlength: 1, maxlength: 3, - min:1, + min: 1 }, cabinetAvailElec: { required: true, minlength: 1, maxlength: 5, - min:1 + min: 1 } }, focusCleanup: true diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/assetsCabinet.html b/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/assetsCabinet.html index a232a7553..a78cfeb6f 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/assetsCabinet.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsCabinet/assetsCabinet.html @@ -10,14 +10,12 @@
    -
  • - 机房: -
  • -
  • 机柜名称:
  • - +
  • + 机房: +
  • 机柜所在区域:
  • @@ -91,7 +89,12 @@ visible: false }, { - field: 'machineRoomId', + field: 'cabinetName', + title: '机柜名称', + sortable: true + }, + { + field: 'machineRoom', title: '所属机房', sortable: true, formatter: function (value, row, index) { @@ -102,11 +105,6 @@ return value; } }, - { - field: 'cabinetName', - title: '机柜名称', - sortable: true - }, { field: 'cabinetArea', title: '机柜所在区域', diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/add.html b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/add.html index a46b1f0fd..8803a3a4c 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/add.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/add.html @@ -1,96 +1,140 @@ - + - + -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    - -
    -
    - +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html index 933d43370..11dedc8dc 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/assetsMachineRoom.html @@ -15,7 +15,7 @@
  • - 带宽类型: + 带宽类型:
  • @@ -116,7 +116,7 @@ sortable: true }, { - field: 'bandwidthType', + field: 'bandwidthType.dictLabel', title: '带宽类型', sortable: true }, diff --git a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html index ff9d06c63..94574e015 100755 --- a/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html +++ b/ruoyi-admin/src/main/resources/templates/assets/assetsMachineRoom/edit.html @@ -17,8 +17,14 @@
    - +
    @@ -85,9 +91,47 @@ var prefix = ctx + "assets/assetsMachineRoom"; $("#form-assetsMachineRoom-edit").validate({ rules: { - xxxx: { - required: true, + "bandwidthType.dictCode": { + required: true }, + machineRoomName: { + required: true, + minlength: 1, + maxlength: 10 + }, + bandwidthSize: { + required: true, + minlength: 1, + maxlength: 10 + }, + country: { + required: true, + minlength: 1, + maxlength: 10 + }, + province: { + required: true, + minlength: 1, + maxlength: 10 + }, + city: { + required: true, + minlength: 1, + maxlength: 10 + }, + area: { + required: true, + minlength: 1, + maxlength: 10 + }, + email: { + required: false, + email: true + }, + contactPhone: { + required: false, + isPhone: true + } }, focusCleanup: true }); diff --git a/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsCabinet.java b/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsCabinet.java index 0e1807ee8..c2c1dacab 100755 --- a/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsCabinet.java +++ b/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsCabinet.java @@ -20,7 +20,12 @@ public class AssetsCabinet extends BaseEntity { /** * 机房编号 */ + private Integer dictCode; + /** + * 机房对象 + */ private AssetsMachineRoom machineRoom; + /** * 机柜名称 */ @@ -46,6 +51,14 @@ public class AssetsCabinet extends BaseEntity { this.cabinetId = cabinetId; } + public Integer getDictCode() { + return dictCode; + } + + public void setDictCode(Integer dictCode) { + this.dictCode = dictCode; + } + public AssetsMachineRoom getMachineRoom() { return machineRoom; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsMachineRoom.java b/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsMachineRoom.java index a3752a647..5e7295b4c 100755 --- a/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsMachineRoom.java +++ b/ruoyi-system/src/main/java/com/ruoyi/assets/domain/AssetsMachineRoom.java @@ -1,9 +1,12 @@ package com.ruoyi.assets.domain; import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.system.domain.SysDictData; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.beans.Transient; + /** * 机房表 assets_machine_room * @@ -24,7 +27,11 @@ public class AssetsMachineRoom extends BaseEntity { /** * 带宽类型 */ - private Long bandwidthType; + private Integer dictCode; + /** + * 带宽类型 实体关联 + */ + private SysDictData bandwidthType; /** * 带宽大小 */ @@ -78,11 +85,20 @@ public class AssetsMachineRoom extends BaseEntity { this.machineRoomName = machineRoomName; } - public Long getBandwidthType() { + @Transient + public Integer getDictCode() { + return dictCode; + } + + public void setDictCode(Integer dictCode) { + this.dictCode = dictCode; + } + + public SysDictData getBandwidthType() { return bandwidthType; } - public void setBandwidthType(Long bandwidthType) { + public void setBandwidthType(SysDictData bandwidthType) { this.bandwidthType = bandwidthType; } diff --git a/ruoyi-system/src/main/resources/mapper/assets/AssetsCabinetMapper.xml b/ruoyi-system/src/main/resources/mapper/assets/AssetsCabinetMapper.xml index 89be37b20..fe567a8f8 100755 --- a/ruoyi-system/src/main/resources/mapper/assets/AssetsCabinetMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/assets/AssetsCabinetMapper.xml @@ -6,7 +6,6 @@ - @@ -25,7 +24,7 @@ and cabinet_id = #{cabinetId} - and machine_room_id = #{machineRoom.machineRoomId} + and machine_room_id = #{dictCode} and cabinet_name = #{cabinetName} and cabinet_area = #{cabinetArea} and cabinet_avail_u = #{cabinetAvailU} diff --git a/ruoyi-system/src/main/resources/mapper/assets/AssetsMachineRoomMapper.xml b/ruoyi-system/src/main/resources/mapper/assets/AssetsMachineRoomMapper.xml index 49853f18b..bbc4cba95 100755 --- a/ruoyi-system/src/main/resources/mapper/assets/AssetsMachineRoomMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/assets/AssetsMachineRoomMapper.xml @@ -1,86 +1,90 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - - + + + + + + + + + + + + + - - + + select machine_room_id, machine_room_name, bandwidth_type, bandwidth_size, country, province, city, area, location, contact_person, contact_phone, email from assets_machine_room - + - + - - + + insert into assets_machine_room - - machine_room_name, - bandwidth_type, - bandwidth_size, - country, - province, - city, - area, - location, - contact_person, - contact_phone, - email, - + + machine_room_name, + bandwidth_type, + bandwidth_size, + country, + province, + city, + area, + location, + contact_person, + contact_phone, + email, + - #{machineRoomName}, - #{bandwidthType}, - #{bandwidthSize}, - #{country}, - #{province}, - #{city}, - #{area}, - #{location}, - #{contactPerson}, - #{contactPhone}, - #{email}, - + #{machineRoomName}, + #{bandwidthType.dictCode}, + #{bandwidthSize}, + #{country}, + #{province}, + #{city}, + #{area}, + #{location}, + #{contactPerson}, + #{contactPhone}, + #{email}, + - + update assets_machine_room machine_room_name = #{machineRoomName}, - bandwidth_type = #{bandwidthType}, + bandwidth_type = #{bandwidthType.dictCode}, bandwidth_size = #{bandwidthSize}, country = #{country}, province = #{province}, @@ -94,15 +98,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where machine_room_id = #{machineRoomId} - + delete from assets_machine_room where machine_room_id = #{machineRoomId} - + - delete from assets_machine_room where machine_room_id in + delete from assets_machine_room where machine_room_id in #{machineRoomId} - + \ No newline at end of file