<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE mapperpublic "-//mybatis.org//dtd Mapper 3.0//en" "Http://mybatis.org/dtd/mybatis-3-mapper.dtd "><Mappernamespace= "Cn.cnsdhzzl.dao.StudentDao"> <!--When the columns and entity classes in the database do not match, method one uses Resultmapper - <Resultmaptype= "Student"ID= "Studentmapper"> <!--columns in the database, attributes of the entity class - <resultcolumn= "Dataname" Property= "EntityName" /> </Resultmap> <!--When the columns and entity classes in the database do not match, the as is used in the method two statements, and the properties of the column as entity class in the database - <!--return collection to add Resulttype - <SelectID= "Findstudent"Resulttype= "Student">SELECT * FROM Student</Select> <!--The SQL statement distinguishes the database using the Oracle database stitching statement with the following | | - <!--parameters need to use the map key when passing in the map collection - <SelectID= "Likestudent"Resulttype= "Student"> <!--Incoming Map -SELECT * FROM student where name like '% ' | | #{mname}| | ' % ' and address like '% ' | | #{maddress}| | ' % '<!--Incoming scattered parameters - <!--SELECT * FROM student where name like '% ' | | #{0}| | ' % ' and address like '% ' | | #{1}| | ' % ' - </Select> <!--Smart Tags - <SelectID= "SmartTag"Resulttype= "Student">SELECT * FROM Student<ifTest= "Name!=null">and name like '% ' | | #{name}| | ' % '</if> <ifTest= "Address!=null">and address like '% ' | | #{address}| | ' % '</if> </Select></Mapper>
MyBatis Advanced (2) _ Two solutions when columns and entity classes in a database do not match _ fuzzy query _ only label