111
k94314517
2023-09-05 85e514c685f2862cfe641b3eadb4412a09af2062
server/src/main/resources/mappers/SystemUserMapper.xml
@@ -18,6 +18,7 @@
      <result column="UPDATE_USER_NAME" property="username"/>
    </association>
  </resultMap>
  <select id="selectManageList" parameterType="doumeemes.dao.system.dto.QuerySystemUserDTO" resultMap="SystemUserListVO">
    SELECT
      DISTINCT
@@ -65,4 +66,55 @@
    ${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">
    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
    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
      <if test="dto.orgin != null">
        AND s.orgin = #{dto.orgin}
      </if>
      <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>