guoyuji
2024-05-07 d04cdf7fa560cd86df690e6e5b754e26cdf0e42a
north-glass-erp/src/main/resources/mapper/userInfo/User.xml
@@ -3,9 +3,30 @@
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.erp.mapper.userInfo.UserMapper">
    <select id="findAll">
        SELECT *
        FROM erp_user_info.user
    <resultMap id="findAllMap" type="com.example.erp.entity.userInfo.User">
        <id property="id" column="id"/>
        <result property="loginName" column="login_name"/>
        <result property="userName" column="user_name"/>
        <result property="createTime" column="create_time"/>
        <collection property="userRoleList" ofType="com.example.erp.entity.userInfo.UserRole">
            <result property="userId" column="user_id"/>
            <result property="roleId" column="role_id"/>
            <result property="role" column="role"/>
        </collection>
    </resultMap>
    <select id="findAll" resultMap="findAllMap">
        SELECT a.*,
        b.role_id,
        c.role
        FROM erp_user_info.user as a
        left join user_role as b
        on a.id = b.user_id
        left join role as c
        on b.role_id = c.id
        where state =1 and a.id != 1
    </select>
    <select id="findOne" >
@@ -40,4 +61,9 @@
        where a.id = #{loginId}
    </select>
    <update id="userDelete">
        update user
        set state =0
        where id = #{id}
    </update>
</mapper>