| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945 |
- <?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.xunmei.system.mapper.SysOrgMapper">
- <resultMap type="com.xunmei.system.api.domain.SysOrg" id="SysOrgResult">
- <result property="id" column="id"/>
- <result property="address" column="address"/>
- <result property="code" column="code"/>
- <result property="guid" column="guid"/>
- <result property="isLock" column="is_lock"/>
- <result property="manager" column="manager"/>
- <result property="managerPhone" column="manager_phone"/>
- <result property="name" column="name"/>
- <result property="parentId" column="parent_id"/>
- <result property="phone" column="phone"/>
- <result property="cityCode" column="city_code"/>
- <result property="type" column="type"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="path" column="path"/>
- <result property="parentGuid" column="parent_guid"/>
- <result property="deleted" column="deleted"/>
- <result property="sort" column="sort"/>
- <result property="source" column="source"/>
- <result property="shortName" column="short_name"/>
- <result property="remark" column="remark"/>
- <result property="source" column="source"/>
- <result property="createBy" column="create_by"/>
- <result property="updateBy" column="update_by"/>
- <result property="treeShowParentId" column="tree_show_parent_id"/>
- <result property="treeShowPath" column="tree_show_path"/>
- </resultMap>
- <sql id="selectSysOrgVo">
- select id,
- address,
- code,
- guid,
- is_lock,
- manager,
- manager_phone,
- name,
- parent_id,
- phone,
- city_code,
- type,
- create_time,
- update_time,
- parent_guid,
- deleted,
- sort,
- create_by,
- update_by,
- org_extend_id,
- source,
- short_name,
- remark,
- path,
- tree_show_parent_id,
- tree_show_path
- from sys_org
- </sql>
- <select id="selectSysOrgList" parameterType="com.xunmei.system.api.domain.SysOrg"
- resultMap="SysOrgResult">
- <include refid="selectSysOrgVo"/>
- <where>
- <if test="address != null and address != ''">
- and address = #{address}
- </if>
- <if test="code != null and code != ''">
- and code = #{code}
- </if>
- <!-- <if test="deviceCount != null ">-->
- <!-- and device_count = #{deviceCount}-->
- <!-- </if>-->
- <if test="guid != null and guid != ''">
- and guid = #{guid}
- </if>
- <if test="isLock != null ">
- and is_lock = #{isLock}
- </if>
- <if test="manager != null and manager != ''">
- and manager = #{manager}
- </if>
- <if test="managerPhone != null and managerPhone != ''">
- and manager_phone = #{managerPhone}
- </if>
- <if test="name != null and name != ''">
- and name like concat('%', #{name}, '%')
- </if>
- <if test="parentId != null ">
- and parent_id = #{parentId}
- </if>
- <if test="phone != null and phone != ''">
- and phone = #{phone}
- </if>
- <if test="cityCode != null and cityCode != ''">
- and city_code = #{cityCode}
- </if>
- <!-- <if test="openYear != null ">-->
- <!-- and open_year = #{openYear}-->
- <!-- </if>-->
- <!-- <if test="fitYear != null ">-->
- <!-- and fit_year = #{fitYear}-->
- <!-- </if>-->
- <!-- <if test="floorage != null and floorage != ''">-->
- <!-- and floorage = #{floorage}-->
- <!-- </if>-->
- <!-- <if test="employee != null ">-->
- <!-- and employee = #{employee}-->
- <!-- </if>-->
- <!-- <if test="isOwnRight != null ">-->
- <!-- and is_own_right = #{isOwnRight}-->
- <!-- </if>-->
- <!-- <if test="isRent != null ">-->
- <!-- and is_rent = #{isRent}-->
- <!-- </if>-->
- <!-- <if test="isOnly != null ">-->
- <!-- and is_only = #{isOnly}-->
- <!-- </if>-->
- <!-- <if test="buildYear != null ">-->
- <!-- and build_year = #{buildYear}-->
- <!-- </if>-->
- <!-- <if test="placeType != null ">-->
- <!-- and place_type = #{placeType}-->
- <!-- </if>-->
- <!-- <if test="buildHeight != null ">-->
- <!-- and build_height = #{buildHeight}-->
- <!-- </if>-->
- <!-- <if test="social != null ">-->
- <!-- and social = #{social}-->
- <!-- </if>-->
- <!-- <if test="naturalEnvir != null ">-->
- <!-- and natural_envir = #{naturalEnvir}-->
- <!-- </if>-->
- <if test="type != null ">
- and type = #{type}
- </if>
- <if test="updateBy != null and updateBy != ''">
- and update_by like concat('%', #{updateBy}, '%')
- </if>
- <!-- <if test="modifiedId != null ">-->
- <!-- and modified_id = #{modifiedId}-->
- <!-- </if>-->
- <if test="path != null and path != ''">
- and path = #{path}
- </if>
- <!-- <if test="vid != null ">-->
- <!-- and vid = #{vid}-->
- <!-- </if>-->
- <!-- <if test="level != null ">-->
- <!-- and level = #{level}-->
- <!-- </if>-->
- <!-- <if test="oid != null and oid != ''">-->
- <!-- and oid = #{oid}-->
- <!-- </if>-->
- <if test="parentGuid != null and parentGuid != ''">
- and parent_guid = #{parentGuid}
- </if>
- <if test="deleted != null ">
- and deleted = #{deleted}
- </if>
- <if test="sort != null ">
- and sort = #{sort}
- </if>
- <!-- <if test="location != null ">-->
- <!-- and location = #{location}-->
- <!-- </if>-->
- </where>
- </select>
- <select id="selectSysOrgById" parameterType="Long"
- resultMap="SysOrgResult">
- <include refid="selectSysOrgVo"/>
- where id = #{id}
- </select>
- <select id="selectCheckSubOrgIdList" resultType="java.lang.Long">
- select id
- from sys_org
- where path like concat((select path from sys_org where id = #{orgId}), '%')
- and deleted = 0
- </select>
- <select id="findListByOrgType" resultType="java.lang.Long">
- select a.id
- from sys_org a
- where a.type = #{execOrgType}
- and a.deleted = 0
- and a.is_lock = 0
- </select>
- <insert id="insertSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg" useGeneratedKeys="true"
- keyProperty="id">
- insert into sys_org
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="address != null">
- address,
- </if>
- <if test="code != null">
- code,
- </if>
- <!-- <if test="deviceCount != null">device_count,-->
- <!-- </if>-->
- <if test="guid != null">
- guid,
- </if>
- <if test="isLock != null">
- is_lock,
- </if>
- <if test="manager != null">
- manager,
- </if>
- <if test="managerPhone != null">
- manager_phone,
- </if>
- <if test="name != null">
- name,
- </if>
- <if test="shortName != null">
- short_name,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="phone != null">
- phone,
- </if>
- <if test="cityCode != null">
- city_code,
- </if>
- <!-- <if test="openYear != null">open_year,-->
- <!-- </if>-->
- <!-- <if test="fitYear != null">fit_year,-->
- <!-- </if>-->
- <!-- <if test="floorage != null">floorage,-->
- <!-- </if>-->
- <!-- <if test="employee != null">employee,-->
- <!-- </if>-->
- <!-- <if test="isOwnRight != null">is_own_right,-->
- <!-- </if>-->
- <!-- <if test="isRent != null">is_rent,-->
- <!-- </if>-->
- <!-- <if test="isOnly != null">is_only,-->
- <!-- </if>-->
- <!-- <if test="buildYear != null">build_year,-->
- <!-- </if>-->
- <!-- <if test="placeType != null">place_type,-->
- <!-- </if>-->
- <!-- <if test="buildHeight != null">build_height,-->
- <!-- </if>-->
- <!-- <if test="social != null">social,-->
- <!-- </if>-->
- <!-- <if test="naturalEnvir != null">natural_envir,-->
- <!-- </if>-->
- <if test="type != null">
- type,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <!-- <if test="modifiedId != null">modified_id,-->
- <!-- </if>-->
- <if test="path != null">
- path,
- </if>
- <!-- <if test="vid != null">vid,-->
- <!-- </if>-->
- <!-- <if test="level != null">level,-->
- <!-- </if>-->
- <if test="oid != null">
- oid,
- </if>
- <if test="parentGuid != null">
- parent_guid,
- </if>
- <if test="deleted != null">
- deleted,
- </if>
- <if test="sort != null">
- sort,
- </if>
- <if test="source != null">
- source,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <!-- <if test="location != null">location,-->
- <!-- </if>-->
- <if test="createBy != null">
- create_by,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- <if test="treeParentCode != null">
- treeParentCode,
- </if>
- <if test="treeShowPath != null">
- treeShowPath,
- </if>
- <if test="treeShowParentId != null">
- treeShowParentId,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="address != null">
- #{address},
- </if>
- <if test="code != null">
- #{code},
- </if>
- <!-- <if test="deviceCount != null">#{deviceCount},-->
- <!-- </if>-->
- <if test="guid != null">
- #{guid},
- </if>
- <if test="isLock != null">
- #{isLock},
- </if>
- <if test="manager != null">
- #{manager},
- </if>
- <if test="managerPhone != null">
- #{managerPhone},
- </if>
- <if test="name != null">
- #{name},
- </if>
- <if test="shortName != null">
- #{shortName},
- </if>
- <if test="parentId != null">
- #{parentId},
- </if>
- <if test="phone != null">
- #{phone},
- </if>
- <if test="cityCode != null">
- #{cityCode},
- </if>
- <!-- <if test="openYear != null">#{openYear},-->
- <!-- </if>-->
- <!-- <if test="fitYear != null">#{fitYear},-->
- <!-- </if>-->
- <!-- <if test="floorage != null">#{floorage},-->
- <!-- </if>-->
- <!-- <if test="employee != null">#{employee},-->
- <!-- </if>-->
- <!-- <if test="isOwnRight != null">#{isOwnRight},-->
- <!-- </if>-->
- <!-- <if test="isRent != null">#{isRent},-->
- <!-- </if>-->
- <!-- <if test="isOnly != null">#{isOnly},-->
- <!-- </if>-->
- <!-- <if test="buildYear != null">#{buildYear},-->
- <!-- </if>-->
- <!-- <if test="placeType != null">#{placeType},-->
- <!-- </if>-->
- <!-- <if test="buildHeight != null">#{buildHeight},-->
- <!-- </if>-->
- <!-- <if test="social != null">#{social},-->
- <!-- </if>-->
- <!-- <if test="naturalEnvir != null">#{naturalEnvir},-->
- <!-- </if>-->
- <if test="type != null">
- #{type},
- </if>
- <if test="createTime != null">
- #{createTime},
- </if>
- <if test="updateBy != null">
- #{updateBy},
- </if>
- <if test="updateTime != null">
- #{updateTime},
- </if>
- <!-- <if test="modifiedId != null">#{modifiedId},-->
- <!-- </if>-->
- <if test="path != null">
- #{path},
- </if>
- <!-- <if test="vid != null">#{vid},-->
- <!-- </if>-->
- <!-- <if test="level != null">#{level},-->
- <!-- </if>-->
- <!-- <if test="oid != null">#{oid},-->
- <!-- </if>-->
- <if test="parentGuid != null">
- #{parentGuid},
- </if>
- <if test="deleted != null">
- #{deleted},
- </if>
- <if test="sort != null">
- #{sort},
- </if>
- <if test="source != null">
- #{source},
- </if>
- <if test="remark != null">
- #{remark},
- </if>
- <!-- <if test="location != null">#{location},-->
- <!-- </if>-->
- <if test="createBy != null">
- #{createBy},
- </if>
- <if test="updateBy != null">
- #{updateBy},
- </if>
- <if test="treeParentCode != null">
- #{treeParentCode},
- </if>
- <if test="treeShowPath != null">
- #{treeShowPath},
- </if>
- <if test="treeShowParentId != null">
- #{treeShowParentId},
- </if>
- </trim>
- </insert>
- <update id="updateSysOrg" parameterType="com.xunmei.system.api.domain.SysOrg">
- update sys_org
- <trim prefix="SET" suffixOverrides=",">
- <if test="address != null">
- address =
- #{address},
- </if>
- <if test="code != null">
- code =
- #{code},
- </if>
- <!-- <if test="deviceCount != null">device_count =-->
- <!-- #{deviceCount},-->
- <!-- </if>-->
- <if test="guid != null">
- guid =
- #{guid},
- </if>
- <if test="isLock != null">
- is_lock =
- #{isLock},
- </if>
- <if test="manager != null">
- manager =
- #{manager},
- </if>
- <if test="managerPhone != null">
- manager_phone =
- #{managerPhone},
- </if>
- <if test="name != null">
- name =
- #{name},
- </if>
- <if test="shortName != null">
- short_name =
- #{shortName},
- </if>
- <if test="parentId != null">
- parent_id =
- #{parentId},
- </if>
- <if test="phone != null">
- phone =
- #{phone},
- </if>
- <if test="cityCode != null">
- city_code =
- #{cityCode},
- </if>
- <!-- <if test="openYear != null">open_year =-->
- <!-- #{openYear},-->
- <!-- </if>-->
- <!-- <if test="fitYear != null">fit_year =-->
- <!-- #{fitYear},-->
- <!-- </if>-->
- <!-- <if test="floorage != null">floorage =-->
- <!-- #{floorage},-->
- <!-- </if>-->
- <!-- <if test="employee != null">employee =-->
- <!-- #{employee},-->
- <!-- </if>-->
- <!-- <if test="isOwnRight != null">is_own_right =-->
- <!-- #{isOwnRight},-->
- <!-- </if>-->
- <!-- <if test="isRent != null">is_rent =-->
- <!-- #{isRent},-->
- <!-- </if>-->
- <!-- <if test="isOnly != null">is_only =-->
- <!-- #{isOnly},-->
- <!-- </if>-->
- <!-- <if test="buildYear != null">build_year =-->
- <!-- #{buildYear},-->
- <!-- </if>-->
- <!-- <if test="placeType != null">place_type =-->
- <!-- #{placeType},-->
- <!-- </if>-->
- <!-- <if test="buildHeight != null">build_height =-->
- <!-- #{buildHeight},-->
- <!-- </if>-->
- <!-- <if test="social != null">social =-->
- <!-- #{social},-->
- <!-- </if>-->
- <!-- <if test="naturalEnvir != null">natural_envir =-->
- <!-- #{naturalEnvir},-->
- <!-- </if>-->
- <if test="type != null">
- type =
- #{type},
- </if>
- <if test="createTime != null">
- create_time =
- #{createTime},
- </if>
- <if test="updateBy != null">
- update_by =
- #{updateBy},
- </if>
- <if test="updateTime != null">
- update_time =
- #{updateTime},
- </if>
- <!-- <if test="modifiedId != null">modified_id =-->
- <!-- #{modifiedId},-->
- <!-- </if>-->
- <if test="path != null">
- path =
- #{path},
- </if>
- <!-- <if test="vid != null">vid =-->
- <!-- #{vid},-->
- <!-- </if>-->
- <!-- <if test="level != null">level =-->
- <!-- #{level},-->
- <!-- </if>-->
- <!-- <if test="oid != null">oid =-->
- <!-- #{oid},-->
- <!-- </if>-->
- <if test="parentGuid != null">
- parent_guid =
- #{parentGuid},
- </if>
- <if test="deleted != null">
- deleted =
- #{deleted},
- </if>
- <if test="sort != null">
- sort =
- #{sort},
- </if>
- <if test="source != null">
- source =
- #{source},
- </if>
- <if test="remark != null">
- remark =
- #{remark},
- </if>
- <!-- <if test="location != null">location =-->
- <!-- #{location},-->
- <!-- </if>-->
- <if test="createBy != null">
- create_by =
- #{createBy},
- </if>
- <if test="updateBy != null">
- update_by =
- #{updateBy},
- </if>
- <if test="treeParentCode != null">
- tree_parent_code= #{treeParentCode},
- </if>
- <if test="treeShowPath != null">
- tree_show_path=#{treeShowPath},
- </if>
- <if test="treeShowParentId != null">
- tree_show_parentId=#{treeShowParentId},
- </if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteSysOrgById" parameterType="Long">
- delete
- from sys_org
- where id = #{id}
- </delete>
- <delete id="deleteSysOrgByIds" parameterType="String">
- delete from sys_org where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectSysOrgByUserId" resultType="com.xunmei.system.api.domain.SysOrg">
- select so.*
- from sys_org so
- inner join sys_user suo on so.id = suo.org_id
- where suo.id = #{userId}
- </select>
- <select id="getParentName" resultType="com.xunmei.common.core.vo.IdNameVo">
- select so.id,so.short_name as name,p.short_name as extra
- from sys_org so
- left join sys_org p on so.parent_id=p.id and p.deleted=0
- where so.id in
- <foreach collection="ids" item="id" separator="," open="(" close=")">
- #{id}
- </foreach>
- and so.deleted=0
- </select>
- <select id="selectSysOrgVoByUserId" resultType="com.xunmei.system.api.vo.SysOrgVO">
- select so.id as id, so.name as name, so.path as path, so.parent_id as parentId
- from sys_org so
- inner join sys_user suo on so.id = suo.org_id
- where suo.id = #{userId}
- </select>
- <select id="selectSysOrgVOList" resultType="com.xunmei.system.api.vo.SysOrgVO">
- SELECT id,
- `name`,
- if(short_name is null,`name` ,short_name) as short_name,
- code,
- path,
- parent_id,
- type,
- tree_show_parent_id,
- tree_show_path,
- if(sort is null,0,sort) as sort
- FROM sys_org
- WHERE deleted = 0
- ORDER BY isnull(sort),sort, path
- </select>
- <select id="selectOrgList" resultType="com.xunmei.system.api.domain.SysOrg">
- select o.*,e.weather_area_code as weather_city_code from sys_org o
- left join sys_org_extend e on o.id = e.org_id
- WHERE deleted = 0
- <if test=" org.isLock != null">
- and o.is_lock =#{org.isLock}
- </if>
- <if test=" org.type != null and org.type !=''">
- and o.type =#{org.type}
- </if>
- <if test=" org.name != null and org.name !=''">
- and (o.name like concat(concat('%',#{org.name}),'%') or o.short_name like concat(concat('%',#{org.name}),'%'))
- </if>
- <if test=" org.code != null and org.code !=''">
- and o.code like concat(concat('%',#{org.code}),'%')
- </if>
- <!-- <if test=" org.parentId != null and org.parentId !=''">-->
- <!-- and o.parent_id =#{org.parentId}-->
- <!-- </if>-->
- <if test=" org.checkSub != null and org.checkSub == true">
- and o.path like concat(concat('%',#{org.path}),'%')
- </if>
- <if test=" org.checkSub != null and org.checkSub == false">
- and o.path like concat('%',#{org.path})
- </if>
- and o.name != '机关'
- ORDER BY isnull(o.sort),o.sort, o.path
- </select>
- <select id="getOrgIdByTaskId" resultType="java.lang.Long">
- SELECT org_id
- FROM core_monitoring_retrieval_task cmrt
- WHERE id = #{taskId}
- </select>
- <select id="selectOrgTypeByIdList" resultType="java.lang.Long">
- select distinct type
- from sys_org
- where id in
- <foreach collection="orgIdList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="findByOrgTypeAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
- select c.* from sys_org c where c.type = #{orgType} and c.path like concat('%',#{path}, '%') and deleted=0
- </select>
- <select id="selectByShortName" resultType="com.xunmei.system.api.domain.SysOrg">
- SELECT * FROM sys_org WHERE short_name=#{name} AND deleted=0
- </select>
- <select id="findByOrgTypesAndParent" resultType="com.xunmei.system.api.domain.SysOrg">
- select c.* from sys_org c where c.path like concat('%',#{path}, '%') and deleted=0
- and
- c.type in
- <foreach collection="types" item="type" separator="," open="(" close=")">
- #{type}
- </foreach>
- </select>
- <select id="selectNetworkNumberByPath" resultType="java.lang.Integer">
- SELECT COUNT(1) FROM sys_org WHERE path LIKE concat( #{orgPath}, '%') AND type=4 AND deleted=0
- </select>
- <select id="complianceStatus" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionExport">
- SELECT
- IFNULL( SUM( IF ( a.standard IN ( 1, 2 ), 1, 0 )), 0 ) AS reachNumber,
- IFNULL( SUM( IF ( a.standard = 2, 1, 0 )), 0 ) AS oldReachNumber,
- IFNULL( SUM( IF ( a.standard = 1, 1, 0 )), 0 ) AS newReachNumber,
- IFNULL(
- CONCAT(
- ROUND( SUM( IF ( a.standard IN ( 1, 2 ), 1, 0 ))/ COUNT( b.id )* 100, 2 ),
- '%'
- ),
- '0%'
- ) AS reachRate
- FROM
- sys_org_physical_defense_construction a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="rectificationStatus" resultType="java.lang.Integer">
- SELECT
- IFNULL(SUM(IF(a.standard=1,1,0)),0)
- FROM
- sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
- WHERE
- a.date_of_compliance LIKE concat(#{year}, '%') AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="oldRectificationStatus" resultType="java.lang.Integer">
- SELECT
- COUNT( DISTINCT a.org_id )
- FROM
- sys_org_physical_defense_construction a
- INNER JOIN sys_org b ON a.org_id = b.id
- WHERE
- a.org_id IN (
- SELECT
- org_id
- FROM
- sys_org_physical_defense_construction
- GROUP BY
- org_id
- HAVING
- (
- IF
- ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
- IF
- ( LOCATE( 2, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
- AND date_of_compliance LIKE concat(#{year}, '%')
- )AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="noRectificationStatus" resultType="java.lang.Integer">
- SELECT
- COUNT( DISTINCT org_id )
- FROM
- sys_org_physical_defense_construction a LEFT JOIN sys_org b ON a.org_id=b.id
- WHERE
- org_id IN (
- SELECT
- GROUP_CONCAT( DISTINCT org_id )
- FROM
- sys_org_physical_defense_construction
- GROUP BY
- org_id
- HAVING
- (
- IF
- ( LOCATE( 1, GROUP_CONCAT( standard ))> 0, 1, 0 )+
- IF
- ( LOCATE( 3, GROUP_CONCAT( standard ))> 0, 1, 0 ))= 2
- AND date_of_compliance LIKE concat(#{year}, '%')
- ) AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="selectConstructionDetail" resultType="com.xunmei.system.util.ConstructionDetailExport">
- SELECT
- a.org_id AS orgId,
- IFNULL( b.ownership, 0 ) AS ownership,
- IF
- (
- IF
- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
- IF
- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
- 1,
- 0
- ) AS complianceStatus,
- a.date_of_compliance AS complianceDate,
- IF
- (
- IF
- ( LOCATE( 1, GROUP_CONCAT( a.standard ))> 0, 1, 0 )+
- IF
- ( LOCATE( 2, GROUP_CONCAT( a.standard ))> 0, 1, 0 )>= 1,
- NULL,
- a.reason
- ) AS reason,
- a.date_of_complete AS completeDate
- FROM
- sys_org_physical_defense_construction a
- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id LEFT JOIN sys_org c ON c.id=b.org_id
- WHERE c.type=4 and c.path like concat(#{orgPath}, '%')
- GROUP BY
- a.org_id
- </select>
- <select id="getReachNumber" resultType="java.lang.Integer">
- SELECT
- IFNULL( SUM( IF ( a.standard IN ( 1, 2 ), 1, 0 )), 0 )
- FROM
- sys_org_physical_defense_construction a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE b.type=4 and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getOwnership" resultType="java.lang.Integer">
- SELECT
- IFNULL( SUM( IF ( a.ownership = 2, 1, 0 )), 0 )
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE b.type=4 and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getOutside" resultType="java.lang.Integer">
- SELECT
- IFNULL( SUM( IF ( a.outside_area = 1, 1, 0 )), 0 )
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getLibrary" resultType="java.util.Map">
- SELECT
- COUNT(a.business_library_type ) as total,
- sum(IF(a.business_library_type=1,1,0)) AS one,
- SUM(IF(a.business_library_type=2,1,0)) as two,
- SUM(IF(a.business_library_type=3,1,0)) AS three,
- SUM(IF(a.business_library_type=4,1,0)) AS four
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getCollectLibrary" resultType="java.lang.Integer">
- SELECT
- SUM(
- IF
- ( a.safe_box = 1, 1, 0 ))
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getOnLine" resultType="java.util.Map">
- SELECT
- SUM(
- IF
- ( a.type = 3, 1, 0 )) AS onLineTotal,
- SUM(
- IF
- ( a.type = 3 AND a.standard =1, 1, 0 )) AS onLineReachNumber
- FROM
- sys_org_physical_defense_construction a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getDeparture" resultType="java.util.Map">
- SELECT
- SUM(
- IF
- ( a.type = 4, 1, 0 )) AS departureTotal,
- SUM(
- IF
- ( a.type = 4 AND a.standard = 1, 1, 0 )) AS departureReachNumber
- FROM
- sys_org_physical_defense_construction a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getSelfEquipment" resultType="java.util.Map">
- SELECT
- SUM( a.lobby_equipment ) AS onLineLobbyImplement,
- SUM( a.wall_penetrating_equipment ) AS onLineThroughWalls,
- SUM( a.detached_lobby_equipment ) AS departureLobbyImplement,
- SUM( a.detached_wall_penetrating_equipment ) AS departureThroughWalls,
- SUM( a.lobby_equipment ) + SUM( a.wall_penetrating_equipment ) + SUM( a.detached_lobby_equipment ) + SUM( a.detached_wall_penetrating_equipment ) AS selfServiceDevicesTotal
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getCenterConstruction" resultType="java.util.Map">
- SELECT
- IF
- ( a.construction_time IS NULL, '', SUBSTR( a.construction_time, 1, 4 ) ) AS centerConstructionTime,
- IF
- ( a.last_update_time IS NULL, '', SUBSTR( a.last_update_time, 1, 4 ) ) AS transformTime,
- a.platform_brand AS brand
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE b.id=#{orgId}
- </select>
- <select id="getCamera" resultType="java.util.Map">
- SELECT
- COUNT( 1 ) AS cameraTotal,
- SUM(
- IF
- ( definition = 1, 1, 0 )) AS definitionNumber
- FROM
- sys_device
- WHERE
- del_flag=0 AND
- device_type =2 AND org_path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getRemote" resultType="java.util.Map">
- SELECT
- SUM( a.cash_adding_room ) AS cashAddingRoom,
- SUM( a.remote_count ) AS remoteCount
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where org_path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getDuty" resultType="java.util.Map">
- SELECT
- SUM(
- IF
- ( duty_mode = 2, 1, 0 )) AS localDutyNetworkNumber,
- SUM(
- IF
- ( duty_mode = 1, 1, 0 )) AS remoteDutyNetworkNumber
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where org_path LIKE concat(#{orgPath}, '%')
- </select>
- </mapper>
|