SensorDisplayItem ing
This commit is contained in:
parent
04609401ef
commit
448469b006
|
@ -1,15 +0,0 @@
|
|||
package com.loafle.overflow.module.meta.dao;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayMapping;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 11. 7.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaSensorDisplayItemMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
||||
public List<MetaSensorDisplayMapping> findAllByDisplayItem(MetaSensorDisplayMapping mapping);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.loafle.overflow.module.meta.dao;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayMapping;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorItemKey;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 11. 7.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
||||
|
||||
@Query("SELECT m.itemKey from MetaSensorDisplayMapping m where m.displayItem = (:displayItem)")
|
||||
public List<MetaSensorItemKey> findAllByDisplayItem(@Param("displayItem") MetaSensorDisplayItem displayItem);
|
||||
}
|
|
@ -19,6 +19,13 @@ public class MetaSensorDisplayItem {
|
|||
private MetaSensorItemUnit unit;
|
||||
private Date createDate;
|
||||
|
||||
public MetaSensorDisplayItem() {
|
||||
|
||||
}
|
||||
public MetaSensorDisplayItem(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Id
|
||||
public long getId() {
|
||||
return id;
|
||||
|
|
|
@ -18,6 +18,14 @@ public class MetaSensorItemKey {
|
|||
private Date createDate;
|
||||
private MetaSensorItemUnit unit;
|
||||
|
||||
public MetaSensorItemKey() {
|
||||
|
||||
}
|
||||
|
||||
public MetaSensorItemKey(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.dao.MetaSensorDisplayItemMappingDAO;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 11. 7.
|
||||
*/
|
||||
@Service("MetaSensorDisplayItemMappingService")
|
||||
public class MetaSensorDisplayItemMappingService {
|
||||
@Autowired
|
||||
private MetaSensorDisplayItemMappingDAO mappingDAO;
|
||||
|
||||
public MetaSensorDisplayMapping regist(MetaSensorDisplayMapping m) {
|
||||
return this.mappingDAO.save(m);
|
||||
}
|
||||
|
||||
public List<MetaSensorDisplayMapping> findAllByDisplayItem(MetaSensorDisplayMapping mapping) {
|
||||
return this.mappingDAO.findAllByDisplayItem(mapping);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.dao.MetaSensorDisplayMappingDAO;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayMapping;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorItemKey;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 11. 7.
|
||||
*/
|
||||
@Service("MetaSensorDisplayMappingService")
|
||||
public class MetaSensorDisplayMappingService {
|
||||
@Autowired
|
||||
private MetaSensorDisplayMappingDAO mappingDAO;
|
||||
|
||||
public MetaSensorDisplayMapping regist(MetaSensorDisplayMapping m) {
|
||||
return this.mappingDAO.save(m);
|
||||
}
|
||||
|
||||
public List<MetaSensorItemKey> findAllByDisplayItem(MetaSensorDisplayItem displayItem) {
|
||||
return this.mappingDAO.findAllByDisplayItem(displayItem);
|
||||
}
|
||||
|
||||
}
|
|
@ -958,6 +958,63 @@ INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"k
|
|||
INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES (
|
||||
'16','2017-11-07 16:08:59','','CPU Privilege (%)','wmi.cpu.usage.privilege','23','1');
|
||||
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'1','1','119');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'2','1','120');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'3','1','121');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'4','1','122');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'5','1','123');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'6','1','124');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'7','1','125');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'8','1','126');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'9','1','127');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'10','1','128');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'11','2','119');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'12','3','120');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'13','4','121');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'14','5','122');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'15','6','123');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'16','7','124');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'17','8','125');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'18','9','126');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'19','10','127');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'20','11','128');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'21','12','129');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'22','12','130');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'23','12','131');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'24','12','132');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'25','13','129');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'26','14','130');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'27','15','131');
|
||||
INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES (
|
||||
'28','16','132');
|
||||
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
1,'2017-07-27 15:29:48.634',23,26);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.module.meta.model.MetaSensorItemKey;
|
||||
import com.loafle.overflow.spring.AppConfigTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 11. 7.
|
||||
*/
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfigTest.class})
|
||||
public class MetaSensorDisplayMappingServiceTest {
|
||||
|
||||
@Autowired
|
||||
MetaSensorDisplayMappingService service;
|
||||
|
||||
|
||||
@Test
|
||||
public void read() {
|
||||
List<MetaSensorItemKey> list = this.service.findAllByDisplayItem(new MetaSensorDisplayItem(1));
|
||||
Assert.assertNotNull(list);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user