liulingling.177216
2024-08-26 349f1cfc5fa77fbc636d542df0d8050fddec48c2
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
37
38
<?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.dingzhuo.energy.data.model.mapper.DataAuthMapper">
  <update id="setUserDataAuth">
    delete
    from data_auth_user
    where user_id = #{id}
    and model_code = #{modelCode};
    <foreach collection="ids" item="authId" separator=";">
      insert into data_auth_user (user_id, node_id, model_code)
      values (#{id},#{authId},#{modelCode})
    </foreach>
  </update>
  <update id="setRoleDataAuth">
    delete
    from data_auth_role
    where role_id = #{id}
    and model_code = #{modelCode};
    <foreach collection="ids" item="authId" separator=";">
      insert into data_auth_role (role_id, node_id, model_code)
      values (#{id},#{authId},#{modelCode})
    </foreach>
  </update>
  <select id="getUserDataAuth" resultType="java.lang.String">
    select node_id
    from data_auth_user
    where user_id = #{id}
      and model_code = #{modelCode};
  </select>
  <select id="getRoleDataAuth" resultType="java.lang.String">
    select node_id
    from data_auth_role
    where role_id = #{id}
      and model_code = #{modelCode};
  </select>
</mapper>