| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526 |
- <?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="platform.modules.sys.dao.ApprovalDao">
- <!-- 查找最近一条审核记录(含撤回的) -->
- <select id="getLatestApprovalAll" resultType="platform.modules.sys.entity.Approval">
- select *
- from z_approval
- where apply_id = #{apply_id}
- and type = #{type}
- <!-- and del_flag = 0 -->
- order by create_time desc
- limit 0,1
- </select>
- <!-- 查找最近一条审核记录 -->
- <select id="getLatestApproval" resultType="platform.modules.sys.entity.Approval">
- select *
- from z_approval
- where apply_id = #{apply_id}
- and type = #{type}
- and del_flag = 0 and is_withdraw is null
- order by id desc
- limit 0,1
- </select>
- <!-- 查找当前用户最近一条待审核记录 -->
- <select id="getLatestApprovalByUser" resultType="platform.modules.sys.entity.Approval">
- select *
- from z_approval
- where
- apply_id = #{apply_id}
- and type = #{type}
- and (
- NEXTCHECKER = #{user_id}
- or NEXTCHECKER LIKE CONCAT(CONCAT('%',#{user_id}), ',%')
- or NEXTCHECKER LIKE CONCAT(CONCAT('%,',#{user_id}), '%')
- )
- order by create_time desc
- limit 0,1
- </select>
- <!-- 查找当前用户最近一条审核的记录 含撤回的记录-->
- <select id="getLatestApprovalAllByUser" resultType="platform.modules.sys.entity.Approval">
- select *
- from z_approval
- where
- apply_id = #{apply_id}
- and type = #{type}
- and CHECKER = #{user_id}
- order by create_time desc
- limit 0,1
- </select>
- <select id="findLastByCheckerAndBeforeStatu" resultType="platform.modules.sys.entity.Approval">
- SELECT * FROM z_approval where
- apply_id=#{id}
- and type = #{type}
- <if test="userId != null and userId != ''">
- and checker=#{userId}
- </if>
- <if test="complianceAudit != null and complianceAudit != ''">
- and BEFORE_APPROVALSTATUS=#{complianceAudit}
- </if>
- and del_flag = 0
- order by create_time desc limit 1
- </select>
- <select id="findDepartmentNameByApplyId" resultType="String">
- SELECT DISTINCT DEPARTMENT from z_approval where APPLY_ID=#{id} AND <![CDATA[ BEFORE_APPROVALSTATUS <> 1
- ]]> and del_flag = 0
- </select>
- <select id="findProcessNodes" resultType="platform.common.base.model.DictionaryItem">
- select
- item.name,
- item.value,
- item.sort,
- app.create_time
- from dictionary_item item
- LEFT JOIN dictionary_type t on t.id = item.tid
- LEFT JOIN z_approval app on app.BEFORE_APPROVALSTATUS = item.value
- where t.`name` = #{statusType}
- and app.apply_id = #{apply_id}
- and app.approval_round = (select max(approval_round) from z_approval where apply_id = #{apply_id})
-
- order by app.create_time
- </select>
- <select id="selectAllApprovalDistinct" resultType="platform.modules.sys.entity.Approval">
- SELECT
- *
- FROM
- z_approval t
- WHERE
- id = (
- SELECT
- max(id)
- FROM
- z_approval b
- WHERE
- b.apply_id = t.apply_id
- )
- <if test="type != null and type != ''">
- and t.type=#{type}
- </if>
- </select>
- <select id="selectAllApproval" resultType="platform.modules.sys.entity.Approval">
- SELECT
- *
- FROM
- z_approval t
- where 1=1
- AND del_flag = 0
- <if test="type != null and type != ''">
- and t.type=#{type}
- </if>
- </select>
- <select id="getCenterBusiness" resultType="platform.modules.government.dto.CenterBusiness">
- SELECT
- type,
- COUNT( DISTINCT apply_id) AS businessNum
- FROM
- z_approval
- WHERE
- department = #{businessSearchDto.department}
- AND del_flag = 0
- AND `type` <![CDATA[ <> ]]> '存量用地'
- AND `type` <![CDATA[ <> ]]> '企业注册'
- <if test="businessSearchDto.status != null and businessSearchDto.status != ''">
- AND AFTER_APPROVALSTATUS = null
- </if>
- GROUP BY type
- </select>
- <select id="getBusinessVolume" resultType="java.lang.Integer">
- SELECT
- COUNT(DISTINCT APPLY_ID )
- FROM
- z_approval
- WHERE
- `type` <![CDATA[ <> ]]> '存量用地'
- AND `type` <![CDATA[ <> ]]> '企业注册'
- AND del_flag = 0
- <if test="businessSearchDto.department != null and businessSearchDto.department != ''">
- AND DEPARTMENT = #{businessSearchDto.department}
- </if>
- <if test="businessSearchDto.status != null and businessSearchDto.status != ''">
- AND AFTER_APPROVALSTATUS = null
- </if>
- <if test="businessSearchDto.week">
- AND YEARWEEK( date_format( create_time, '%Y-%m-%d' ) ) = YEARWEEK( now( ) )
- </if>
- <if test="businessSearchDto.month">
- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- </select>
- <select id="getBusinessAcceptNum" resultType="java.lang.Integer">
- SELECT
- count(*)
- FROM
- (
- SELECT
- id,
- create_time
- FROM
- project_application
- WHERE
- del_flag = 0
- AND apply_status != 0 UNION
- SELECT
- id,
- create_time
- FROM
- project_filling
- WHERE
- del_flag = 0
- AND apply_status != 0 UNION
- SELECT
- id,
- create_time
- FROM
- project_intelligent
- WHERE
- del_flag = 0
- AND apply_status != 0 UNION
- SELECT
- id,
- create_time
- FROM
- project_provinces
- WHERE
- del_flag = 0
- AND apply_status != 0 UNION
- SELECT
- id,
- create_time
- FROM
- project_filling
- WHERE
- del_flag = 0
- AND apply_status != 0 UNION
- SELECT
- id,
- create_time
- FROM
- project_matters
- WHERE
- del_flag = 0
- AND apply_status != 0
- ) a
- WHERE 1=1
- <if test="businessSearchDto.week">
- AND YEARWEEK( date_format( create_time, '%Y-%m-%d' ) ) = YEARWEEK( now( ) )
- </if>
- <if test="businessSearchDto.month">
- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- </select>
- <select id="getWindowBusiness" resultType="platform.modules.government.dto.CenterWindow">
- SELECT
- COUNT( type = '省市申报' OR NULL ) AS provincesNum,
- COUNT( type = '区级智能制造' OR NULL ) AS inteligentNum,
- COUNT( type = '服务事项' OR NULL ) AS mattersNum,
- COUNT( type = '项目填报' OR NULL ) AS fillingNum,
- COUNT( type = '项目申报' OR NULL ) AS projectNum
- FROM
- z_approval
- WHERE
- del_flag = 0
- AND `type` <![CDATA[ <> ]]>'存量用地'
- AND `type` <![CDATA[ <> ]]> '企业注册'
- AND CHECKER = #{businessSearchDto.userId}
- <if test="businessSearchDto.week">
- AND YEARWEEK( date_format( create_time, '%Y-%m-%d' ) ) = YEARWEEK( now( ) )
- </if>
- <if test="businessSearchDto.month">
- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- </select>
- <select id="getMonthStatistical" resultType="platform.modules.government.dto.CenterWindow">
- SELECT
- COUNT( type = '省市申报' OR NULL ) AS provincesNum,
- COUNT( type = '区级智能制造' OR NULL ) AS inteligentNum,
- COUNT( type = '服务事项' OR NULL ) AS mattersNum,
- COUNT( type = '项目填报' OR NULL ) AS fillingNum,
- COUNT( type = '项目申报' OR NULL ) AS projectNum
- FROM
- z_approval
- WHERE
- department = '中心窗口'
- AND del_flag = 0
- AND `type` <![CDATA[ <> ]]>'存量用地'
- AND `type` <![CDATA[ <> ]]> '企业注册'
- <if test="businessSearchDto.month">
- AND YEARWEEK(date_format(create_time,'%Y-%m-%d')) = YEARWEEK(now()) - #{businessSearchDto.xnum}
- </if>
- <if test="businessSearchDto.year">
- AND quarter( create_time ) = quarter(DATE_SUB(now(),interval #{businessSearchDto.xnum} QUARTER))
- </if>
- </select>
- <select id="getOverallAnalysis" resultType="platform.modules.government.dto.GovStatisticsDto">
- SELECT
- `type`,
- COUNT( DISTINCT APPLY_ID ) AS overallNum
- FROM
- z_approval
- WHERE
- del_flag = 0
- AND `type` <![CDATA[ <> ]]> '企业注册'
- <if test="searchCondition.begin_date != null and searchCondition.begin_date !='' ">
- <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(#{searchCondition.begin_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="searchCondition.end_date != null and searchCondition.end_date !='' ">
- <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')<= DATE_FORMAT(#{searchCondition.end_date}, '%Y-%m-%d') ]]>
- </if>
- GROUP BY
- `type`
- </select>
- <select id="getDepartmentTrack" resultType="platform.modules.government.dto.AffairsTrackingDto">
- SELECT
- (
- COUNT( type = '省市申报' OR NULL ) +
- COUNT( type = '存量用地' OR NULL ) +
- COUNT( type = '服务事项' OR NULL ) +
- COUNT( type = '项目填报' OR NULL ) +
- COUNT( type = '项目申报' OR NULL )
- )AS totalHandelNum,
- COUNT( type = '省市申报' OR NULL ) AS provincesHandleNum,
- COUNT( type = '存量用地' OR NULL ) AS stocklandHandleNum,
- COUNT( type = '服务事项' OR NULL ) AS mattersHandleNum,
- COUNT( type = '项目填报' OR NULL ) AS fillingHandleNum,
- COUNT( type = '项目申报' OR NULL ) AS projectHandleNum
- FROM
- z_approval
- WHERE
- `type` <![CDATA[ <> ]]> '企业注册'
- AND DEL_FLAG = 0
- AND CHECKER IN
- <foreach collection="userList" index="index" item="item" open="(" separator="," close=")">
- #{item.id}
- </foreach>
- </select>
- <select id="getTrackByUser" resultType="platform.modules.government.dto.CheckTrackingNum">
- SELECT
- COUNT( * ) AS handleNum
- FROM
- z_approval
- WHERE
- DEL_FLAG = 0
- AND CHECKER = #{userId}
- </select>
- <select id="getDocumentByUser" resultType="platform.modules.sys.entity.Approval">
- SELECT
- *
- FROM
- z_approval a
- WHERE
- a.CHECKER = #{searchCondition.userId}
- AND del_flag = 0
- </select>
- <select id="getSearchDocumentByUser" resultType="platform.modules.government.dto.CheckTrackingNum">
- SELECT
- #{searchCondition.checkName} AS checkName,
- businessType,
- applyId,
- affairsType,
- approveTime,
- applyNo,
- company,
- approvalStatus,
- applyStatus
- FROM
- (
- SELECT
- 1 AS businessType,
- a.apply_id AS applyId,
- a.type AS affairsType,
- a.deal_time AS approveTime,
- pa.apply_no AS applyNo,
- c.company_name AS company,
- i.`value` AS approvalStatus,
- i.`name` AS applyStatus
- FROM
- z_approval a
- LEFT JOIN project_application pa ON pa.id = a.APPLY_ID
- LEFT JOIN y_company c ON c.id = pa.company_id
- LEFT JOIN dictionary_item i ON pa.approve_status = i.`value`
- LEFT JOIN dictionary_type t ON t.id = i.tid
- WHERE
- a.del_flag = 0
- AND CHECKER = #{searchCondition.userId}
- AND a.type = '项目申报'
- AND t.`name` = '项目申报审核状态'
- UNION
- SELECT
- 3 AS businessType,
- a.apply_id AS applyId,
- a.type AS affairsType,
- a.deal_time AS approveTime,
- pa.apply_no AS applyNo,
- c.company_name AS company,
- i.`value` AS approvalStatus,
- i.`name` AS applyStatus
- FROM
- z_approval a
- LEFT JOIN project_filling pa ON pa.id = a.APPLY_ID
- LEFT JOIN y_company c ON c.id = pa.company_id
- LEFT JOIN dictionary_item i ON pa.approve_status = i.`value`
- LEFT JOIN dictionary_type t ON t.id = i.tid
- WHERE
- a.del_flag = 0
- AND CHECKER = #{searchCondition.userId}
- AND a.type = '项目填报'
- AND t.`name` = '项目填报审核状态'
- UNION
- SELECT
- 4 AS businessType,
- a.apply_id AS applyId,
- a.type AS affairsType,
- a.deal_time AS approveTime,
- pa.apply_no AS applyNo,
- c.company_name AS company,
- i.`value` AS approvalStatus,
- i.`name` AS applyStatus
- FROM
- z_approval a
- LEFT JOIN project_matters pa ON pa.id = a.APPLY_ID
- LEFT JOIN y_company c ON c.id = pa.company_id
- LEFT JOIN dictionary_item i ON pa.approve_status = i.`value`
- LEFT JOIN dictionary_type t ON t.id = i.tid
- WHERE
- a.del_flag = 0
- AND CHECKER = #{searchCondition.userId}
- AND a.type = '服务事项'
- AND t.`name` = '服务事项审核状态'
- UNION
- SELECT
- 2 AS businessType,
- a.apply_id AS applyId,
- a.type AS affairsType,
- a.deal_time AS approveTime,
- pa.apply_no AS applyNo,
- c.company_name AS company,
- i.`value` AS approvalStatus,
- i.`name` AS applyStatus
- FROM
- z_approval a
- LEFT JOIN project_provinces pa ON pa.id = a.APPLY_ID
- LEFT JOIN y_company c ON c.id = pa.company_id
- LEFT JOIN dictionary_item i ON pa.approve_status = i.`value`
- LEFT JOIN dictionary_type t ON t.id = i.tid
- WHERE
- a.del_flag = 0
- AND CHECKER = #{searchCondition.userId}
- AND a.type = '省市申报'
- AND t.`name` = '省市申报审核状态'
- UNION
- SELECT
- 5 AS businessType,
- a.apply_id AS applyId,
- a.type AS affairsType,
- a.deal_time AS approveTime,
- pa.apply_no AS applyNo,
- c.company_name AS company,
- i.`value` AS approvalStatus,
- i.`name` AS applyStatus
- FROM
- z_approval a
- LEFT JOIN c_stock_land_apply pa ON pa.id = a.APPLY_ID
- LEFT JOIN y_company c ON c.id = pa.company_id
- LEFT JOIN dictionary_item i ON pa.approve_status = i.`value`
- LEFT JOIN dictionary_type t ON t.id = i.tid
- WHERE
- a.del_flag = 0
- AND CHECKER = #{searchCondition.userId}
- AND a.type = '存量用地'
- AND t.`name` = '存量用地审核状态'
- ) t
- WHERE 1=1
- <if test="searchCondition.businessName != null and searchCondition.businessName !='' ">
- AND affairsType = #{searchCondition.businessName}
- </if>
- <if test="searchCondition.approvalStatus != null and searchCondition.approvalStatus !='' ">
- AND approvalStatus = #{searchCondition.approvalStatus}
- </if>
- <if test="searchCondition.applyNo != null and searchCondition.applyNo !='' ">
- AND applyNo LIKE CONCAT('%',#{searchCondition.applyNo},'%')
- </if>
- <if test="searchCondition.company != null and searchCondition.company !='' ">
- AND company LIKE CONCAT('%',#{searchCondition.company},'%')
- </if>
- <if test="searchCondition.begin_date != null and searchCondition.begin_date !='' ">
- AND approveTime <![CDATA[ >= ]]> #{searchCondition.begin_date}
- </if>
- <if test="searchCondition.end_date != null and searchCondition.end_date !='' ">
- AND approveTime <![CDATA[ <= ]]> #{searchCondition.end_date}
- </if>
- ORDER BY
- approveTime DESC
- </select>
- <select id="getNear3MonthStatistical" resultType="platform.modules.sys.entity.Approval">
- SELECT
- id,
- create_time
- FROM
- (
- SELECT
- id,
- create_time
- FROM
- project_application UNION
- SELECT
- id,
- create_time
- FROM
- project_filling UNION
- SELECT
- id,
- create_time
- FROM
- project_matters UNION
- SELECT
- id,
- create_time
- FROM
- project_intelligent UNION
- SELECT
- id,
- create_time
- FROM
- project_provinces
- ) t
- WHERE
- 1=1
- <if test="month == 0">
- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- <if test="month == 1">
- AND date_format(create_time, '%Y %m') = date_format(DATE_SUB(curdate(), INTERVAL #{month} MONTH),'%Y %m')
- </if>
- <if test="month == 2">
- AND date_format(create_time, '%Y %m') = date_format(DATE_SUB(curdate(), INTERVAL #{month} MONTH),'%Y %m')
- </if>
- </select>
- </mapper>
|