package com.moti.mapper;
import com.moti.bean.Department;
import org.apache.ibatis.annotations.*;
//指定这是一个操作数据库的mapper
@Mapper
public interface DepartmentMapper {
@Select("select * from department where id = #{id}")
public Department getDeptById(int id);
@Delete("delete from department where id = #{id}")
public int deleteDeptById(int id);
@Options(useGeneratedKeys = true,keyProperty = "id")
@Insert("insert into department(departmentName) values (#{departmentName})")
public int addDept(Department department);
@Update("update department set departmentName = #{departmentName} where id = #{id}")
public int updateDeptById(Department department);
}
注解版的全局配置文件
package com.moti.config;
import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
@org.springframework.context.annotation.Configuration
public class MyBatisConfig {
@Bean
public ConfigurationCustomizer configurationCustomizer(){
return new ConfigurationCustomizer(){
@Override
public void customize(Configuration configuration) {
//开启驼峰命名
configuration.setMapUnderscoreToCamelCase(true);
}
};
}
}
Nice read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch! Glennie Tomas Nichola
Wow, amazing blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is fantastic, as well as the content! Maisey Birch Sayce
If some one needs to be updated with most up-to-date technologies afterward he must be pay a visit this web page and be up to date every day. Becka Gregg Yelich
If some one wishes expert view on the topic of running a blog then i propose him/her to pay a visit this webpage, Keep up the fastidious job. Salomi Ban Vizza Eilis Myles Marguerita
A person essentially help to make severely articles I might state. This is the first time I frequented your web page and thus far? I surprised with the analysis you made to make this particular publish incredible. Fantastic task! Gilda Valentijn Crain
Thank you for this blog Charlotte! I agree that the separation anxiety was always on my part. Thanks for blessing us with your wisdom! Angela Billy Hurley
留言
Nice read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch! Glennie Tomas Nichola
I really like and appreciate your blog post. Keep writing. Kirstin Steffen Fortunato
Good article! We are linking to this particularly great post on our site. Keep up the great writing. Dorine Ingram Moody
Hi there, yes this post is in fact good and I have learned lot of things from it concerning blogging. thanks.| Adi Germaine Hepzi
Every as soon as in a whilst we choose blogs that we study. Listed below would be the most up-to-date web pages that we select Sheela Maxie Gotthelf
You ought to be a part of a contest for one of the finest websites on the net. I will highly recommend this blog! Leena Nobie Adham
Wow, amazing blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is fantastic, as well as the content! Maisey Birch Sayce
If some one needs to be updated with most up-to-date technologies afterward he must be pay a visit this web page and be up to date every day. Becka Gregg Yelich
Very neat article post. Thanks Again. Keep writing. Leontyne Torey Chaney
If some one wishes expert view on the topic of running a blog then i propose him/her to pay a visit this webpage, Keep up the fastidious job. Salomi Ban Vizza Eilis Myles Marguerita
A person essentially help to make severely articles I might state. This is the first time I frequented your web page and thus far? I surprised with the analysis you made to make this particular publish incredible. Fantastic task! Gilda Valentijn Crain
Thank you for this blog Charlotte! I agree that the separation anxiety was always on my part. Thanks for blessing us with your wisdom! Angela Billy Hurley
Amazing! Its in fact awesome piece of writing, I have got much clear idea on the topic of from this piece of writing. Cassandry Ciro Vlad
Yay google is my world beater helped me to find this great site! Andie Stewart Birdella