|
|
|
<?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.epmet.dao.stats.DimGridDao">
|
|
|
|
|
|
|
|
<select id="getLastCreatedGridDimEntity" resultType="com.epmet.entity.stats.DimGridEntity">
|
|
|
|
SELECT *
|
|
|
|
FROM dim_grid
|
|
|
|
WHERE DEL_FLAG = 0
|
|
|
|
ORDER BY CREATED_TIME DESC
|
|
|
|
LIMIT 1
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getGridListByCustomerId" resultType="com.epmet.entity.stats.DimGridEntity">
|
|
|
|
SELECT
|
|
|
|
ID,
|
|
|
|
CUSTOMER_ID,
|
|
|
|
AGENCY_ID
|
|
|
|
FROM
|
|
|
|
dim_grid
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = 0
|
|
|
|
AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectAgencyGridInfo" resultType="com.epmet.dto.group.result.AgencyGridInfoResultDTO" parameterType="com.epmet.dto.group.AgencyDTO">
|
|
|
|
<foreach collection="formDTO" item="agency" separator=" UNION ALL ">
|
|
|
|
SELECT
|
|
|
|
id AS gridId,
|
|
|
|
agency_id AS agencyId
|
|
|
|
FROM
|
|
|
|
dim_grid
|
|
|
|
WHERE
|
|
|
|
del_flag = '0'
|
|
|
|
AND customer_id = #{agency.customerId}
|
|
|
|
AND agency_id = #{agency.id}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据当前机关ID查询下级机关ID -->
|
|
|
|
<select id="selectSubAgencyId" resultType="com.epmet.dto.group.result.SubAgencyIdResultDTO" parameterType="com.epmet.dto.group.AgencyDTO">
|
|
|
|
<foreach collection="formDTO" item="agency" separator=" UNION ALL ">
|
|
|
|
SELECT
|
|
|
|
#{agency.id} AS agencyId,
|
|
|
|
id AS subAgencyId
|
|
|
|
FROM
|
|
|
|
dim_agency
|
|
|
|
WHERE
|
|
|
|
del_flag = '0'
|
|
|
|
AND customer_id = #{agency.customerId}
|
|
|
|
AND pid = #{agency.id}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getLastUpdatedGridDim" resultType="com.epmet.entity.stats.DimGridEntity">
|
|
|
|
select id,
|
|
|
|
grid_name,
|
|
|
|
customer_id,
|
|
|
|
agency_id,
|
|
|
|
area_code,
|
|
|
|
del_flag,
|
|
|
|
revision,
|
|
|
|
created_by,
|
|
|
|
created_time,
|
|
|
|
updated_by,
|
|
|
|
updated_time
|
|
|
|
from dim_grid
|
|
|
|
order by UPDATED_TIME desc
|
|
|
|
limit 1;
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询网格属于哪个机关 -->
|
|
|
|
<select id="selectGridBelongAgencyInfo" resultType="com.epmet.dto.stats.result.GridBelongAgencyResultDTO">
|
|
|
|
SELECT
|
|
|
|
dg.id AS gridId,
|
|
|
|
dg.AGENCY_ID AS agencyId,
|
|
|
|
da.PID AS parentId
|
|
|
|
FROM
|
|
|
|
dim_grid dg
|
|
|
|
LEFT JOIN dim_agency da ON da.id = dg.agency_id
|
|
|
|
WHERE
|
|
|
|
dg.DEL_FLAG = '0'
|
|
|
|
AND da.DEL_FLAG = '0'
|
|
|
|
AND
|
|
|
|
(
|
|
|
|
<foreach collection="gridIds" item="gridId" separator=" OR ">
|
|
|
|
dg.id = #{gridId}
|
|
|
|
</foreach>
|
|
|
|
)
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|