添加对操作员的简单操作

This commit is contained in:
freeebird
2018-10-16 20:35:42 +08:00
parent 9c7af9d032
commit 931447aa39
7 changed files with 263 additions and 18 deletions

View File

@@ -27,11 +27,11 @@
where worker_id = #{workerId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.mafangui.hotel.entity.Worker">
insert into worker (worker_id, user_name, password,
insert into worker (worker_id, user_name, password,
worker_name, phone, email,
address, create_time, update_time
)
values (#{workerId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
values (#{workerId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{workerName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
@@ -39,9 +39,6 @@
<insert id="insertSelective" parameterType="cn.mafangui.hotel.entity.Worker">
insert into worker
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workerId != null">
worker_id,
</if>
<if test="userName != null">
user_name,
</if>
@@ -60,17 +57,10 @@
<if test="address != null">
address,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workerId != null">
#{workerId,jdbcType=INTEGER},
</if>
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
@@ -89,12 +79,8 @@
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
now(),
now(),
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.mafangui.hotel.entity.Worker">
@@ -139,4 +125,40 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where worker_id = #{workerId,jdbcType=INTEGER}
</update>
<delete id="deleteByUserName" parameterType="String">
delete from worker
where user_name = #{userName,jdbcType=VARCHAR}
</delete>
<update id="updateByUserNameSelective">
update worker
set
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="workerName != null">
worker_name = #{workerName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
update_time = now()
where user_name = #{userName,jdbcType=VARCHAR}
</update>
<select id="selectByUserName" parameterType="String" resultMap="BaseResultMap">
select * from worker
where user_name = #{userName,jdbcType=VARCHAR}
</select>
<select id="findAll" resultMap="BaseResultMap">
select * from worker
</select>
<select id="selectByUserNameAndPassword" resultMap="BaseResultMap">
select * from worker
where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR}
</select>
</mapper>