MyBatis的SQL映射文件头

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.offcn.springcloud.mapper.ProductMapper">
    <select id="findById" resultType="Product" parameterType="Long">
        select id,product_name,db_source from product where id=#{id}
    </select>
    <select id="findAll" resultType="Product">
        select id,product_name,db_source from product
    </select>
    <insert id="addProduct"  parameterType="Product">
        INSERT INTO product(product_name,db_source) VALUES(#{productName},DATABASE())
    </insert>
</mapper>

  

posted @ 2019-11-07 16:14  微笑(* ̄︶ ̄)  阅读(378)  评论(0编辑  收藏  举报