WeQrScopeMapper.xml
4.11 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
<?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.linkwechat.wecom.mapper.WeQrScopeMapper">
<!--<cache type="yiche.scrm.config.mybatis.MybatisRedisCache"/>-->
<resultMap type="com.linkwechat.wecom.domain.WeQrScope" id="WeQrScopeResult">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="qrId" column="qr_id" jdbcType="INTEGER"/>
<result property="scopeId" column="scope_id" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="scopeType" column="scope_type" jdbcType="INTEGER"/>
<result property="party" column="party" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="workCycle" column="work_cycle" jdbcType="VARCHAR"/>
<result property="beginTime" column="begin_time" jdbcType="TIMESTAMP"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="QrScopeResult" type="com.linkwechat.wecom.domain.vo.qr.WeQrScopeVo">
<result property="qrId" column="qr_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="beginTime" column="begin_time" jdbcType="VARCHAR"/>
<result property="endTime" column="end_time" jdbcType="VARCHAR"/>
<result property="workCycle" column="work_cycle" jdbcType="VARCHAR"/>
<collection property="weQrUserList" ofType="com.linkwechat.wecom.domain.vo.qr.WeQrScopeUserVo">
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
</collection>
<collection property="weQrPartyList" ofType="com.linkwechat.wecom.domain.vo.qr.WeQrScopePartyVo">
<result property="party" column="party" jdbcType="VARCHAR"/>
<result property="partyName" column="party_name" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<sql id="selectWeQrScopeVo">
select id, qr_id, scope_id, type, scope_type, party, user_id, work_cycle, begin_time, end_time, create_by, create_time, update_by, update_time, del_flag from we_qr_scope
</sql>
<select id="getWeQrScopeByQrIds" resultMap="QrScopeResult">
select
wqs.qr_id,
wqs.scope_id,
wqs.scope_type,
wqs.`type`,
wqs.begin_time,
wqs.end_time,
wqs.work_cycle,
wqs.user_id,
if(wqs.user_id is null,null,(select wu.user_name from we_user wu where wu.user_id = wqs.user_id limit 1)) as user_name,
wqs.party,
if(wqs.party is null,null,(select wd.name from we_department wd where wd.id= wqs.party limit 1)) as party_name
from we_qr_scope wqs
<where>
<if test="qrIds != null and qrIds.size > 0">
and wqs.qr_id in
<foreach item="qrId" collection="qrIds" index="index" open="(" separator="," close=")">
#{qrId}
</foreach>
</if>
and wqs.del_flag = 0
</where>
</select>
<select id="getWeQrScopeByTime" resultMap="QrScopeResult">
select
wqs.qr_id,
wqs.scope_id,
wqs.scope_type,
wqs.`type`,
wqs.begin_time,
wqs.end_time,
wqs.work_cycle,
wqs.user_id,
wqs.party
from we_qr_scope wqs
where find_in_set(#{value},wqs.work_cycle)
and str_to_date(wqs.begin_time,'%H:%i:%S') <= str_to_date(#{formatTime},'%H:%i:%S')
and str_to_date(wqs.end_time ,'%H:%i:%S') >= str_to_date(#{formatTime},'%H:%i:%S')
and wqs.`type` = 1
and wqs.del_flag = 0
</select>
</mapper>