38 lines
1.9 KiB
XML
38 lines
1.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="com.bwie.user.mapper.UserMapper">
|
|
<insert id="addRole">
|
|
INSERT INTO `wuye`.`role` ( `role_name`, `add_login_id`, `up_login_id`, `add_login_time`, `up_login_time`, `user_id`)
|
|
VALUES ( #{roleName}, #{addLoginId}, #{addLoginId}, now(), now(), #{userId});
|
|
</insert>
|
|
<insert id="addUser">
|
|
INSERT INTO `wuye`.`user` ( `user_name`, `user_emil`, `user_tel`, `user_zh`, `user_type`, `user_start`, `user_time`)
|
|
VALUES (#{userName}, #{userEmil}, #{userTel}, #{userZh}, #{userType}, 0, now());
|
|
</insert>
|
|
|
|
<select id="findByUser" resultType="com.bwie.common.domain.User">
|
|
select * from `user`
|
|
</select>
|
|
<select id="findByRole" resultType="com.bwie.common.domain.Role">
|
|
SELECT role.role_id , role.role_name,login.login_name,role.add_login_time,role.up_login_time,`user`.user_name,role.add_login_id,role.up_login_id FROM role
|
|
LEFT JOIN login on role.add_login_id =login.login_id
|
|
LEFT JOIN `user` on role.user_id =`user`.user_id
|
|
</select>
|
|
<select id="findByLoginId" resultType="com.bwie.common.domain.Login">
|
|
select * from `login` where login_id =#{addLoginId}
|
|
</select>
|
|
|
|
<select id="findByUserAuthority" resultType="java.lang.Integer">
|
|
select role_id from authority where user_id = #{userId}
|
|
</select>
|
|
<select id="findByPhone" resultType="com.bwie.common.domain.User">
|
|
select * from `user` where user_tel = #{phone}
|
|
</select>
|
|
<select id="AllRole" resultType="com.bwie.common.domain.Role">
|
|
select * from `role`
|
|
</select>
|
|
<select id="findByUserRoleIds" resultType="com.bwie.common.domain.Role">
|
|
select * from role where role_id in (${ids})
|
|
</select>
|
|
</mapper>
|