From e0233e5b9d287d76642aea265f62aa89883286af Mon Sep 17 00:00:00 2001
From: Yutousama <583819556@qq.com>
Date: Tue, 14 Jan 2020 18:13:59 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=AD=94=E6=94=B9=E5=AE=A2?=
=?UTF-8?q?=E6=88=B7=E7=AB=AF=E6=95=B0=E6=8D=AE=E5=BA=93=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=20=E6=96=B0=E5=A2=9ESQLite=E6=94=AF=E6=8C=81=20=E5=9C=B0?=
=?UTF-8?q?=E5=9B=BE=E6=8E=92=E8=A1=8C=E6=A6=9C=E5=88=9D=E6=9C=9F=E5=87=86?=
=?UTF-8?q?=E5=A4=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 6 +
sqlite.db | Bin 0 -> 32768 bytes
src/main/java/com/yutou/controller/test.java | 24 ++-
.../databases/JianrDataSourceConfig.java | 42 ++++
.../yutou/databases/MainDataSourceConfig.java | 45 ++++
.../databases/SQLiteDataSourceConfig.java | 43 ++++
.../com/yutou/jianrdb/Bean/GameInfoLog.java | 195 ++++++++++++++++++
.../com/yutou/jianrdb/Dao/GameInfoLogDao.java | 18 ++
.../jianrdb/Mapper/GameInfoLogService.java | 17 ++
.../java/com/yutou/maptop/Bean/MapTop.java | 49 +++++
.../java/com/yutou/maptop/Bean/UserTeam.java | 42 ++++
.../java/com/yutou/maptop/Dao/MapDao.java | 16 ++
.../com/yutou/maptop/Dao/UserTeamDao.java | 19 ++
.../maptop/services/UserTeamService.java | 25 +++
14 files changed, 537 insertions(+), 4 deletions(-)
create mode 100644 sqlite.db
create mode 100644 src/main/java/com/yutou/databases/JianrDataSourceConfig.java
create mode 100644 src/main/java/com/yutou/databases/MainDataSourceConfig.java
create mode 100644 src/main/java/com/yutou/databases/SQLiteDataSourceConfig.java
create mode 100644 src/main/java/com/yutou/jianrdb/Bean/GameInfoLog.java
create mode 100644 src/main/java/com/yutou/jianrdb/Dao/GameInfoLogDao.java
create mode 100644 src/main/java/com/yutou/jianrdb/Mapper/GameInfoLogService.java
create mode 100644 src/main/java/com/yutou/maptop/Bean/MapTop.java
create mode 100644 src/main/java/com/yutou/maptop/Bean/UserTeam.java
create mode 100644 src/main/java/com/yutou/maptop/Dao/MapDao.java
create mode 100644 src/main/java/com/yutou/maptop/Dao/UserTeamDao.java
create mode 100644 src/main/java/com/yutou/maptop/services/UserTeamService.java
diff --git a/pom.xml b/pom.xml
index 3e68d52..d91c8b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,6 +140,12 @@
log4j-core
2.8.2
+
+
+ org.xerial
+ sqlite-jdbc
+ 3.28.0
+
diff --git a/sqlite.db b/sqlite.db
new file mode 100644
index 0000000000000000000000000000000000000000..e758ab331c5e011ba201b30671371060ded2f9bc
GIT binary patch
literal 32768
zcmeI)F>ljA7zW_GI8KwQjXM!lO~fGv5+wqXHbd2+gyKRVb=%+|I$2I)L}*i|jU(7l
zJ9R-~f{g`B`9bYVgah=GASyH4GT(!xZe_Y_~w_uZZD9-kteWaaj9rR7-c
zp1s*N9X3hE2&Lo-V}y`s;G(=7;a8YneiC)Zr6{>L#YRUjkjTg?iN9CgDKFxWM^@wW
z@%iJrA`SrvKmY;|fB*y_009V`Vu7vc=uje+qT8xt*4M0F*V@!Av+aLJ=BjE*SD9YA
zT2Yx_%hIhTD{H!XU9GaEYI&hlU17J>6;`V0i)D@XSx_~d)wJ?*O=a4m&a_&kl4HGf
zvu&|ErRv;`QkA6(#bPE9?cQ&7n6BRCt@}M1o0jQVdW(0v#^<4z7xu@?#2?bLiJ2L?
zb>5wOcVms8nz~M}*|H7CYIlr3RYwo3?1;YUVaB|r=6K1QzL=r7>rZ!>PlP;k5o7-o
z;-y$5F_)sGwcfNIc?&emo@2ZBhW{*$yk8npez?a=vJ{RavRS$k;4`|`M$cMrSbO96
zxAJck`)$+Wap!o`%+^ghlo%hU+qOGq+w3@Y$IC+pM)2xRxWD{uvbWK4jQ1|@Z%jYz
z)@ydtI=s2W6BL{MaJ|Fp0^=Oo#+j@XNz9HP5}#D0tuDZ0H1y^Il_#|Bi_BJsB0*
zn8=VI009U<00Izz00bZa0SG_<0uUHffnl*Qoc{;)@nT&NfB*y_009U<00Izz00bZa
z0apO$e{2K@KmY;|fB*y_009U<00Izzz~Bpr_y4K#jqnc=1Rwwb2tWV=5P$##AOHaf
zKmY;*BQQdx6!rgzK^EtKS$RN|kIGx+m9oQ&NDzPk1Rwwb2tWV=5P$##AOHaf{Ift(
zmdV69dH3m)-Pg~jOw+8_>y1XENbQ$9^V7+2AUfHPPKoI3o1_$o7W&ai5iNd5h62%i
zKUxsc?589RL@)QFc@dpBBi{d)mCr=^seD(yDqnaJ2?7v+00bZa0SG_<0uX=z1Rwx`
yQz#%yl*+Qm!(ow2lE_0LNs7fz;c_r#2tWV=5P$##AOHafKmY;|fB*#kQs5VoFl}A{
literal 0
HcmV?d00001
diff --git a/src/main/java/com/yutou/controller/test.java b/src/main/java/com/yutou/controller/test.java
index 9515e3b..c5d20b9 100644
--- a/src/main/java/com/yutou/controller/test.java
+++ b/src/main/java/com/yutou/controller/test.java
@@ -1,10 +1,13 @@
package com.yutou.controller;
+import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import com.yutou.maptop.Bean.UserTeam;
+import com.yutou.maptop.services.UserTeamService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -34,11 +37,24 @@ public class test {
TMod mod=modService.getMod(id,0);
return JSON.toJSONString(mod);
}
+ private static int index=0;
+ @Resource
+ UserTeamService daoServier;
@ResponseBody
- @RequestMapping("/search.do")
- public String searchMod(String search) {
- String json="{\"status\":1,\"isShow\":1,\"adModel\":[{\"modelFlag\":1,\"positionIds\":{\"0\":{\"agentFlag\":1,\"appId\":\"1106950165\",\"modelStyle\":-1,\"adPosition\":[\"2030330690179417\",\"9060530630473499\"],\"browserType\":1,\"closeFlag\":2},\"1\":{\"agentFlag\":2,\"appId\":\"1106950165\",\"modelStyle\":-1,\"adPosition\":[\"203033069017\",\"906053063047\"],\"browserType\":1,\"closeFlag\":2},\"num\":2}},{\"modelFlag\":6,\"positionIds\":{\"0\":{\"agentFlag\":1,\"appId\":\"1106930243\",\"modelStyle\":4,\"adPosition\":[\"7080651707725363\"],\"browserType\":1,\"closeFlag\":2},\"1\":{\"agentFlag\":1,\"appId\":\"1106930243\",\"modelStyle\":6,\"adPosition\":[\"2050252777728335\"],\"browserType\":1,\"closeFlag\":2},\"2\":{\"agentFlag\":1,\"appId\":\"1106930243\",\"modelStyle\":5,\"adPosition\":[\"2000751737222326\"],\"browserType\":1,\"closeFlag\":2},\"num\":3}}]}";
- return AESTools.aesEncrypt(json, "langtianaes20188");
+ @RequestMapping("/team/insert.do")
+ public String searchMod(String id) {
+ UserTeam team=new UserTeam();
+ team.setUname("名字"+(index++));
+ team.setCreateTime(new Date());
+ team.setShip("aaabbbccc"+index);
+ daoServier.insertTeam(team);
+ return "ok";
+ }
+ @ResponseBody
+ @RequestMapping("/team/select.do")
+ public String selectTeam(){
+ List list= daoServier.selectById(-1);
+ return JSON.toJSONString(list);
}
diff --git a/src/main/java/com/yutou/databases/JianrDataSourceConfig.java b/src/main/java/com/yutou/databases/JianrDataSourceConfig.java
new file mode 100644
index 0000000..f2a7acb
--- /dev/null
+++ b/src/main/java/com/yutou/databases/JianrDataSourceConfig.java
@@ -0,0 +1,42 @@
+package com.yutou.databases;
+
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages ="com.yutou.jianrdb.Dao" ,sqlSessionTemplateRef = "db2SqlSessionTemplate")
+public class JianrDataSourceConfig {
+ @Bean(name = "db2DataSource")
+ @ConfigurationProperties(prefix = "spring.datasource.secondary")
+ public DataSource testDataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Bean(name = "db2SqlSessionFactory")
+ public SqlSessionFactory testSqlSessionFactory(@Qualifier("db2DataSource") DataSource dataSource) throws Exception {
+ SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
+ bean.setDataSource(dataSource);
+ //bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/mapper/db2/*.xml"));
+ return bean.getObject();
+ }
+
+ @Bean(name = "db2TransactionManager")
+ public DataSourceTransactionManager testTransactionManager(@Qualifier("db2DataSource") DataSource dataSource) {
+ return new DataSourceTransactionManager(dataSource);
+ }
+
+ @Bean(name = "db2SqlSessionTemplate")
+ public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
+ return new SqlSessionTemplate(sqlSessionFactory);
+ }
+}
diff --git a/src/main/java/com/yutou/databases/MainDataSourceConfig.java b/src/main/java/com/yutou/databases/MainDataSourceConfig.java
new file mode 100644
index 0000000..2e41da0
--- /dev/null
+++ b/src/main/java/com/yutou/databases/MainDataSourceConfig.java
@@ -0,0 +1,45 @@
+package com.yutou.databases;
+
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages ="com.yutou.mybatis.dao" ,sqlSessionTemplateRef = "db1SqlSessionTemplate")
+public class MainDataSourceConfig {
+ @Bean(name = "db1DataSource")
+ @Primary
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource testDataSource() {
+ return DataSourceBuilder.create().build();
+ }
+ @Primary
+ @Bean(name = "db1SqlSessionFactory")
+ public SqlSessionFactory testSqlSessionFactory(@Qualifier("db1DataSource") DataSource dataSource) throws Exception {
+ SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
+ bean.setDataSource(dataSource);
+ bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("/mybatis/mapping/*.xml"));
+ return bean.getObject();
+ }
+ @Primary
+ @Bean(name = "db1TransactionManager")
+ public DataSourceTransactionManager testTransactionManager(@Qualifier("db1DataSource") DataSource dataSource) {
+ return new DataSourceTransactionManager(dataSource);
+ }
+ @Primary
+ @Bean(name = "db1SqlSessionTemplate")
+ public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
+ return new SqlSessionTemplate(sqlSessionFactory);
+ }
+}
diff --git a/src/main/java/com/yutou/databases/SQLiteDataSourceConfig.java b/src/main/java/com/yutou/databases/SQLiteDataSourceConfig.java
new file mode 100644
index 0000000..852a030
--- /dev/null
+++ b/src/main/java/com/yutou/databases/SQLiteDataSourceConfig.java
@@ -0,0 +1,43 @@
+package com.yutou.databases;
+
+
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages = "com.yutou.maptop.Dao", sqlSessionTemplateRef = "sqliteTemplateRef")
+public class SQLiteDataSourceConfig {
+ @Bean(name = "sqliteDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource.sqlite")
+ public DataSource buildDataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Bean(name = "sqliteFactory")
+ public SqlSessionFactory createFactory(
+ @Qualifier("sqliteDataSource") DataSource dataSource) throws Exception {
+ SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
+ bean.setDataSource(dataSource);
+ return bean.getObject();
+ }
+
+ @Bean(name = "sqliteManager")
+ public DataSourceTransactionManager createManager(@Qualifier("sqliteDataSource") DataSource dataSource) {
+ return new DataSourceTransactionManager(dataSource);
+ }
+
+ @Bean(name = "sqliteTemplateRef")
+ public SqlSessionTemplate createTemplate(@Qualifier("sqliteFactory") SqlSessionFactory sessionFactory) {
+ return new SqlSessionTemplate(sessionFactory);
+ }
+}
diff --git a/src/main/java/com/yutou/jianrdb/Bean/GameInfoLog.java b/src/main/java/com/yutou/jianrdb/Bean/GameInfoLog.java
new file mode 100644
index 0000000..4c76ec0
--- /dev/null
+++ b/src/main/java/com/yutou/jianrdb/Bean/GameInfoLog.java
@@ -0,0 +1,195 @@
+package com.yutou.jianrdb.Bean;
+
+import java.util.Date;
+
+public class GameInfoLog {
+ private int id;
+ private String ip;
+ private String uid;
+ private Date server_time;
+ private Date client_time;
+ private String sdk_ver;
+ private String sdk_int;
+ private String model;
+ private String type;
+ private String url;
+ private String message;
+ private String device_id;
+ private String stub_ver;
+ private String binder_ver;
+ private String game_ver;
+ private String username;
+ private String server;
+ private int retry;
+ private String ext;
+ private int server_id;
+ private long client_mid;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ public String getUid() {
+ return uid;
+ }
+
+ public void setUid(String uid) {
+ this.uid = uid;
+ }
+
+ public Date getServer_time() {
+ return server_time;
+ }
+
+ public void setServer_time(Date server_time) {
+ this.server_time = server_time;
+ }
+
+ public Date getClient_time() {
+ return client_time;
+ }
+
+ public void setClient_time(Date client_time) {
+ this.client_time = client_time;
+ }
+
+ public String getSdk_ver() {
+ return sdk_ver;
+ }
+
+ public void setSdk_ver(String sdk_ver) {
+ this.sdk_ver = sdk_ver;
+ }
+
+ public String getSdk_int() {
+ return sdk_int;
+ }
+
+ public void setSdk_int(String sdk_int) {
+ this.sdk_int = sdk_int;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getDevice_id() {
+ return device_id;
+ }
+
+ public void setDevice_id(String device_id) {
+ this.device_id = device_id;
+ }
+
+ public String getStub_ver() {
+ return stub_ver;
+ }
+
+ public void setStub_ver(String stub_ver) {
+ this.stub_ver = stub_ver;
+ }
+
+ public String getBinder_ver() {
+ return binder_ver;
+ }
+
+ public void setBinder_ver(String binder_ver) {
+ this.binder_ver = binder_ver;
+ }
+
+ public String getGame_ver() {
+ return game_ver;
+ }
+
+ public void setGame_ver(String game_ver) {
+ this.game_ver = game_ver;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+ public void setServer(String server) {
+ this.server = server;
+ }
+
+ public int getRetry() {
+ return retry;
+ }
+
+ public void setRetry(int retry) {
+ this.retry = retry;
+ }
+
+ public String getExt() {
+ return ext;
+ }
+
+ public void setExt(String ext) {
+ this.ext = ext;
+ }
+
+ public int getServer_id() {
+ return server_id;
+ }
+
+ public void setServer_id(int server_id) {
+ this.server_id = server_id;
+ }
+
+ public long getClient_mid() {
+ return client_mid;
+ }
+
+ public void setClient_mid(long client_mid) {
+ this.client_mid = client_mid;
+ }
+}
diff --git a/src/main/java/com/yutou/jianrdb/Dao/GameInfoLogDao.java b/src/main/java/com/yutou/jianrdb/Dao/GameInfoLogDao.java
new file mode 100644
index 0000000..22cbf29
--- /dev/null
+++ b/src/main/java/com/yutou/jianrdb/Dao/GameInfoLogDao.java
@@ -0,0 +1,18 @@
+package com.yutou.jianrdb.Dao;
+
+import com.yutou.jianrdb.Bean.GameInfoLog;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+import java.util.List;
+
+@Qualifier("db2SqlSessionTemplate")
+public interface GameInfoLogDao {
+ @Select("select * from game_info_log where id=#{id}")
+ GameInfoLog getLog(@Param("id")int id);
+
+
+ @Select("select * from game_info_log where type=#{type}")
+ List getAllByType(@Param("type")String type);
+}
diff --git a/src/main/java/com/yutou/jianrdb/Mapper/GameInfoLogService.java b/src/main/java/com/yutou/jianrdb/Mapper/GameInfoLogService.java
new file mode 100644
index 0000000..8f2eabc
--- /dev/null
+++ b/src/main/java/com/yutou/jianrdb/Mapper/GameInfoLogService.java
@@ -0,0 +1,17 @@
+package com.yutou.jianrdb.Mapper;
+
+import com.yutou.jianrdb.Bean.GameInfoLog;
+import com.yutou.jianrdb.Dao.GameInfoLogDao;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class GameInfoLogService {
+ @Resource
+ GameInfoLogDao gameInfoLogDao;
+
+ public GameInfoLog selectGameInfoLogById(int id){
+ return gameInfoLogDao.getLog(id);
+ }
+}
diff --git a/src/main/java/com/yutou/maptop/Bean/MapTop.java b/src/main/java/com/yutou/maptop/Bean/MapTop.java
new file mode 100644
index 0000000..c09f43a
--- /dev/null
+++ b/src/main/java/com/yutou/maptop/Bean/MapTop.java
@@ -0,0 +1,49 @@
+package com.yutou.maptop.Bean;
+
+public class MapTop {
+ private int id;
+ private int mapid;
+ private String mapNode;
+ private String shipTeam;
+ private int teamId;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getMapid() {
+ return mapid;
+ }
+
+ public void setMapid(int mapid) {
+ this.mapid = mapid;
+ }
+
+ public String getMapNode() {
+ return mapNode;
+ }
+
+ public void setMapNode(String mapNode) {
+ this.mapNode = mapNode;
+ }
+
+ public String getShipTeam() {
+ return shipTeam;
+ }
+
+ public void setShipTeam(String shipTeam) {
+ this.shipTeam = shipTeam;
+ }
+
+ public int getTeamId() {
+ return teamId;
+ }
+
+ public void setTeamId(int teamId) {
+ this.teamId = teamId;
+ }
+}
diff --git a/src/main/java/com/yutou/maptop/Bean/UserTeam.java b/src/main/java/com/yutou/maptop/Bean/UserTeam.java
new file mode 100644
index 0000000..96b1714
--- /dev/null
+++ b/src/main/java/com/yutou/maptop/Bean/UserTeam.java
@@ -0,0 +1,42 @@
+package com.yutou.maptop.Bean;
+
+import java.util.Date;
+
+public class UserTeam {
+ private int id;
+ private String uname;
+ private String ship;
+ private Date createTime;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getUname() {
+ return uname;
+ }
+
+ public void setUname(String uname) {
+ this.uname = uname;
+ }
+
+ public String getShip() {
+ return ship;
+ }
+
+ public void setShip(String ship) {
+ this.ship = ship;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
diff --git a/src/main/java/com/yutou/maptop/Dao/MapDao.java b/src/main/java/com/yutou/maptop/Dao/MapDao.java
new file mode 100644
index 0000000..20b01ae
--- /dev/null
+++ b/src/main/java/com/yutou/maptop/Dao/MapDao.java
@@ -0,0 +1,16 @@
+package com.yutou.maptop.Dao;
+
+import com.yutou.maptop.Bean.MapTop;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface MapDao {
+ @Select("select * from maptop where id=#{id}")
+ List selectMapByMapId(@Param("id") int id);
+
+ @Insert("insert into maptop(mapId,mapNode,shipTeam,teamId) values(#{mapId},#{mapNode},#{shipTeam},#{teamId})")
+ void insertMapTop(MapTop top);
+}
diff --git a/src/main/java/com/yutou/maptop/Dao/UserTeamDao.java b/src/main/java/com/yutou/maptop/Dao/UserTeamDao.java
new file mode 100644
index 0000000..da935c3
--- /dev/null
+++ b/src/main/java/com/yutou/maptop/Dao/UserTeamDao.java
@@ -0,0 +1,19 @@
+package com.yutou.maptop.Dao;
+
+import com.yutou.maptop.Bean.UserTeam;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface UserTeamDao {
+ @Select("select * from userTeam where id=#{id}")
+ List selectTeamById(@Param("id") int id);
+
+ @Insert("insert into userTeam(uname,ship,createTime) values(#{uname},#{ship},#{createTime})")
+ void insertTeam( UserTeam param);
+
+ @Select("select * from userTeam")
+ List selectAll();
+}
diff --git a/src/main/java/com/yutou/maptop/services/UserTeamService.java b/src/main/java/com/yutou/maptop/services/UserTeamService.java
new file mode 100644
index 0000000..6271b88
--- /dev/null
+++ b/src/main/java/com/yutou/maptop/services/UserTeamService.java
@@ -0,0 +1,25 @@
+package com.yutou.maptop.services;
+
+import com.yutou.maptop.Bean.UserTeam;
+import com.yutou.maptop.Dao.UserTeamDao;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+public class UserTeamService {
+ @Resource
+ UserTeamDao dao;
+
+ public void insertTeam(UserTeam team){
+ dao.insertTeam(team);
+ }
+
+ public List selectById(int id){
+ if(id==-1){
+ return dao.selectAll();
+ }
+ return dao.selectTeamById(id);
+ }
+}