implemented getRemoteIndex method
This commit is contained in:
@@ -77,5 +77,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:4.3.9.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:4.3.9.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.9.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.9.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.42" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
5
pom.xml
5
pom.xml
@@ -52,6 +52,11 @@
|
|||||||
<artifactId>spring-data-redis</artifactId>
|
<artifactId>spring-data-redis</artifactId>
|
||||||
<version>2.1.3.RELEASE</version>
|
<version>2.1.3.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.irext.decoder;
|
package net.irext.decoder;
|
||||||
|
|
||||||
|
import net.irext.decoder.model.RemoteIndex;
|
||||||
import org.apache.ibatis.type.MappedTypes;
|
import org.apache.ibatis.type.MappedTypes;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
@@ -16,7 +17,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
* 2018-12-08: created by strawmanbobi
|
* 2018-12-08: created by strawmanbobi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@MapperScan("net.irext.decoder.mybatis.springbootmybatis.mapper")
|
@MappedTypes(RemoteIndex.class)
|
||||||
|
@MapperScan("net.irext.decoder.mapper")
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class IRDecoderApplication {
|
public class IRDecoderApplication {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.irext.decoder.businesslogic;
|
package net.irext.decoder.businesslogic;
|
||||||
|
|
||||||
|
import net.irext.decoder.mapper.RemoteIndexMapper;
|
||||||
import net.irext.decoder.model.RemoteIndex;
|
import net.irext.decoder.model.RemoteIndex;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
@@ -18,14 +19,20 @@ public class IndexLogic {
|
|||||||
|
|
||||||
private static IndexLogic indexLogic;
|
private static IndexLogic indexLogic;
|
||||||
|
|
||||||
public static IndexLogic getInstance() {
|
private RemoteIndexMapper remoteIndexMapper;
|
||||||
|
|
||||||
|
public static IndexLogic getInstance(RemoteIndexMapper remoteIndexMapper) {
|
||||||
if (null == indexLogic) {
|
if (null == indexLogic) {
|
||||||
indexLogic = new IndexLogic();
|
indexLogic = new IndexLogic(remoteIndexMapper);
|
||||||
}
|
}
|
||||||
return indexLogic;
|
return indexLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IndexLogic(RemoteIndexMapper remoteIndexMapper) {
|
||||||
|
this.remoteIndexMapper = remoteIndexMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public RemoteIndex getRemoteIndex(int indexId) {
|
public RemoteIndex getRemoteIndex(int indexId) {
|
||||||
return null;
|
return remoteIndexMapper.getRemoteIndexById(indexId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package net.irext.decoder.mapper;
|
||||||
|
|
||||||
|
import net.irext.decoder.model.RemoteIndex;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filename: RemoteIndexMapper.java
|
||||||
|
* Revised: Date: 2018-12-08
|
||||||
|
* Revision: Revision: 1.0
|
||||||
|
* <p>
|
||||||
|
* Description: CollectRemote Mybatis Mapper
|
||||||
|
* <p>
|
||||||
|
* Revision log:
|
||||||
|
* 2018-12-08: created by strawmanbobi
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RemoteIndexMapper {
|
||||||
|
|
||||||
|
@Select("SELECT * FROM remote_index WHERE id = #{id}")
|
||||||
|
RemoteIndex getRemoteIndexById(int id);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package net.irext.decoder.service;
|
|||||||
|
|
||||||
import net.irext.decoder.businesslogic.DecodeLogic;
|
import net.irext.decoder.businesslogic.DecodeLogic;
|
||||||
import net.irext.decoder.businesslogic.IndexLogic;
|
import net.irext.decoder.businesslogic.IndexLogic;
|
||||||
|
import net.irext.decoder.mapper.RemoteIndexMapper;
|
||||||
import net.irext.decoder.model.RemoteIndex;
|
import net.irext.decoder.model.RemoteIndex;
|
||||||
import net.irext.decoder.request.CloseRequest;
|
import net.irext.decoder.request.CloseRequest;
|
||||||
import net.irext.decoder.request.DecodeRequest;
|
import net.irext.decoder.request.DecodeRequest;
|
||||||
@@ -28,8 +29,10 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RequestMapping("/irext")
|
@RequestMapping("/irext")
|
||||||
public class IRDecodeService extends AbstractBaseService {
|
public class IRDecodeService extends AbstractBaseService {
|
||||||
|
|
||||||
public IRDecodeService() {
|
private RemoteIndexMapper remoteIndexMapper;
|
||||||
|
|
||||||
|
public IRDecodeService(RemoteIndexMapper remoteIndexMapper) {
|
||||||
|
this.remoteIndexMapper = remoteIndexMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/open")
|
@PostMapping("/open")
|
||||||
@@ -38,7 +41,7 @@ public class IRDecodeService extends AbstractBaseService {
|
|||||||
int indexId = openRequest.getIndexId();
|
int indexId = openRequest.getIndexId();
|
||||||
|
|
||||||
ServiceResponse response = new ServiceResponse();
|
ServiceResponse response = new ServiceResponse();
|
||||||
RemoteIndex index = IndexLogic.getInstance().getRemoteIndex(indexId);
|
RemoteIndex index = IndexLogic.getInstance(remoteIndexMapper).getRemoteIndex(indexId);
|
||||||
if (null == index) {
|
if (null == index) {
|
||||||
response.setStatus(new Status(Constants.ERROR_CODE_NETWORK_ERROR, ""));
|
response.setStatus(new Status(Constants.ERROR_CODE_NETWORK_ERROR, ""));
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
server.port=8082
|
server.port=8082
|
||||||
|
|
||||||
spring.redis.host=localhost
|
spring.redis.host=localhost
|
||||||
spring.redis.port=6379
|
spring.redis.port=6379
|
||||||
|
|
||||||
|
spring.datasource.url=jdbc:mysql://localhost:3306/irext
|
||||||
|
spring.datasource.username=root
|
||||||
|
spring.datasource.password=root
|
||||||
Reference in New Issue
Block a user