bug
jiangping
2023-11-07 64b432916af9c9218ab3f3eca614e26c542142ae
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?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="doumeemes.dao.system.SystemUserMapper">
 
  <!-- 查询用户列表 -->
  <resultMap id="SystemUserListVO" type="doumeemes.dao.system.vo.SystemUserListVO" autoMapping="true">
    <id column="ID" property="id"/>
    <association property="department" javaType="doumeemes.dao.system.model.SystemDepartment">
      <result column="DEPARTMENT_ID" property="id"/>
      <result column="DEPARTMENT_NAME" property="name"/>
    </association>
    <association property="createUserInfo" javaType="doumeemes.dao.system.model.SystemUser">
      <result column="CREATE_USER_ID" property="id"/>
      <result column="CREATE_USER_NAME" property="username"/>
    </association>
    <association property="updateUserInfo" javaType="doumeemes.dao.system.model.SystemUser">
      <result column="UPDATE_USER_ID" property="id"/>
      <result column="UPDATE_USER_NAME" property="username"/>
    </association>
  </resultMap>
 
  <select id="selectManageList" parameterType="doumeemes.dao.system.dto.QuerySystemUserDTO" resultMap="SystemUserListVO">
    SELECT
      DISTINCT
      usr.*,
      sd.ID AS DEPARTMENT_ID, sd.`NAME` AS DEPARTMENT_NAME,
      create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME,
      update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME
    FROM `SYSTEM_USER` usr
    LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = usr.CREATE_USER
    LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = usr.UPDATE_USER
    LEFT JOIN `SYSTEM_POSITION_USER` spu ON spu.USER_ID = usr.ID AND spu.DELETED = 0
    LEFT JOIN `SYSTEM_POSITION` sp ON sp.ID = spu.POSITION_ID AND sp.DELETED = 0
    LEFT JOIN `SYSTEM_DEPARTMENT_USER` sdu ON sdu.USER_ID = usr.ID AND sdu.DELETED = 0
    LEFT JOIN `SYSTEM_DEPARTMENT` sd ON sd.ID = sdu.DEPARTMENT_ID AND sd.DELETED = 0
    <where>
      usr.DELETED = 0
      <if test="dto.positionId != null">
        AND spu.POSITION_ID = #{dto.positionId}
      </if>
      <if test="dto.strictDeptId != null">
        AND sdu.DEPARTMENT_ID = #{dto.strictDeptId}
      </if>
      <if test="dto.systemid != null">
        AND usr.systemid = #{dto.systemid}
      </if>
      <if test="dto.type != null">
        AND usr.type = #{dto.type}
      </if>
      <if test="dto.departmentIds != null and dto.departmentIds.size > 0">
        AND sdu.DEPARTMENT_ID IN
        <foreach collection="dto.departmentIds" open="(" close=")" separator="," item="id">
          #{id}
        </foreach>
      </if>
      <if test="dto.username != null and dto.username != ''">
        AND usr.`USERNAME` LIKE CONCAT('%', #{dto.username}, '%')
      </if>
      <if test="dto.realname != null and dto.realname != ''">
        AND usr.`REALNAME` LIKE CONCAT('%', #{dto.realname}, '%')
      </if>
      <if test="dto.mobile != null and dto.mobile != ''">
        AND usr.`MOBILE` LIKE CONCAT('%', #{dto.mobile}, '%')
      </if>
    </where>
    ${orderByClause}
  </select>
 
 
  <resultMap id="ActivityLoginVO" type="doumeemes.dao.ext.vo.ActivityLoginVO" autoMapping="true">
    <id column="ID" property="id"/>
  </resultMap>
 
  <select id="activityLoginVOList" parameterType="doumeemes.dao.ext.dto.ActivityLoginDTO" resultMap="ActivityLoginVO">
<<<<<<< HEAD
<<<<<<< HEAD
    select a.DATA_DATE , count(b.id)  as dayActiveUserNum from ( SELECT DATE_FORMAT( DATE_ADD(CONCAT(#{dto.startDate}), INTERVAL(help_topic_id) DAY),'%Y-%m-%d')  DATA_DATE
=======
    select a.DATA_DATE , count(1)  as dayActiveUserNum from ( SELECT DATE_FORMAT( DATE_ADD(CONCAT(#{dto.startDate}), INTERVAL(help_topic_id) DAY),'%Y-%m-%d')  DATA_DATE
>>>>>>> 1.0.3
=======
    select a.DATA_DATE , count(b.id)  as dayActiveUserNum from ( SELECT DATE_FORMAT( DATE_ADD(CONCAT(#{dto.startDate}), INTERVAL(help_topic_id) DAY),'%Y-%m-%d')  DATA_DATE
>>>>>>> dev
    FROM mysql.help_topic
    WHERE  TIMESTAMPDIFF(DAY,CONCAT(#{dto.startDate}),CONCAT(#{dto.endDate})) > help_topic_id )  a
    left join
    ( SELECT  s.*   FROM `system_login_log` s where s.COMPANY_ID is not null and s.COMPANY_USER_ID is not null
      <if test="dto.orgin != null">
        AND s.orgin = #{dto.orgin}
      </if>
        ) b
    on a.DATA_DATE = date_format(b.LOGIN_TIME , '%Y-%m-%d')
    where 1 = 1
    group by a.DATA_DATE
  </select>
 
 
 
  <resultMap id="CompanyLoginStatisticsVO" type="doumeemes.dao.ext.vo.CompanyLoginStatisticsVO" autoMapping="true">
    <id column="ID" property="id"/>
  </resultMap>
 
  <select id="companyLoginStatisticsList" parameterType="doumeemes.dao.ext.dto.CompanyLoginDTO" resultMap="CompanyLoginStatisticsVO">
    SELECT date_format(s.LOGIN_TIME, '%Y-%m-%d') as dataDate ,c.`NAME` as companyName ,s.orgin , count(1)  as loginNum
    FROM `system_login_log` s left join company c on s.COMPANY_ID = c.ID
    <where>
      s.COMPANY_ID is not null
<<<<<<< HEAD
<<<<<<< HEAD
      and s.SUCCESS = 1
      and s.ORGIN is not null
      <if test="dto.orgin != null">
        AND s.orgin = #{dto.orgin}
      </if>
=======
      <if test="dto.orgin != null">
        AND s.orgin = #{dto.orgin}
      </if>
 
>>>>>>> 1.0.3
=======
      and s.SUCCESS = 1
      and s.ORGIN is not null
      <if test="dto.orgin != null">
        AND s.orgin = #{dto.orgin}
      </if>
>>>>>>> dev
      <if test="dto.companyName != null and dto.companyName != ''">
        AND c.`NAME` LIKE CONCAT('%', #{dto.companyName}, '%')
      </if>
 
      <if test="dto.queryMonth != null and dto.queryMonth != ''">
        AND s.LOGIN_TIME LIKE CONCAT('%', #{dto.queryMonth}, '%')
      </if>
 
    </where>
 
    group by S.COMPANY_ID , date_format(s.LOGIN_TIME, '%Y-%m-%d') ,c.`NAME` ,s.orgin
 
    order by s.LOGIN_TIME  desc , c.`NAME` desc
  </select>
 
 
</mapper>