1

<?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.mengxuegu.springcloud.mapper.ProductMapper">
<select id="findById" resultType="Product" parameterType="Long">
select pid, product_name, db_source from product where pid=#{pid};
</select>
<select id="findAll" resultType="Product">
select pid, product_name, db_source from product;
</select>
<insert id="addProduct" parameterType="Product">
INSERT INTO product(product_name, db_source) VALUES(#{productName},
DATABASE());
</insert>
</mapper> 
原文地址:https://www.cnblogs.com/lijun6/p/12191708.html