Blame view

parking-module-system/src/main/resources/mybatis/smapper/SysOrgResSmapper.xml 1.44 KB
55f68655   王彪总   新项目
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
39
  <?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.zteits.sys.mapper.smapper.SysOrgResSmapper" >
    <resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysOrgRes" >
      <id column="id" property="id" jdbcType="BIGINT" />
      <result column="org_id" property="orgId" jdbcType="BIGINT" />
      <result column="res_id" property="resId" jdbcType="BIGINT" />
      <result column="sys_code" property="sysCode" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List" >
      id, org_id, res_id, sys_code
    </sql>
  	<!--批量保存组织与资源关系-->
  	<insert id="batchInsertOrgRes" >
  	       <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
  		      SELECT LAST_INSERT_ID()
  		    </selectKey>
  		    insert into sys_org_res (org_id, res_id, sys_code)
  		        values 
  		     <foreach collection="resIds" item="resId" index="index" separator=",">
  		         (#{orgId}, #{resId}, #{sysCode})
  		     </foreach>
  	</insert>
  	
  	<!--通过组织id删除组织与资源的关系数据-->
  	<delete id="deleteOrgResByorgId">
  	   delete from sys_org_res 
  	   where org_id=${orgId}
  	</delete>
  	
  	<!--通过组织id 查询组织对应资源ids-->
  	<select id="queryResIdsByOrgId" resultType="java.lang.Long">
  	    select res_id 
  	    from sys_org_res 
  	    where org_id=${orgId}
  	       and sys_code=#{sysCode}
  	</select>
    
  </mapper>