duojiyun/target/classes/mapper/UserMapper.xml

100 lines
3.3 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.bbyb.operating.examination.mapper.UserMapper">
<select id="selectAll" resultType="com.bbyb.operating.examination.model.po.User">
select * from user
</select>
<insert id="insert">
INSERT INTO user
(user_code, user_name, phone, password, email, id_card, gender, is_admin, is_enable, create_by, create_time, update_by, update_time, invalid)
VALUES(#{userCode}, #{userName}, #{phone}, #{password}, #{email}, #{idCard}, #{gender}, #{isAdmin}, #{isEnable}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{invalid})
</insert>
<update id="updateByPrimaryKey">
UPDATE user
<set>
<if test="userCode!=null and userCode!='' ">
user_code = #{userCode},
</if>
<if test="userName!=null and userName!='' ">
user_name = #{userName},
</if>
<if test="phone!=null and phone!='' ">
phone = #{phone},
</if>
<if test="password!=null and password!='' ">
password = #{password},
</if>
<if test="email!=null and email!='' ">
email = #{email},
</if>
<if test="idCard!=null and idCard!='' ">
id_card = #{idCard},
</if>
<if test="gender!=null and gender!='' ">
gender = #{gender},
</if>
<if test="isAdmin!=null and isAdmin!='' ">
is_admin = #{isAdmin},
</if>
<if test="idCard!=null and idCard!='' ">
is_enable = #{isEnable},
</if>
<if test="createBy!=null and createBy!='' ">
create_by = #{createBy},
</if>
<if test="createTime!=null ">
create_time = #{createTime},
</if>
<if test="updateBy!=null and updateBy!='' ">
update_by = #{updateBy},
</if>
<if test="updateTime!=null ">
update_time = #{updateTime},
</if>
<if test="updateBy!=null and updateBy!='' ">
update_by = #{updateBy},
</if>
<if test="invalid!=null and invalid!='' ">
invalid = #{invalid}
</if>
</set>
WHERE id = #{id};
</update>
<delete id="deleteByPrimaryKey">
delete from user where id = #{id}
</delete>
<select id="selectByPrimaryKey" resultType="com.bbyb.operating.examination.model.po.User">
select * from user where id = #{id}
</select>
<select id="getUserAllMenu" resultType="com.bbyb.operating.examination.model.po.Menu">
select
distinct
m.id,
m.menu_code,
m.menu_name,
m.menu_authority_code,
m.menu_path,
m.parent_menu_id,
m.level,
m.menu_type,
m.create_by,
m.create_time,
m.update_by,
m.update_time,
m.invalid
from
user u
left join role_user ru on u.id = ru.user_id
left join role_menu mu on ru.role_id = mu.role_id
left join menu m on m.id = mu.menu_id
where u.id = #{id}
</select>
</mapper>