parent
4a5dccdb87
commit
7889975302
@ -0,0 +1,59 @@
|
||||
<?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.example.flower.mapper.StaffMapper">
|
||||
<select id="staffLogin" resultType="com.example.flower.entity.Staff">
|
||||
select *
|
||||
from flower.staff
|
||||
where staff_name = #{staff_name}
|
||||
</select>
|
||||
<select id="staffList" resultType="com.example.flower.entity.Staff">
|
||||
select *
|
||||
from flower.staff
|
||||
</select>
|
||||
<select id="staffListByQuery" resultType="com.example.flower.entity.Staff">
|
||||
select *
|
||||
from flower.staff
|
||||
<where>
|
||||
<if test="staff_name != null and staff_name != '' ">
|
||||
and staff_name like concat('%',#{staff_name},'%')
|
||||
or staff_full_name like concat('%',#{staff_name},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<insert id="staffAdd" useGeneratedKeys="true" keyProperty="staff_id" parameterType="com.example.flower.entity.Staff">
|
||||
insert into flower.staff(staff_name, staff_pwd,staff_full_name,staff_role,staff_state,staff_phone,staff_pic)
|
||||
value (#{staff_name},#{staff_pwd},#{staff_full_name},#{staff_role},#{staff_state},#{staff_phone},#{staff_pic})
|
||||
</insert>
|
||||
<delete id="staffDeletePer">
|
||||
delete
|
||||
from flower.staff
|
||||
where staff_id = #{staff_id}
|
||||
</delete>
|
||||
<delete id="staffDeleteMul" parameterType="Integer">
|
||||
delete from flower.staff where staff.staff_id in
|
||||
<foreach collection="staff_ids" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="staffInfo" resultType="com.example.flower.entity.Staff">
|
||||
select *
|
||||
from flower.staff
|
||||
where staff_id = #{staff_id}
|
||||
</select>
|
||||
<update id="staffModify" parameterType="com.example.flower.entity.Staff">
|
||||
update flower.staff
|
||||
set staff_name=if(#{staff_name} is not null and #{staff_name} != '',#{staff_name},staff_name),
|
||||
staff_pwd=if(#{staff_pwd} is not null and #{staff_pwd} != '',#{staff_pwd},staff_pwd),
|
||||
staff_full_name=if(#{staff_full_name} is not null and #{staff_full_name} != '',#{staff_full_name},staff_full_name),
|
||||
staff_state=if(#{staff_state} =1 or #{staff_state} = 0,#{staff_state},staff_state),
|
||||
staff_role=if(#{staff_role} =1 or #{staff_role} = 0,#{staff_role},staff_role),
|
||||
staff_phone=if(#{staff_phone} is not null and #{staff_phone} != '',#{staff_phone},staff_phone),
|
||||
staff_pic=if(#{staff_pic} is not null and #{staff_pic} != '',#{staff_pic},staff_pic)
|
||||
where staff.staff_id = #{staff_id}
|
||||
</update>
|
||||
<update id="staffModifyState" parameterType="Integer">
|
||||
update flower.staff
|
||||
set staff_state = #{staff_state}
|
||||
where staff_id = #{staff_id}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in new issue