🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ @Mapper public interface PersonMapper extends tk.mybatis.mapper.common.Mapper<Person> { //增 @Insert({"insert into person (name, age) values (#{name}, #{age})"}) int insertPerson(Person person); @Insert({"insert into person (name, age) values (#{name}, #{age})"}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") int insertPersonGetId(Person person); //查 @Select({"select * from person where id = #{id}"}) Person getPerson(int id); @Select({"select * from person"}) List<Person> getPersons(); //改 @Update({"update person set name = #{name} where id = #{id}"}) int updatePersonById(Person person); //删 @Delete({"delete from person where id = #{id}"}) int deletePerson(Person person); // @Select("select * from person where name = #{name} and age = #{age}") List<Person> findByNameAndAge(@Param("name") String name, @Param("age") int age); } ~~~