freeebird ebbc2671b2 test
2018-10-14 13:40:39 +08:00

106 lines
3.9 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="cn.mafangui.hotel.mapper.AdminMapper">
<resultMap id="BaseResultMap" type="cn.mafangui.hotel.entity.Admin">
<id column="admin_id" jdbcType="INTEGER" property="adminId" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
admin_id, user_name, password, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from admin
where admin_id = #{adminId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from admin
where admin_id = #{adminId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Admin">
insert into admin (admin_id, user_name, password,
create_time, update_time)
values (#{adminId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Admin">
insert into admin
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="adminId != null">
admin_id,
</if>
<if test="userName != null">
user_name,
</if>
<if test="password != null">
password,
</if>
create_time,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="adminId != null">
#{adminId,jdbcType=INTEGER},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
now(),
now()
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Admin">
update admin
<set>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where admin_id = #{adminId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.mafangui.hotel.entity.Admin">
update admin
set user_name = #{userName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where admin_id = #{adminId,jdbcType=INTEGER}
</update>
<select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">
select * from admin
where user_name = #{userName,jdbcType=VARCHAR}
</select>
<select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.Admin" resultMap="BaseResultMap">
select * from admin
where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR}
</select>
<select id="findAll" resultMap="BaseResultMap">
select * from admin
</select>
<update id="updateByUserNameSelective" parameterType="cn.mafangui.hotel.entity.Admin">
update admin
<set>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
update_time = now(),
</set>
where user_name = #{userName,jdbcType=VARCHAR}
</update>
</mapper>