xm
2024-06-14 722af26bc6fec32bb289b1df51a9016a4935610f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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.dl.system.mapper.SysPostMapper">
 
    <resultMap type="SysPost" id="SysPostResult">
        <id property="postId" column="post_id"/>
        <result property="postCode" column="post_code"/>
        <result property="postName" column="post_name"/>
        <result property="postSort" column="post_sort"/>
        <result property="status" column="status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>
 
    <select id="selectPostListByUserId" parameterType="String" resultType="Long">
        select p.post_id
        from sys_post p
                 left join sys_user_post up on up.post_id = p.post_id
                 left join sys_user u on u.user_id = up.user_id
        where u.user_id = #{userId}
    </select>
 
    <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
        select p.post_id, p.post_name, p.post_code
        from sys_post p
                 left join sys_user_post up on up.post_id = p.post_id
                 left join sys_user u on u.user_id = up.user_id
        where u.user_name = #{userName}
    </select>
 
</mapper>