-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add service interface for metricD table.
- Loading branch information
Showing
15 changed files
with
201 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
griffin-metric/src/main/java/org/apache/griffin/metric/dao/MetricTagDDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.apache.griffin.metric.dao; | ||
|
||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.griffin.metric.dao.mapper.MetricTagDMapper; | ||
import org.apache.griffin.metric.entity.MetricTagD; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@Slf4j | ||
public class MetricTagDDao extends BaseDao<MetricTagD, MetricTagDMapper>{ | ||
|
||
public MetricTagDDao(@NonNull MetricTagDMapper mybatisMapper) { | ||
super(mybatisMapper); | ||
} | ||
|
||
public int addMetricTagD(MetricTagD metricTagD) { | ||
if (metricTagD == null) { | ||
log.warn("metricTagD is invalid"); | ||
return 0; | ||
} | ||
|
||
int count = mybatisMapper.insert(metricTagD); | ||
log.info("add metricTagD: {}, count: {}", metricTagD, count); | ||
return count; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
griffin-metric/src/main/java/org/apache/griffin/metric/dao/MetricVDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.apache.griffin.metric.dao; | ||
|
||
import lombok.NonNull; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.griffin.metric.dao.mapper.MetricVMapper; | ||
import org.apache.griffin.metric.entity.MetricV; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@Slf4j | ||
public class MetricVDao extends BaseDao<MetricV, MetricVMapper>{ | ||
public MetricVDao(@NonNull MetricVMapper mybatisMapper) { | ||
super(mybatisMapper); | ||
} | ||
|
||
public int addMetricV(MetricV metricV) { | ||
if (metricV == null) { | ||
log.warn("metricV is invalid"); | ||
return 0; | ||
} | ||
int count = mybatisMapper.insert(metricV); | ||
log.info("add metricV: {}, count: {}", metricV, count); | ||
return count; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
griffin-metric/src/main/java/org/apache/griffin/metric/dao/mapper/MetricTagDMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.apache.griffin.metric.dao.mapper; | ||
|
||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import org.apache.griffin.metric.entity.MetricTagD; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
@Mapper | ||
public interface MetricTagDMapper extends BaseMapper<MetricTagD> { | ||
} |
9 changes: 9 additions & 0 deletions
9
griffin-metric/src/main/java/org/apache/griffin/metric/dao/mapper/MetricVMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.apache.griffin.metric.dao.mapper; | ||
|
||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import org.apache.griffin.metric.entity.MetricV; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
@Mapper | ||
public interface MetricVMapper extends BaseMapper<MetricV> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
griffin-metric/src/main/java/org/apache/griffin/metric/service/MetricTagDService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.apache.griffin.metric.service; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.griffin.metric.dao.MetricTagDDao; | ||
import org.apache.griffin.metric.entity.MetricTagD; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@Slf4j | ||
public class MetricTagDService { | ||
private final MetricTagDDao metricTagDDao; | ||
|
||
public MetricTagDService(MetricTagDDao metricTagDDao) { | ||
this.metricTagDDao = metricTagDDao; | ||
} | ||
|
||
@PutMapping(value = "/metricTagD",consumes = MediaType.APPLICATION_JSON_VALUE, | ||
produces = MediaType.APPLICATION_JSON_VALUE) | ||
public MetricTagD createMetricTagD(@RequestBody MetricTagD metricTagD) { | ||
int i = metricTagDDao.addMetricTagD(metricTagD); | ||
return metricTagD; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
griffin-metric/src/main/java/org/apache/griffin/metric/service/MetricVService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.apache.griffin.metric.service; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.griffin.metric.dao.MetricVDao; | ||
import org.apache.griffin.metric.entity.MetricV; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@Slf4j | ||
public class MetricVService { | ||
private final MetricVDao metricVDao; | ||
|
||
public MetricVService(MetricVDao metricVDao) { | ||
this.metricVDao = metricVDao; | ||
} | ||
|
||
@PutMapping(value = "/metricV",consumes = MediaType.APPLICATION_JSON_VALUE, | ||
produces = MediaType.APPLICATION_JSON_VALUE) | ||
public MetricV createMetricV(@RequestBody MetricV metricV) { | ||
int id = metricVDao.addMetricV(metricV); | ||
return metricV; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters