MyBatis Advanced (2) _ Two solutions when columns and entity classes in a database do not match _ fuzzy query _ only label

Source: Internet
Author: User

<?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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.