safeway/bwie-moudels/bwie-customer/target/classes/mapper/CustomerMapper.xml

52 lines
1.5 KiB
XML

<?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.bwie.customer.mapper.CustomerMapper">
<insert id="add">
insert into t_customer(
customer_name,
customer_age,
customer_gender,
customer_address,
customer_tel
) values (
#{customerName},
#{customerAge},
#{customerGender},
#{customerAddress},
#{customerTel}
)
</insert>
<update id="update">
update t_customer set
customer_name=#{customerName},
customer_age=#{customerAge},
customer_gender=#{customerGender},
customer_address=#{customerAddress},
customer_tel=#{customerTel}
where customer_id=#{customerId}
</update>
<delete id="deleteId">
delete from t_customer where customer_id=#{customerId}
</delete>
<select id="list" resultType="com.bwie.common.domain.Customer">
select * from t_customer
<where>
<if test="customerId!=null">
and customer_id=#{customerId}
</if>
<if test="customerName!=null and customerName!=''">
and customer_name like concat('%',#{customerName},'%')
</if>
</where>
</select>
<select id="findById" resultType="com.bwie.common.domain.Customer">
select * from t_customer where customer_id=#{customerId}
</select>
</mapper>