Permana
2018-10-02 2429c55948869951cf10ffea42e8b79054e93068
commit | author | age
f7bd7f 1 <?xml version="1.0" encoding="UTF-8" ?>
P 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
4 <mapper namespace="id.co.accessmobile.carrier.billing.unipin.cstools.database.repository.MonitoringUserMapper">
5
6     <resultMap id="user" type="id.co.accessmobile.carrier.billing.unipin.cstools.database.model.MonitoringUser">
7         <result property="id"                 column="id"/>
8         <result property="username"         column="user_name"/>
9     </resultMap>
10
11     <select id="selectForTechnicalUser"  resultMap="user">
12         SELECT
13           user.id,
14           user.user_name
15         FROM
16           db_unipin_cs_tools.tbl_monitoring_user as user ,
17           db_unipin_cs_tools.tbl_monitoring_user_rules as rules
18         WHERE
19           user.id=rules.id AND
20           rules.rule='TECHNICAL'
21     </select>
22     <select id="selectForAdminUser"  resultMap="user">
23         SELECT
24         user.id,
25         user.user_name
26         FROM
27         db_unipin_cs_tools.tbl_monitoring_user as user ,
28         db_unipin_cs_tools.tbl_monitoring_user_rules as rules
29         WHERE
30         user.id=rules.id AND
31         rules.rule='ADMIN'
32     </select>
33
34     <insert id="insertNewUser" parameterType="String">
35         INSERT  INTO
36           tbl_monitoring_user
37         values
38           (#{chatID},#{username},#{chatID})
39     </insert>
40
41     <select id="insertUserRule" parameterType="String" resultMap="user">
42         INSERT  INTO
43         tbl_monitoring_user_rules
44         values
45         (#{chatID},#{rule})
46     </select>
47     <select id="isAdmin" parameterType="String" resultMap="user">
48         SELECT
49           id
50         FROM
51           tbl_monitoring_user_rules
52         WHERE
53           id=#{id} AND
54           rule='ADMIN'
55     </select>
2429c5 56     <select id="isTechnical" parameterType="String" resultMap="user">
P 57         SELECT
58         id
59         FROM
60         tbl_monitoring_user_rules
61         WHERE
62         id=#{id} AND
63         rule='TECHNICAL'
64     </select>
f7bd7f 65
P 66     <select id="findByID" parameterType="String" resultMap="user">
67         SELECT * from tbl_monitoring_user where id=#{id}
68     </select>
69 </mapper>