-
Notifications
You must be signed in to change notification settings - Fork 19
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
6 changed files
with
191 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright 2009-2019 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.ibatis.submitted.default_method; | ||
|
||
import org.apache.ibatis.annotations.Param; | ||
import org.apache.ibatis.annotations.Select; | ||
|
||
public interface Mapper { | ||
|
||
@Select("select * from users where id = #{id}") | ||
User getUserById(Integer id); | ||
|
||
@Select("select * from users where id = #{id} and name = #{name}") | ||
User getUserByIdAndName(@Param("name") String name, @Param("id") Integer id); | ||
|
||
default User defaultGetUser(Object... args) { | ||
return getUserById((Integer) args[0]); | ||
} | ||
|
||
interface SubMapper extends Mapper { | ||
default User defaultGetUser(Object... args) { | ||
return getUserByIdAndName((String) args[0], (Integer) args[1]); | ||
} | ||
} | ||
|
||
} |
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,28 @@ | ||
/** | ||
* Copyright 2009-2019 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.ibatis.submitted.disallowdotsonnames; | ||
|
||
import java.util.List; | ||
|
||
public interface PersonMapper { | ||
Person selectByIdFlush(int id); | ||
|
||
Person selectByIdNoFlush(int id); | ||
|
||
List<Person> selectAllFlush(); | ||
|
||
List<Person> selectAllNoFlush(); | ||
} |
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,63 @@ | ||
package com.huifer.ssm.pojo; | ||
|
||
public class UserKey { | ||
/** | ||
* This field was generated by MyBatis Generator. | ||
* This field corresponds to the database column user.Host | ||
* | ||
* @mbg.generated | ||
*/ | ||
private String host; | ||
|
||
/** | ||
* This field was generated by MyBatis Generator. | ||
* This field corresponds to the database column user.User | ||
* | ||
* @mbg.generated | ||
*/ | ||
private String user; | ||
|
||
/** | ||
* This method was generated by MyBatis Generator. | ||
* This method returns the value of the database column user.Host | ||
* | ||
* @return the value of user.Host | ||
* @mbg.generated | ||
*/ | ||
public String getHost() { | ||
return host; | ||
} | ||
|
||
/** | ||
* This method was generated by MyBatis Generator. | ||
* This method sets the value of the database column user.Host | ||
* | ||
* @param host the value for user.Host | ||
* @mbg.generated | ||
*/ | ||
public void setHost(String host) { | ||
this.host = host == null ? null : host.trim(); | ||
} | ||
|
||
/** | ||
* This method was generated by MyBatis Generator. | ||
* This method returns the value of the database column user.User | ||
* | ||
* @return the value of user.User | ||
* @mbg.generated | ||
*/ | ||
public String getUser() { | ||
return user; | ||
} | ||
|
||
/** | ||
* This method was generated by MyBatis Generator. | ||
* This method sets the value of the database column user.User | ||
* | ||
* @param user the value for user.User | ||
* @mbg.generated | ||
*/ | ||
public void setUser(String user) { | ||
this.user = user == null ? null : user.trim(); | ||
} | ||
} |
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 @@ | ||
package com.huifer.mybatis.entity; | ||
|
||
public class PersonQuery { | ||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
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,20 @@ | ||
package com.huifer.mybatis.proxy; | ||
|
||
/** | ||
* 描述: | ||
* 主要业务的实现 | ||
* | ||
* @author huifer | ||
* @date 2019-02-24 | ||
*/ | ||
public class Person implements BaseMothed { | ||
@Override | ||
public void eat() { | ||
System.out.println("吃东西了"); | ||
} | ||
|
||
@Override | ||
public void play() { | ||
System.out.println("开始玩了"); | ||
} | ||
} |
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,28 @@ | ||
package com.huifer.dubbo.client; | ||
|
||
import com.huifer.dubbo.server.api.DubboHello; | ||
import com.huifer.dubbo.server.api.DubboVersion1; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
/** | ||
* <p>Title : HelloClient </p> | ||
* <p>Description : </p> | ||
* | ||
* @author huifer | ||
* @date 2019-06-13 | ||
*/ | ||
public class HelloClient { | ||
|
||
public static void main(String[] args) { | ||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( | ||
"dubbo-client.xml"); | ||
DubboHello dubboHello = (DubboHello) context.getBean("dubboHello"); | ||
|
||
// String helloDubbo = dubboHello.hello("hello dubbo"); | ||
// System.out.println(helloDubbo); | ||
|
||
DubboVersion1 dv1 = (DubboVersion1) context.getBean("acac"); | ||
System.out.println(dv1.sayHelloV1("hello-dubbo")); | ||
} | ||
|
||
} |