123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521 |
- <?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="com.hz.employmentsite.mapper.cquery.StatisticsCQuery">
- <select id="findSystemDataCount" resultType="com.hz.employmentsite.vo.statistics.SystemDataCount">
- SELECT
- site.SiteID,
- site.RegionCode,
- site.SiteName,
- area.`name` AS regionName,
- -- 驿站人员数量
- (
- SELECT
- COUNT( 1 )
- FROM
- pc_site_user site_user
- LEFT JOIN sys_user sys_user ON site_user.UserID = sys_user.UserID
- WHERE
- site_user.SiteID = site.SiteID
- AND sys_user.RecordStatus = 1
- ) AS siteUserCount,
- -- 指定时间段的登记企业数量
- (
- SELECT
- COUNT( 1 )
- FROM
- pc_company
- WHERE
- SiteID = site.SiteID
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS companyCount,
- -- 指定时间段的登记岗位数量
- (
- SELECT
- COUNT( 1 )
- FROM
- pc_post post
- WHERE
- CompanyID IN ( SELECT company.CompanyID FROM pc_company company WHERE company.SiteID = site.SiteID )
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS postCount,
- -- 指定时间段的登记求职人员数量
- (
- SELECT
- COUNT( 1 )
- FROM
- pc_jobuser
- WHERE
- SiteID = site.SiteID
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS jobUserCount
- FROM
- pc_site site
- LEFT JOIN area_code area ON site.RegionCode = area.`code`
- ORDER BY site.RegionCode
- </select>
- <select id="findWeekSystemDataCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- subquery.RegionCode,
- subquery.RegionName,
- SUM(subquery.companyCount) AS companyCount,
- SUM(subquery.postCount) AS postCount,
- SUM(subquery.jobUserCount) AS jobUserCount
- FROM
- (
- SELECT
- site.SiteID,
- site.RegionCode,
- area.`Name` AS RegionName,
- -- 指定时间段的登记企业数量
- (
- SELECT COUNT(1)
- FROM pc_company
- WHERE
- SiteID = site.SiteID
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS companyCount,
- -- 指定时间段的登记岗位数量
- (
- SELECT COUNT(1)
- FROM pc_post post
- WHERE
- CompanyID IN (SELECT company.CompanyID FROM pc_company company WHERE company.SiteID = site.SiteID)
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS postCount,
- -- 指定时间段的登记求职人员数量
- (
- SELECT COUNT(1)
- FROM pc_jobuser
- WHERE
- SiteID = site.SiteID
- <if test="startDate != null">
- and DATE(CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- ) AS jobUserCount
- FROM
- pc_site site
- LEFT JOIN area_code area ON site.RegionCode = area.`code`
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- WHERE
- 1=1
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- ) AS subquery
- GROUP BY
- subquery.RegionCode,
- subquery.RegionName
- ORDER BY
- subquery.RegionCode;
- </select>
- <select id="findRegionSiteUserCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS regionCode,
- area.`name` AS regionName,
- COUNT( sysUser.UserID ) AS siteUserCount
- FROM
- area_code area
- LEFT JOIN pc_site site ON site.RegionCode = area.`code`
- LEFT JOIN pc_site_user siteUser ON site.SiteID = siteUser.SiteID
- LEFT JOIN sys_user sysUser ON siteUser.UserID = sysUser.UserID AND sysUser.RecordStatus = 1
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- WHERE
- area.lv = 3
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`
- ORDER BY
- area.`code`
- </select>
- <select id="findJobUserCountByAgeRange" resultType="com.hz.employmentsite.vo.statistics.jobUser.AgeRangeJobUserCount">
- SELECT
- CASE
- WHEN TIMESTAMPDIFF(YEAR, BirthDay, CURDATE()) BETWEEN 16 AND 25 THEN '16-25岁'
- WHEN TIMESTAMPDIFF(YEAR, BirthDay, CURDATE()) BETWEEN 26 AND 35 THEN '26-35岁'
- WHEN TIMESTAMPDIFF(YEAR, BirthDay, CURDATE()) BETWEEN 36 AND 45 THEN '36-45岁'
- WHEN TIMESTAMPDIFF(YEAR, BirthDay, CURDATE()) BETWEEN 46 AND 55 THEN '46-55岁'
- ELSE '55岁以上'
- END AS AgeRange,
- Sex,
- COUNT(1) AS jobUserCount
- FROM
- pc_jobuser
- WHERE
- 1=1
- <if test="year!='' and year!=null">
- and YEAR(CreateTime) = #{year}
- </if>
- <if test="month!='' and month!=null">
- and MONTH(CreateTime) = #{month}
- </if>
- GROUP BY
- AgeRange,
- Sex
- ORDER BY
- AgeRange,
- Sex;
- </select>
- <select id="findJobUserCountByPersonType" resultType="com.hz.employmentsite.vo.statistics.jobUser.PersonTypeJobUserCount">
- SELECT
- jobuser.KeyPersonTypeID,
- keytype.`Name` AS KeyTypeName,
- jobuser.CultureRank,
- culture.`Name` AS CultureName,
- COUNT( 1 ) AS jobUserCount
- FROM
- `pc_jobuser` jobuser
- LEFT JOIN sys_dictionary_item keytype ON jobuser.KeyPersonTypeID = keytype.`Value`
- AND keytype.DictionaryCode = 'KeyPersonType'
- LEFT JOIN sys_dictionary_item culture ON jobuser.CultureRank = culture.`Value`
- AND culture.DictionaryCode = 'HighestDegree'
- WHERE
- CultureRank IS NOT NULL
- <if test="year!='' and year!=null">
- and YEAR(jobuser.CreateTime) = #{year}
- </if>
- <if test="month!='' and month!=null">
- and MONTH(jobuser.CreateTime) = #{month}
- </if>
- GROUP BY
- jobuser.KeyPersonTypeID,
- KeyTypeName,
- jobuser.CultureRank
- ORDER BY
- jobuser.KeyPersonTypeID,
- jobuser.CultureRank DESC
- </select>
- <select id="findJobUserByRegionAndStatus" resultType="com.hz.employmentsite.vo.statistics.jobUser.RegionJobUserCount">
- SELECT
- area.`code` AS regionCode,
- area.`name` AS regionName,
- COUNT( jobUser.JobuserID ) AS jobUserCount
- FROM
- area_code area
- LEFT JOIN pc_site site ON area.`code` = site.RegionCode
- LEFT JOIN pc_jobuser jobUser ON site.SiteID = jobUser.SiteID
- WHERE
- area.lv = 3
- <if test="year!='' and year!=null">
- and YEAR(jobUser.CreateTime) = #{year}
- </if>
- <if test="month!='' and month!=null">
- and MONTH(jobUser.CreateTime) = #{month}
- </if>
- GROUP BY
- site.RegionCode,
- RegionName
- ORDER BY
- site.RegionCode
- </select>
- <select id="findJobUserByRegionAndPersonType" resultType="com.hz.employmentsite.vo.statistics.jobUser.RegionJobUserCount">
- SELECT
- area.`code` AS regionCode,
- area.`name` AS regionName,
- COUNT( jobUser.JobuserID ) AS jobUserCount
- FROM
- area_code area
- LEFT JOIN pc_site site ON area.`code` = site.RegionCode
- LEFT JOIN pc_jobuser jobUser ON site.SiteID = jobUser.SiteID
- WHERE
- area.lv = 3
- AND jobUser.KeyPersonTypeID IN (13,14,15,16,17,18,19,20,21,22,23,24)
- <if test="year!='' and year!=null">
- and YEAR(jobUser.CreateTime) = #{year}
- </if>
- <if test="month!='' and month!=null">
- and MONTH(jobUser.CreateTime) = #{month}
- </if>
- GROUP BY
- site.RegionCode,
- RegionName
- ORDER BY
- site.RegionCode
- </select>
- <select id="findYearCompanyCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- DATE_FORMAT( company.CreateTime, '%m' ) AS `Month`,
- COUNT( 1 ) AS CompanyCount
- FROM
- pc_company company
- LEFT JOIN pc_site site ON company.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- 1=1
- <if test="year!='' and year!=null">
- and YEAR(company.CreateTime) = #{year}
- </if>
- <if test="startDate != null">
- and DATE(company.CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(company.CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Month`
- ORDER BY
- area.`code`,
- `Month` ASC
- </select>
- <select id="findYearPostCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- DATE_FORMAT( post.CreateTime, '%m' ) AS `Month`,
- COUNT( 1 ) AS PostCount
- FROM
- pc_post post
- LEFT JOIN pc_company company ON post.CompanyID = company.CompanyID
- LEFT JOIN pc_site site ON company.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- 1=1
- <if test="year!='' and year!=null">
- and YEAR(post.CreateTime) = #{year}
- </if>
- <if test="startDate != null">
- and DATE(post.CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(post.CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Month`
- ORDER BY
- area.`code`,
- `Month` ASC
- </select>
- <select id="findYearJobUserCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- DATE_FORMAT( jobUser.CreateTime, '%m' ) AS `Month`,
- COUNT( 1 ) AS JobUserCount
- FROM
- pc_jobuser jobUser
- LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- 1=1
- <if test="year!='' and year!=null">
- and YEAR(jobUser.CreateTime) = #{year}
- </if>
- <if test="startDate != null">
- and DATE(jobUser.CreateTime) <![CDATA[ >= ]]> DATE(#{startDate})
- </if>
- <if test="endDate != null ">
- and DATE(jobUser.CreateTime) <![CDATA[ <= ]]> DATE(#{endDate})
- </if>
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Month`
- ORDER BY
- area.`code`,
- `Month` ASC
- </select>
- <select id="findMonthCompanyCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- WEEK ( company.CreateTime, 5 ) AS `Week`,
- COUNT( 1 ) AS CompanyCount
- FROM
- pc_company company
- LEFT JOIN pc_site site ON company.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- YEAR ( company.CreateTime ) = #{year}
- AND MONTH ( company.CreateTime ) = #{month}
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Week`
- ORDER BY
- area.`code`,
- `Week` ASC
- </select>
- <select id="findMonthPostCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- WEEK( post.CreateTime, 5 ) AS `Week`,
- COUNT( 1 ) AS PostCount
- FROM
- pc_post post
- LEFT JOIN pc_company company ON post.CompanyID = company.CompanyID
- LEFT JOIN pc_site site ON company.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- YEAR ( post.CreateTime ) = #{year}
- AND MONTH ( post.CreateTime ) = #{month}
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Week`
- ORDER BY
- area.`code`,
- `Week` ASC
- </select>
- <select id="findMonthJobUserCount" resultType="com.hz.employmentsite.vo.statistics.RegionSystemDataCount">
- SELECT
- area.`code` AS RegionCode,
- area.`name` AS RegionName,
- WEEK( jobUser.CreateTime, 5 ) AS `Week`,
- COUNT( 1 ) AS JobUserCount
- FROM
- pc_jobuser jobUser
- LEFT JOIN pc_site site ON jobUser.SiteID = site.SiteID
- LEFT JOIN pc_site_institution siteInst ON site.SiteID = siteInst.SiteID
- LEFT JOIN area_code area ON area.`code` = site.RegionCode
- WHERE
- YEAR ( jobUser.CreateTime ) = #{year}
- AND MONTH ( jobUser.CreateTime ) = #{month}
- <if test="siteID!='' and siteID!=null">
- and site.siteID = #{siteID}
- </if>
- <if test="institutionID!='' and institutionID!=null">
- and siteInst.institutionID = #{institutionID}
- </if>
- <if test="regionCode!='' and regionCode!=null">
- and area.`code` = #{regionCode}
- </if>
- GROUP BY
- area.`code`,
- area.`name`,
- `Week`
- ORDER BY
- area.`code`,
- `Week` ASC
- </select>
- <select id="findEmployedJobUserCount" resultType="com.hz.employmentsite.vo.statistics.jobUser.RegionJobUserCount">
- SELECT
- area.`code` AS regionCode,
- area.`name` AS regionName,
- COUNT( jobUser.JobuserID ) AS jobUserCount
- FROM
- area_code area
- LEFT JOIN pc_site site ON area.`code` = site.RegionCode
- LEFT JOIN pc_jobuser jobUser ON site.SiteID = jobUser.SiteID
- WHERE
- area.lv = 3
- AND jobUser.JobStatusID = 1
- GROUP BY
- area.`code`,
- area.`name`
- ORDER BY
- area.`code`
- </select>
- </mapper>
|