| 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.company.dao.StockLandDao">
- <!--存量土地,待审核,jiangjz-->
- <select id="findPageInfo" resultType="platform.modules.company.entity.StockLand">
- SELECT
- a.id,
- a.company_id,
- a.apply_no,
- a.apply_type,
- a.apply_status,
- a.approve_status,
- a.create_time,
- a.update_time,
- b.company_name as company_name,
- c.NAME AS apply_type_name,
- d.NAME AS approve_status_name,
- hour(timediff(date_add(IFNULL(a.update_time,a.create_time),interval 5 day),NOW())) as overTime,
- g.NEXTCHECKER as nextChecker,
- g.create_time as create_date
- FROM
- c_stock_land_apply a
- LEFT JOIN y_company b ON a.company_id = b.id
- LEFT JOIN dictionary_item c ON a.apply_type = c.value
- LEFT JOIN dictionary_item d ON a.approve_status = d.value
- LEFT JOIN dictionary_type e ON e.id = c.tid
- LEFT JOIN dictionary_type f ON f.id = d.tid
- LEFT JOIN z_approval g on g.APPLY_ID = a.id
- LEFT JOIN z_user zUser on zUser.id = a.create_by
- WHERE
- a.del_flag = '0' AND e.id = '1' and f.id='2'
- and (
- nextChecker = #{condition.userId}
- or
- nextChecker LIKE CONCAT(CONCAT(#{condition.userId},','), '%')
- or
- nextChecker LIKE CONCAT(CONCAT('%,',#{condition.userId}), ',%')
- )
- and g.create_time in (select max(CREATE_TIME)from z_approval where del_flag=0 group by APPLY_ID )
- and a.approve_status in
- <foreach collection="condition.apply_status" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="condition.approve_status != null and condition.approve_status!=''">
- and a.approve_status = #{condition.approve_status}
- </if>
- <if test="condition.apply_type != null and condition.apply_type!=''">
- and a.apply_type = #{condition.apply_type}
- </if>
- <if test="condition.keyword != null and condition.keyword!=''">
- and a.apply_no LIKE CONCAT ('%',#{condition.keyword},'%')
- </if>
- <if test="condition.applyUserType!=null and condition.applyUserType!=''">
- and zUser.user_type = #{condition.applyUserType}
- </if>
- order by IFNULL(a.update_time,a.create_time) desc
- </select>
- <!-- 街道审核列表 -->
- <select id="findApprovePageInfo" resultType="platform.modules.company.entity.StockLand">
- SELECT DISTINCT
- a.id,
- a.company_id,
- a.apply_no,
- a.apply_type,
- a.apply_status,
- a.approve_status,
- a.process_status,
- a.create_time,
- a.temporary_state,
- a.create_by
- FROM
- c_stock_land_apply a
- LEFT JOIN z_approval approval on approval.apply_id = a.id
- LEFT JOIN z_user zUser on zUser.id = a.create_by
- LEFT JOIN y_company c on a.company_id = c.id
- WHERE
- a.del_flag = '0' and a.approve_status is not null
- <if test="request.keyword!=null and request.keyword!=''">
- and c.company_name LIKE CONCAT ('%',#{request.keyword},'%')
- </if>
- <if test="request.street_id!=null and request.street_id!=''">
- <!-- and a.street_id=#{request.street_id} -->
- and a.building_street_id=#{request.street_id}
- </if>
- <if test="searchCondition.apply_type!=null and searchCondition.apply_type!=''">
- and a.apply_type=#{searchCondition.apply_type}
- </if>
- <if test="searchCondition.apply_status!=null and searchCondition.apply_status!=''">
- and a.apply_status=#{searchCondition.apply_status}
- </if>
- <if test="searchCondition.approve_status!=null and searchCondition.approve_status!=''">
- and a.approve_status=#{searchCondition.approve_status}
- </if>
- <if test="searchCondition.applyUserType!=null and searchCondition.applyUserType!=''">
- and zUser.user_type = #{searchCondition.applyUserType}
- </if>
- <if test="searchCondition.isPendingAudit == 1"><!-- 为1 ,取待审核数据-->
- and a.id in (
- SELECT DISTINCT APPLY_ID FROM z_approval WHERE (NEXTCHECKER = #{approvalCondition.nextchecker}
- or NEXTCHECKER LIKE CONCAT(#{approvalCondition.nextchecker}, ',%')
- or NEXTCHECKER LIKE CONCAT(CONCAT('%,',#{approvalCondition.nextchecker}), ',%'))
- and (
- id in
- (
- select temp.maxId from (select APPLY_ID,max(id) maxId
- from z_approval
- <if test="approvalCondition.type != null and approvalCondition.type != '' ">
- where type = #{approvalCondition.type}
- </if>
- and del_flag = 0
- GROUP BY APPLY_ID
- ) temp )
- )
- )
- </if>
- <if test="searchCondition.isPendingAudit == 0"><!-- 为0 ,取已审核数据-->
- and a.id not in (
- SELECT DISTINCT APPLY_ID FROM z_approval WHERE (NEXTCHECKER = #{approvalCondition.nextchecker}
- or NEXTCHECKER LIKE CONCAT(#{approvalCondition.nextchecker}, ',%')
- or NEXTCHECKER LIKE CONCAT(CONCAT('%,',#{approvalCondition.nextchecker}), ',%'))
- and (
- id in
- (
- select temp.maxId from (select APPLY_ID,max(id) maxId
- from z_approval
- <if test="approvalCondition.type != null and approvalCondition.type != '' ">
- where type = #{approvalCondition.type}
- </if>
- and del_flag = 0
- GROUP BY APPLY_ID
- ) temp )
- )
- )
- </if>
- order by create_time desc
- </select>
- <!-- 存量用地 已审核 jiangjz-->
- <select id="findApprovalPageInfo" resultType="platform.modules.company.entity.StockLand">
- SELECT
- DISTINCT id,
- company_id,
- apply_no,
- apply_type,
- apply_status,
- approve_status,
- create_time,
- company_name as company_name,
- apply_type_name,
- approve_status_name,
- overTime,
- update_time
- from (
- SELECT
- a.id,
- a.company_id,
- a.apply_no,
- a.apply_type,
- a.apply_status,
- a.approve_status,
- a.create_time,
- a.update_time,
- b.company_name as company_name,
- c.NAME AS apply_type_name,
- d.NAME AS approve_status_name,
- g.CHECKER,
- g.DEAL_TIME as deal_time,
- hour(timediff(date_add(IFNULL(a.update_time,a.create_time),interval 5 day),NOW())) as overTime
- FROM
- c_stock_land_apply a
- LEFT JOIN y_company b ON a.company_id = b.id
- LEFT JOIN dictionary_item c ON a.apply_type = c.value
- LEFT JOIN dictionary_item d ON a.approve_status = d.value
- LEFT JOIN dictionary_type e ON e.id = c.tid
- LEFT JOIN dictionary_type f ON f.id = d.tid
- left join z_approval g on g.APPLY_ID = a.id
- LEFT JOIN z_user zUser on zUser.id = a.create_by
- WHERE
- a.del_flag = '0' AND e.id = '1' and f.id='2' and CHECKER is not null
- and (
- (
- CHECKER = #{condition.userId}
- or
- CHECKER LIKE CONCAT(CONCAT(#{condition.userId},','), '%')
- or
- CHECKER LIKE CONCAT(CONCAT('%,',#{condition.userId}), ',%')
- )
- <if test=" condition.checker_ids!=null ">
- OR ( CHECKER in
- <foreach collection="condition.checker_ids" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- </if>
- )
- <if test="condition.applyUserType!=null and condition.applyUserType!=''">
- and zUser.user_type = #{condition.applyUserType}
- </if>
- and g.del_flag = 0
- ) q
- WHERE 1=1
- <if test="condition.approve_status != null and condition.approve_status!=''">
- and q.approve_status=#{condition.approve_status}
- </if>
- <if test="condition.apply_type != null and condition.apply_type!=''">
- and q.apply_type=#{condition.apply_type}
- </if>
- <if test="condition.keyword != null and condition.keyword!=''">
- and q.apply_no LIKE CONCAT ('%',#{condition.keyword},'%')
- </if>
- order by IFNULL(update_time,create_time) desc
- </select>
- <update id="updateTempporaryStateToNull">
- update c_stock_land_apply set temporary_state = null
- where id = #{id}
- </update>
- <select id="getApplyDate" resultType="String">
- select create_time from z_approval
- where APPLY_ID = #{id} and TYPE = "存量用地" order by create_time limit 0,1
- </select>
- <!-- 审核通过的列表 -->
- <select id="findApprovePassPage" resultType="platform.modules.company.entity.StockLand">
- SELECT DISTINCT
- a.id,
- a.company_id,
- com.company_name company_name,
- a.apply_no apply_no,
- a.apply_type apply_type ,
- a.apply_status apply_status,
- a.approve_status approve_status,
- a.process_status process_status,
- a.create_time create_time,
- a.temporary_state temporary_state,
- a.create_by create_by,
- item.NAME AS apply_type_name,
- item2.NAME AS approve_status_name
- FROM
- c_stock_land_apply a
- LEFT JOIN z_approval approval on approval.apply_id = a.id
- LEFT JOIN y_company com ON com.id = a.company_id
- LEFT JOIN dictionary_item item ON a.apply_type = item.`value`
- LEFT JOIN dictionary_item item2 ON a.approve_status = item2.`value`
- LEFT JOIN dictionary_type type ON type.id = item.tid
- LEFT JOIN dictionary_type type2 ON type2.id = item2.tid
- LEFT JOIN z_user zUser on zUser.id = a.create_by
- WHERE
- a.del_flag = '0'
- AND
- type.id = #{stockLandId} and type2.id=#{approvedId}
- AND
- a.approve_status in
- <foreach collection="statusList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND
- a.apply_type = #{itemId}
- AND
- (a.street_id = #{street_id} or a.building_street_id = #{street_id})
- <if test="keyword != null and keyword != ''">
- AND
- a.apply_no LIKE CONCAT(CONCAT('%',#{keyword}),'%')
- </if>
- <if test="company_name != null and company_name != ''">
- AND
- com.company_name LIKE CONCAT(CONCAT('%',#{company_name}),'%')
- </if>
- <if test="apply_type != null and apply_type != ''">
- AND
- a.apply_type = #{apply_type}
- </if>
- <if test="applyUserType!=null and applyUserType!=''">
- and zUser.user_type = #{applyUserType}
- </if>
- and (
- approval.create_time in
- (
- select temp.maxTime from (select APPLY_ID,max(CREATE_TIME) maxTime
- from z_approval
- GROUP BY APPLY_ID
- ) temp )
- )
- order by a.create_time desc
- </select>
- <!-- 查询所有审核状态下的列表 -->
- <select id="findSelectPage" resultType="platform.modules.company.entity.StockLand">
- SELECT DISTINCT
- a.id,
- a.company_id,
- com.company_name company_name,
- a.apply_no apply_no,
- a.apply_type apply_type ,
- a.apply_status apply_status,
- a.approve_status approve_status,
- a.process_status process_status,
- a.create_time create_time,
- a.temporary_state temporary_state,
- a.create_by create_by,
- (SELECT `name` FROM dictionary_item WHERE tid = 1 AND `value` = a.apply_type) AS apply_type_name,
- (SELECT `name` FROM dictionary_item WHERE tid = 2 AND `value` = a.approve_status) AS approve_status_name
- FROM
- c_stock_land_apply a
- LEFT JOIN y_company com ON com.id = a.company_id
- LEFT JOIN z_user zUser on zUser.id = a.create_by
- WHERE
- a.del_flag = FALSE
- AND
- a.apply_type = #{itemId}
- AND
- a.street_id = #{street_id}
- <if test="keyword != null and keyword != ''">
- AND
- a.apply_no LIKE CONCAT(CONCAT('%',#{keyword}),'%')
- </if>
- <if test="company_name != null and company_name != ''">
- AND
- com.company_name LIKE CONCAT(CONCAT('%',#{company_name}),'%')
- </if>
- <if test="approve_status != null and approve_status != ''">
- AND
- a.approve_status = #{approve_status}
- </if>
- <if test="userData.street_id != null and userData.street_id != ''">
- AND
- a.street_id = #{userData.street_id}
- </if>
- <if test="applyUserType!=null and applyUserType!=''">
- and zUser.user_type = #{applyUserType}
- </if>
- order by a.create_time desc
- </select>
- <select id="getApplyResult" resultType="platform.modules.government.dto.GovStatisticsDto">
- SELECT
- SUM( IF(apply_status=1 OR apply_status=2, 1, 0)) AS underReview,
- SUM( IF(apply_status=4, 1, 0)) AS fail,
- SUM( IF(apply_status=3 OR apply_status=5 OR apply_status=6, 1, 0)) AS pass
- FROM
- c_stock_land_apply
- WHERE
- 1=1
- <if test="condition.begin_date != null and condition.begin_date !='' ">
- <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="condition.end_date != null and condition.end_date !='' ">
- <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="condition.stocklandType != null and condition.stocklandType !='' ">
- AND apply_type = #{condition.stocklandType}
- </if>
- </select>
- <select id="getApplyRate" resultType="platform.modules.government.dto.GovStatisticsDto">
- SELECT
- di.`name` AS `type`,
- COUNT( slp.apply_type ) AS overallNum
- FROM
- c_stock_land_apply slp
- LEFT JOIN dictionary_item di ON di.`value` = slp.apply_type
- LEFT JOIN dictionary_type dt ON dt.id = di.tid
- WHERE
- slp.apply_status <![CDATA[ <> ]]> 0
- AND dt.`name` = '存量用地'
- <if test="condition.begin_date != null and condition.begin_date !='' ">
- <![CDATA[ and DATE_FORMAT(slp.create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="condition.end_date != null and condition.end_date !='' ">
- <![CDATA[ and DATE_FORMAT(slp.create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
- </if>
- GROUP BY
- di.`name`
- </select>
- <select id="getStreetHandleCompare" resultType="platform.modules.government.dto.GovStatisticsDto">
- SELECT
- s.`name` AS streetName,
- SUM( IF(sla.apply_type=1, 1, 0)) AS equity,
- SUM( IF(sla.apply_type=2, 1, 0)) AS property,
- SUM( IF(sla.apply_type=3, 1, 0)) AS `use`,
- SUM( IF(sla.apply_type=4, 1, 0)) AS rent
- FROM
- c_stock_land_apply sla
- LEFT JOIN s_street s ON s.id = sla.street_id
- WHERE
- 1=1
- <if test="condition.begin_date != null and condition.begin_date !='' ">
- <![CDATA[ and DATE_FORMAT(sla.create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="condition.end_date != null and condition.end_date !='' ">
- <![CDATA[ and DATE_FORMAT(sla.create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
- </if>
- GROUP BY s.`name`
- </select>
- <select id="findListByCondition" resultType="platform.modules.company.entity.StockLand">
- SELECT
- sla.*
- FROM
- c_stock_land_apply sla
- WHERE
- sla.apply_status <![CDATA[ <> ]]> 0
- <if test="condition.begin_date != null and condition.begin_date !='' ">
- <![CDATA[ and DATE_FORMAT(sla.create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
- </if>
- <if test="condition.end_date != null and condition.end_date !='' ">
- <![CDATA[ and DATE_FORMAT(sla.create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
- </if>
- </select>
- <!-- 所有存量用地数据 -->
- <select id="findListByStreetId" resultType="platform.modules.company.dto.StockLandStatistic">
- SELECT
- stockland.id,
- stockland.street_id,
- stockland.apply_type,
- stockland.apply_status,
- stockland.approve_status,
- stockland.process_status,
- zuser.user_type AS apply_user_type,
- t.approval_round
- FROM
- c_stock_land_apply stockland
- LEFT JOIN z_user zuser ON zuser.id = stockland.create_by
- LEFT JOIN (
- SELECT
- APPLY_ID,
- max( APPROVAL_ROUND ) APPROVAL_ROUND,
- max( id ) AS id
- FROM
- z_approval
- WHERE
- type = "存量用地"
- AND del_flag = 0
- AND is_withdraw IS NULL
- GROUP BY
- APPLY_ID
- ) t ON t.APPLY_ID = stockland.id
- WHERE
- stockland.del_flag = '0'
- <if test="street_id != null and street_id != ''">
- AND stockland.street_id = #{street_id}
- </if>
- <if test="apply_user_type!=null and apply_user_type!=''">
- AND zuser.user_type = #{apply_user_type}
- </if>
- </select>
- <!-- 获取除待提交外的申请 -->
- <select id="findListByStreetIdAndTime" resultType="platform.modules.company.dto.StockLandStatistic">
- SELECT
- stockland.id,
- stockland.street_id,
- stockland.apply_type,
- stockland.apply_status,
- stockland.approve_status,
- stockland.process_status,
- stockland.summary_procedure,
- stockland.create_time
- FROM
- c_stock_land_apply stockland
- WHERE
- stockland.del_flag = '0'
- AND stockland.apply_status != 0
- <if test="street_id != null and street_id != ''">
- AND stockland.street_id = #{street_id}
- </if>
- <if test="start_time != null and start_time != ''">
- AND stockland.create_time <![CDATA[>=]]> #{start_time}
- </if>
- <if test="end_time != null and end_time != ''">
- AND stockland.create_time <![CDATA[<=]]> #{end_time}
- </if>
- </select>
- <update id="updateEasyProcessData" >
- UPDATE c_stock_land_apply
- SET approve_status = "80",
- apply_status = 3,
- update_by = 0,
- update_name = "sql",
- update_time = CONCAT_WS( " ", CURRENT_DATE, CURRENT_TIME )
- WHERE
- apply_no in
- <foreach collection="applyNoList" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- <insert id="insertAutoEasyProcessDataToStockLand" >
- INSERT INTO `z_approval`
- (`APPLY_ID`, `TYPE`, `DEPARTMENT`, `BEFORE_APPROVALSTATUS`, `AFTER_APPROVALSTATUS`, `CHECKER`, `NEXTCHECKER`, `APPROVAL_COMMENT`, `APPROVAL_ROUND`, `CREATE_TIME`, `CREATE_BY`, `UPDATE_TIME`, `UPDATE_BY`, `DEAL_TIME`, `STATUS`, `DEL_FLAG`, `ACTION_FLAG`, `TRANS_FLAG`, `REMARK`, `OPER_TYPE`, `PRO_INSTANCE_ID`, `CREATE_NAME`, `UPDATE_NAME`, `IS_WITHDRAW`, `CAN_WITHDRAW`)
- VALUES (#{applyid}, '存量用地', '企业服务处', '2', '14', 140, '', '做简易流程处理', 1, CONCAT_WS( " ", CURRENT_DATE, CURRENT_TIME ), 140, CONCAT_WS( " ", CURRENT_DATE, CURRENT_TIME ), NULL, NULL, 0, 0, NULL, NULL, '通过', '通过', null, '张磊', "sql", null, NULL)
- ,(#{applyid}, '存量用地', '企业服务处', '14', '80', 140, '', '审核通过', 1, CONCAT_WS( " ", CURRENT_DATE, CURRENT_TIME ), '140', CONCAT_WS( " ", CURRENT_DATE, CURRENT_TIME ), NULL, NULL, 0, 0, NULL, NULL, NULL, '通过', null, '张磊', "sql", NULL, NULL)
- </insert>
- </mapper>
|