123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <?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.ubitech.ttc.dao.OrgStatsDataMapper">
- <!-- 开启二级缓存 -->
- <!--<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>-->
- <select id="getOrgstatsDatalist" resultType="cn.ubitech.ttc.model.datatools.reportform.reportDataModel"
- useCache="false">
- SELECT
- d.*, c.dataname,
- c.datacode AS datacode,
- c.datakind,
- c.datatypename,
- c.untit
- FROM
- org_stats_data d
- RIGHT JOIN org_stats_code c ON d.dataparmcode = c.datacode
- AND d.datatype = #{datatype}
- AND d.datatimeyear = #{datatimeyear}
- AND d.datatimemonth = #{datatimemonth}
- AND d.orgid = #{orgid}
- ORDER BY
- c.datacode ASC
- </select>
- <select id="getStatsCount" resultType="java.lang.Integer" useCache="false">
- SELECT
- count(g.id)
- FROM
- (
- SELECT
- (count(o.id)) id
- FROM
- org_stats_data o
- WHERE
- o.datatype = #{datatype}
- AND o.nodeid IN
- <foreach collection="nodeList" item="id" index="index"
- open="(" close=")" separator=",">
- #{id}
- </foreach>
- GROUP BY
- o.datacreatetime,
- o.datatimemonth,
- o.orgid
- ) g
- </select>
- <select id="getOrgstatsCompanylist" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
- SELECT
- *
- FROM
- organization_info g
- WHERE
- g.id IN (
- SELECT DISTINCT
- (o.id)
- FROM
- company_node_lk n,
- organization_info o
- WHERE
- n.companyid = o.id
- <if test="key != null and key != ''">
- AND name like '%${key}%'
- </if>
- AND n.comefrom IN
- <foreach collection="nodeList" item="id" index="index"
- open="(" close=")" separator=",">
- #{id}
- </foreach>
- ORDER BY
- NAME ASC
- )
- </select>
- <select id="getOrgstatsCompanycount" resultType="java.lang.Integer">
- SELECT
- count(g.id)
- FROM
- organization_info g
- WHERE
- g.id IN (
- SELECT DISTINCT
- (o.id)
- FROM
- company_node_lk n,
- organization_info o
- WHERE
- n.companyid = o.id
- <if test="key != null and key != ''">
- AND name like '%${key}%'
- </if>
- AND n.comefrom IN
- <foreach collection="nodeList" item="id" index="index"
- open="(" close=")" separator=",">
- #{id}
- </foreach>
- )
- </select>
- <select id="getTongluMonthReportList" resultType="cn.ubitech.ttc.model.datatools.reportform.reportDataModel"
- useCache="false">
- SELECT
- d.*, c.dataname,
- c.datacode AS datacode,
- c.datakind,
- c.datatypename,
- c.untit
- FROM
- org_stats_data d
- INNER JOIN org_stats_code c ON d.dataparmcode = c.datacode
- AND d.nodeid = #{node}
- AND d.datatimeyear = #{datatimeyear}
- AND d.datatimemonth = #{datatimemonth}
- AND d.orgid = #{oid}
- AND d.datatype != 2
- AND d.linktype = -1
- AND d.connid = -1
- ORDER BY
- d.createtime desc, c.datacode ASC
- </select>
- <select id="getDataValueBySomeIndex" resultType="java.lang.String">
- select d.datavalue
- from org_stats_data d
- inner join org_stats_code code on code.datacode = d.dataparmcode
- inner join organization_info org on org.id = d.orgid
- where org.name = #{orgName}
- and code.id = #{indexid}
- and d.linktype = -1 and d.connid = -1 and d.nodeid = #{node}
- and d.datatimeyear = #{year}
- and d.datatimemonth = #{month}
- and d.datastate = 0
- </select>
- <select id="getOrgNameAndIdList" resultType="cn.ubitech.ttc.entity.OrganizationInfo">
- SELECT DISTINCT o.*
- FROM organization_info o, org_stats_data d
- where d.orgid = o.id
- AND d.nodeid = #{node}
- AND d.linktype = -1
- AND d.connid = -1
- </select>
- <select id="getAnalysisTimeList" resultType="java.lang.String">
- select DISTINCT d.datatimemonth
- from org_stats_data d, org_stats_code code
- where code.node = #{node} and d.nodeid = #{node}
- and d.linktype = -1 and d.connid = -1
- and code.type = 1
- and code.datacode = d.dataparmcode
- and d.datatimeyear = #{year}
- and d.orgid in (
- select o.id
- from organization_info o
- where o.name in
- <foreach collection="orglist" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- )
- </select>
- <select id="getAnalysisYear" resultType="java.lang.String">
- select DISTINCT d.datatimeyear
- from org_stats_data d, org_stats_code code
- where code.node = #{node} and d.nodeid = #{node}
- and d.linktype = -1 and d.connid = -1
- and code.type = 1
- and code.datacode = d.dataparmcode
- and d.orgid in (
- select o.id
- from organization_info o
- where o.name in
- <foreach collection="orglist" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- )
- order by d.datatimeyear desc
- </select>
- </mapper>
|