PlatMsgChannelMapper.xml
2.82 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
<?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="cn.runsa.portal.base.dao.PlatMsgChannelMapper" >
<resultMap id="BaseResultMap" type="cn.runsa.portal.base.entity.PlatMsgChannel">
<id column="pmcId" property="id"/>
<result column="pmcType" property="pmcType" jdbcType="SMALLINT" />
<association property="msgChannel" javaType="cn.runsa.portal.base.entity.MsgChannel">
<id column="mcId" property="id" jdbcType="INTEGER" />
<result column="mcName" property="name" jdbcType="VARCHAR" />
<result column="mcDesc" property="desc" jdbcType="VARCHAR" />
<result column="mcType" property="type" jdbcType="SMALLINT" />
<result column="mcProvider" property="provider" jdbcType="VARCHAR" />
<result column="mcAccount" property="account" jdbcType="VARCHAR" />
<result column="mcPassword" property="password" jdbcType="VARCHAR" />
<result column="mcProtocol" property="protocol" jdbcType="SMALLINT" />
<result column="mcRemain" property="remain" jdbcType="INTEGER" />
<result column="mcPort" property="port" jdbcType="INTEGER" />
<result column="mtRemark" property="remark" jdbcType="VARCHAR" />
<result column="mtUpdater" property="updater" jdbcType="INTEGER" />
<result column="mtUpTime" property="upTime" jdbcType="TIMESTAMP" />
<association property="msgProvider" javaType="cn.runsa.portal.base.entity.MsgProvider">
<id column="mpId" property="id"/>
<result column="mpName" property="name"/>
<result column="mpUrl" property="url"/>
<result column="mpAuthType" property="authType"/>
<result column="mpServiceType" property="serviceType"/>
<result column="mpClassname" property="classname"/>
</association>
</association>
</resultMap>
<select id="selectAllByEmployee" resultMap="BaseResultMap" parameterType="Integer">
select t1.*,t4.*,t5.*
from smPlatMsgChannel t1
inner join smPlatform t2 on t1.plId=t2.plId and t2.ptValid=1
inner join smUsers t3 on t3.plId=t2.plId and t3.emId=#{id} and t3.ptValid=1
inner join smMsgChannel t4 on t1.mcId=t4.mcId
left join smMsgProvider t5 on t4.mcProvider=t5.mpId
</select>
<select id="selectRandomByEmployee" resultMap="BaseResultMap">
select t1.*,t4.*,t5.*
from smPlatMsgChannel t1
inner join smPlatform t2 on t1.plId=t2.plId and t2.ptValid=1
inner join smUsers t3 on t3.plId=t2.plId and t3.emId IN
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
#{item.emid,jdbcType=INTEGER}
</foreach>
and t3.ptValid=1
inner join smMsgChannel t4 on t1.mcId=t4.mcId
left join smMsgProvider t5 on t4.mcProvider=t5.mpId
WHERE t1.pmcType = #{type,jdbcType=INTEGER}
ORDER BY RAND() LIMIT 1
</select>
</mapper>