-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,95 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>edu.xatu</groupId> | ||
<artifactId>APO1</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.8</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
|
||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-aop --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-aop</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-jdbc</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-tx</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
|
||
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver --> | ||
<dependency> | ||
<groupId>org.aspectj</groupId> | ||
<artifactId>aspectjweaver</artifactId> | ||
<version>1.9.4</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>5.1.48</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/com.alibaba/druid --> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>druid</artifactId> | ||
<version>1.1.20</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/junit/junit --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13-beta-3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
<version>5.1.9.RELEASE</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
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,21 @@ | ||
package edu.xatu.dao; | ||
|
||
import edu.xatu.entity.Accout; | ||
import edu.xatu.entity.Channel; | ||
|
||
public interface ChannelDao { | ||
public void addChannel(Channel channel); | ||
|
||
/** | ||
* 根据帐号名查询帐号 | ||
* @param accountName | ||
* @return | ||
*/ | ||
public Accout findByAccountName(String accountName); | ||
|
||
/** | ||
* 修改帐号 | ||
* @param account | ||
*/ | ||
public void updateAccount(Accout account); | ||
} |
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,41 @@ | ||
package edu.xatu.dao; | ||
|
||
import edu.xatu.entity.Accout; | ||
import edu.xatu.entity.Channel; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.jdbc.core.RowMapper; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import javax.annotation.Resource; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
@Repository | ||
public class ChannelDaoImpl implements ChannelDao { | ||
@Resource | ||
private JdbcTemplate jdbcTemplate; | ||
public void addChannel(Channel channel) { | ||
String sql="insert into t_channel values(?,?,?)"; | ||
jdbcTemplate.update(sql,channel.getCid(), | ||
channel.getCname(), | ||
channel.getDescription()); | ||
} | ||
|
||
public Accout findByAccountName(String accountName) { | ||
String sql = "select * from t_account where accountName = ?"; | ||
|
||
return jdbcTemplate.queryForObject(sql, new RowMapper<Accout>() { | ||
public Accout mapRow(ResultSet resultSet, int i) throws SQLException { | ||
Accout a = new Accout(); | ||
a.setAccountName(resultSet.getString("accountName")); | ||
a.setMoney(resultSet.getInt("money")); | ||
return a; | ||
} | ||
},accountName); | ||
} | ||
|
||
public void updateAccount(Accout account) { | ||
String sql = "update t_account set money = ? where accountName = ?"; | ||
jdbcTemplate.update(sql,account.getMoney(),account.getAccountName()); | ||
} | ||
} |
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 edu.xatu.entity; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class Accout { | ||
private String accountName; | ||
private int money; | ||
} |