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
kaijun
committed
Nov 17, 2021
1 parent
003a112
commit 4077dfa
Showing
10 changed files
with
99 additions
and
79 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
src/main/java/com/example/demo/SpringBootDemoApplication.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
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
28 changes: 0 additions & 28 deletions
28
src/main/java/com/example/demo/mapper/MemberAccountMapper.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 |
---|---|---|
@@ -1,39 +1,11 @@ | ||
package com.example.demo.mapper; | ||
|
||
import org.apache.ibatis.annotations.Insert; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Select; | ||
import org.apache.ibatis.annotations.Update; | ||
|
||
import com.example.demo.entity.MemberAccount; | ||
|
||
@Mapper | ||
public interface MemberAccountMapper { | ||
|
||
@Insert(" INSERT INTO test_project.member_account ( " | ||
+ " USERNAME, PASSWORD, SALT, " | ||
+ " CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME " | ||
+ " ) " | ||
+ " VALUE ( " | ||
+ " #{username}, #{password}, #{salt}, " | ||
+ " #{create_by}, NOW(), #{update_by}, NOW() " | ||
+ " ) ") | ||
public Integer insert(MemberAccount memberAccount); | ||
|
||
@Select(" SELECT " | ||
+ " ID, USERNAME, PASSWORD, SALT " | ||
+ " FROM " | ||
+ " test_project.member_account " | ||
+ " WHERE " | ||
+ " USERNAME = #{username} ") | ||
public MemberAccount findMemberAccountByUsername(String username); | ||
|
||
@Update(" UPDATE " | ||
+ " test_project.member_account " | ||
+ " SET " | ||
+ " PASSWORD = #{password}, UPDATE_BY = #{update_by}, UPDATE_TIME = NOW() " | ||
+ " WHERE " | ||
+ " ID = #{id} ") | ||
public Integer update(MemberAccount memberAccount); | ||
|
||
} |
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 |
---|---|---|
@@ -1,44 +1,11 @@ | ||
package com.example.demo.mapper; | ||
|
||
import org.apache.ibatis.annotations.Insert; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Select; | ||
import org.apache.ibatis.annotations.Update; | ||
|
||
import com.example.demo.entity.Member; | ||
|
||
@Mapper | ||
public interface MemberMapper { | ||
|
||
@Insert(" INSERT INTO test_project.member ( " | ||
+ " MA_ID, NAME, ID_NUMBER, BIRTHDAY, " | ||
+ " PHONE, C_ID, D_ID, ADDRESS, " | ||
+ " CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME " | ||
+ " ) " | ||
+ " VALUE ( " | ||
+ " #{ma_id}, #{name}, #{id_number}, #{birthday}, " | ||
+ " #{phone}, #{c_id}, #{d_id}, #{address}, " | ||
+ " #{create_by}, NOW(), #{update_by}, NOW() " | ||
+ " ) ") | ||
public Integer insert(Member member); | ||
|
||
@Select(" SELECT " | ||
+ " MA_ID, NAME, ID_NUMBER, BIRTHDAY, " | ||
+ " PHONE, C_ID, D_ID, ADDRESS " | ||
+ " FROM " | ||
+ " test_project.member " | ||
+ " WHERE " | ||
+ " MA_ID = #{ma_id} ") | ||
public Member findMemberByMa_id(String ma_id); | ||
|
||
@Update(" UPDATE " | ||
+ " test_project.member " | ||
+ " SET " | ||
+ " ID_NUMBER = #{id_number}, BIRTHDAY = #{birthday}, PHONE = #{phone}, " | ||
+ " C_ID = #{c_id}, D_ID = #{d_id}, ADDRESS = #{address}, " | ||
+ " UPDATE_BY = #{update_by}, UPDATE_TIME = NOW() " | ||
+ " WHERE " | ||
+ " MA_ID = #{ma_id} ") | ||
public Integer update(Member member); | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<!-- namespace 對應持久層的介面 --> | ||
<mapper namespace="com.example.demo.mapper.CountyMapper" > | ||
<select id="findAllCounty" resultType="com.example.demo.entity.County"> | ||
SELECT | ||
ID, NAME | ||
FROM | ||
test_project.county | ||
</select> | ||
</mapper> |
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<!-- namespace 對應持久層的介面 --> | ||
<mapper namespace="com.example.demo.mapper.DistrictMapper" > | ||
<select id="findDistrictByC_id" resultType="com.example.demo.entity.District"> | ||
SELECT | ||
ID, C_ID, NAME | ||
FROM | ||
test_project.district | ||
WHERE | ||
C_ID = #{c_id} | ||
</select> | ||
</mapper> |
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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<!-- namespace 對應持久層的介面 --> | ||
<mapper namespace="com.example.demo.mapper.MemberAccountMapper" > <!-- id 對應持久層介面的方法,parameterType 為引數資料型別,resultType 為返回資料型別 --> | ||
<insert id="insert" parameterType="com.example.demo.entity.MemberAccount"> | ||
INSERT INTO test_project.member_account ( | ||
USERNAME, PASSWORD, SALT, | ||
CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME | ||
) | ||
VALUES ( | ||
#{username}, #{password}, #{salt}, | ||
#{create_by}, NOW(), #{update_by}, NOW() | ||
) | ||
</insert> | ||
|
||
<select id="findMemberAccountByUsername" parameterType="string" resultType="com.example.demo.entity.MemberAccount"> | ||
SELECT | ||
ID, USERNAME, PASSWORD, SALT | ||
FROM | ||
test_project.member_account | ||
WHERE | ||
USERNAME = #{username} | ||
</select> | ||
|
||
<update id="update" parameterType="com.example.demo.entity.MemberAccount"> | ||
UPDATE | ||
test_project.member_account | ||
SET | ||
PASSWORD = #{password}, UPDATE_BY = #{update_by}, UPDATE_TIME = NOW() | ||
WHERE | ||
ID = #{id} | ||
</update> | ||
</mapper> |
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,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<!-- namespace 對應持久層的介面 --> | ||
<mapper namespace="com.example.demo.mapper.MemberMapper" > <!-- id 對應持久層介面的方法,parameterType 為引數資料型別,resultType 為返回資料型別 --> | ||
<insert id="insert" parameterType="com.example.demo.entity.Member"> | ||
INSERT INTO test_project.member ( | ||
MA_ID, NAME, ID_NUMBER, BIRTHDAY, | ||
PHONE, C_ID, D_ID, ADDRESS, | ||
CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME | ||
) | ||
VALUES ( | ||
#{ma_id}, #{name}, #{id_number}, #{birthday}, | ||
#{phone}, #{c_id}, #{d_id}, #{address}, | ||
#{create_by}, NOW(), #{update_by}, NOW() | ||
) | ||
</insert> | ||
|
||
<select id="findMemberByMa_id" parameterType="string" resultType="com.example.demo.entity.Member"> | ||
SELECT | ||
MA_ID, NAME, ID_NUMBER, BIRTHDAY, | ||
PHONE, C_ID, D_ID, ADDRESS | ||
FROM | ||
test_project.member | ||
WHERE | ||
MA_ID = #{ma_id} | ||
</select> | ||
|
||
<update id="update" parameterType="com.example.demo.entity.Member"> | ||
UPDATE | ||
test_project.member | ||
SET | ||
ID_NUMBER = #{id_number}, BIRTHDAY = #{birthday}, PHONE = #{phone}, | ||
C_ID = #{c_id}, D_ID = #{d_id}, ADDRESS = #{address}, | ||
UPDATE_BY = #{update_by}, UPDATE_TIME = NOW() | ||
WHERE | ||
MA_ID = #{ma_id} | ||
</update> | ||
</mapper> |