safeway/bwie-moudels/bwie-user/target/classes/mapper/UserMapper.xml

79 lines
2.1 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.user.mapper.UserMapper">
<insert id="add">
insert into t_user(
user_name,
user_pwd,
user_type,
user_idcard,
user_age,
user_gender,
user_address,
user_position,
user_sal,
phone,
user_date
) values (
#{userName},
#{userPwd},
#{userType},
#{userIdcard},
#{userAge},
#{userGender},
#{userAddress},
#{userPosition},
#{userSal},
#{phone},
#{userDate}
)
</insert>
<update id="update">
update t_user set
user_name=#{userName},
user_pwd=#{userPwd},
user_type=#{userType},
user_idcard=#{userIdcard},
user_age=#{userAge},
user_gender=#{userGender},
user_address=#{userAddress},
user_position=#{userPosition},
user_sal=#{userSal},
phone=#{phone},
user_date=#{userDate}
where user_id=#{userId}
</update>
<delete id="deleteId">
delete from t_user where user_id=#{userId}
</delete>
<select id="findByPhone" resultType="com.bwie.common.domain.User">
select * from t_user where phone=#{phone}
</select>
<select id="list" resultType="com.bwie.common.domain.User">
select * from t_user
<where>
<if test="userId!=null and userId!=''">
and user_id=#{userId}
</if>
and (user_type=1 or user_type=2)
</where>
</select>
<select id="findById" resultType="com.bwie.common.domain.User">
select * from t_user where user_id=#{userId}
</select>
<select id="list2" resultType="com.bwie.common.domain.User">
select * from t_user
<where>
<if test="userId!=null and userId!=''">
and user_id=#{userId}
</if>
and (user_type=3 or user_type=4)
</where>
</select>
</mapper>