UserOrganizationMaps.xml 2.99 KB
   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
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
<?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.lyms.platform.permission.dao.UserOrganizationMapsMapper">

<resultMap id="UserOrganizationMapsResultMap" type="com.lyms.platform.permission.model.UserOrganizationMaps">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="org_id" property="orgId" jdbcType="INTEGER" />
<result column="yn" property="yn" jdbcType="INTEGER" />
<result column="expirTime" property="expirTime" jdbcType="TIMESTAMP" />
</resultMap>



<insert id="addUserOrganizationMaps" parameterType="com.lyms.platform.permission.model.UserOrganizationMaps">
insert into user_organization_maps (user_id,org_id,yn,expirTime) values (#{userId},#{orgId},#{yn},#{expirTime})
</insert>



<update id="updateUserOrganizationMaps" parameterType="com.lyms.platform.permission.model.UserOrganizationMaps">
update user_organization_maps <set><if test="userId != null and userId >= 0">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="orgId != null and orgId >= 0">
org_id = #{orgId,jdbcType=INTEGER},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="expirTime != null">
expirTime = #{expirTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


<delete id="deleteUserOrganizationMaps" parameterType="java.lang.Integer">
delete from user_organization_maps where id = #{id,jdbcType=INTEGER}
</delete>



<select id="getUserOrganizationMaps" resultMap="UserOrganizationMapsResultMap" parameterType="java.lang.Integer">
select id,user_id,org_id,yn,expirTime
from user_organization_maps where id = #{id,jdbcType=INTEGER}
</select>


<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>



<sql id="UserOrganizationMapsCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="userId != null and userId >= 0">
and user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="orgId != null and orgId >= 0">
and org_id = #{orgId,jdbcType=INTEGER}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="expirTime != null">
and expirTime = #{expirTime,jdbcType=TIMESTAMP}
</if>
</where>
</sql>



<select id="queryUserOrganizationMaps" resultMap="UserOrganizationMapsResultMap" parameterType="com.lyms.platform.permission.model.UserOrganizationMapsQuery">
select id,user_id,org_id,yn,expirTime
from user_organization_maps
<include refid="UserOrganizationMapsCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryUserOrganizationMapsCount" resultType="int" parameterType="com.lyms.platform.permission.model.UserOrganizationMapsQuery">
select count(1) from user_organization_maps
<include refid="UserOrganizationMapsCondition" />
</select>



</mapper>