| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <#if (distributionEntity.attType)?? && distributionEntity.attType != 0>
- SELECT deptId ,departname ,peopleNum ,
- convert(peopleNum/peopletotal*100,decimal(10,2)) proportion
- FROM
- (
- </#if>
- SELECT cds.yearmonth yearmonth , cds.postid deptId, d.post_name departname ,
- <#if (distributionEntity.attType)?? && distributionEntity.attType != 0>
- round(avg(cds.people_num)) peopleNum ,
- (
- SELECT SUM(peopleNum) peopletotal from (
- SELECT cds.yearmonth yearmonth , cds.postid deptId, d.post_name departname ,
- round(avg(cds.people_num)) peopleNum
- from t_bus_compost_distribution_statistics cds
- LEFT JOIN t_bus_post d
- ON cds.postid = d.ID
- where 1=1
- <#if (distributionEntity.attType)?? && distributionEntity.attType == 2>
- and cds.yearmonth like CONCAT('%', :distributionEntity.attYear ,'%')
- </#if>
- <#if (distributionEntity.attType)?? && distributionEntity.attType != 2>
- <#if ( distributionEntity.yearMonthList )?? && distributionEntity.yearMonthList ?size gt 0>
- and cds.yearmonth in(
- <#list distributionEntity.yearMonthList as item>
- '${item}'
- <#if item_has_next>,</#if>
- </#list>
- )
- </#if>
- </#if>
- GROUP BY cds.postid
- ) a
- ) peopletotal
- </#if>
- <#if (distributionEntity.attType)?? && distributionEntity.attType == 0>
- cds.people_num peopleNum , cds.proportion proportion
- </#if>
- from t_bus_compost_distribution_statistics cds
- LEFT JOIN t_bus_post d
- ON cds.postid = d.ID
- where 1=1
- <#if (distributionEntity.attType)?? && distributionEntity.attType == 2>
- and cds.yearmonth like CONCAT('%', :distributionEntity.attYear ,'%')
- </#if>
- <#if (distributionEntity.attType)?? && distributionEntity.attType != 2>
- <#if ( distributionEntity.yearMonthList )?? && distributionEntity.yearMonthList ?size gt 0>
- and cds.yearmonth in(
- <#list distributionEntity.yearMonthList as item>
- '${item}'
- <#if item_has_next>,</#if>
- </#list>
- )
- </#if>
- </#if>
- <#if (distributionEntity.attType)?? && distributionEntity.attType != 0>
- GROUP BY cds.postid
- ) a
- </#if>
|