| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526 |
- <?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>
- <if test="affiliatedArea != null">
- affiliated_area,
- </if>
- <if test="affiliatedBank != null">
- affiliated_bank,
- </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>
- <if test="affiliatedArea != null">
- #{affiliatedArea},
- </if>
- <if test="affiliatedBank != null">
- #{affiliatedBank},
- </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>
- <if test="affiliatedArea != null">
- affiliated_area=#{affiliatedArea},
- </if>
- <if test="affiliatedBank != null">
- affiliated_bank=#{affiliatedBank},
- </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,
- guid,
- path,
- parent_id,
- type,
- tree_show_parent_id,
- tree_show_path,
- affiliated_bank,
- affiliated_area,
- 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 != '机关' and o.name != '各部门'
- ORDER BY o.affiliated_area desc,o.affiliated_bank desc, o.is_lock, 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="selectByOrgName" resultType="com.xunmei.system.api.domain.SysOrg">
- SELECT * FROM sys_org WHERE `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 AND is_lock=0
- </select>
- <select id="complianceStatus" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionExport">
- select
- sum(if((t.ga382021 + t.ga382015) > 0,1,0 )) as reachNumber,
- sum(if(t.ga382021 > 0,1,0)) as newReachNumber,
- sum(if((t.ga382015 -t.ga382021 > 0),1,0)) as oldReachNumber,
- IFNULL(
- CONCAT(
- ROUND( sum(if((t.ga382021 + t.ga382015) > 0,1,0 ))/ COUNT(*)* 100, 2 ),
- '%'
- ),
- '0%'
- ) AS reachRate
- from (
- select
- b.id as org_id,
- if(a.banking2021 > 0 , 1, 0) as 'ga382021',
- if(a.banking2015 > 0 and a.banking2021 = 0 , 1, 0 ) as 'ga382015'
- from sys_org b
- LEFT JOIN (SELECT org_id,
- type,
- sum(type = 1 and standard = 1) banking2021,
- sum(type = 1 and standard = 2) banking2015
- FROM sys_org_physical_defense_construction
- WHERE type = 1
- GROUP BY org_id) a on a.org_id = b.id
- where 1=1
- AND b.deleted = 0
- AND b.is_lock = 0
- AND b.type = 4
- AND a.type = 1
- AND b.path LIKE concat(#{orgPath}, '%')
- GROUP BY b.id ) t
- </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 a.type = 1
- 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
- where
- type = 1
- 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
- where type = 1
- 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,-->
- <!-- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) 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,-->
- <!-- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS completeDate,-->
- <!-- c.address as address,-->
- <!-- c.affiliated_area as city,-->
- <!-- c.affiliated_bank as orgName,-->
- <!-- c.short_name as networkName-->
- <!-- FROM-->
- <!-- sys_org c-->
- <!-- LEFT JOIN sys_org_physical_defense_construction a ON c.id=a.org_id-->
- <!-- LEFT JOIN sys_org_extend b ON a.org_id = b.org_id-->
- <!-- WHERE c.type=4-->
- <!-- and c.deleted = 0-->
- <!-- and c.is_lock = 0-->
- <!-- and a.type =1-->
- <!-- and c.path like concat(#{orgPath}, '%')-->
- <!-- GROUP BY-->
- <!-- a.org_id-->
- SELECT
- c.id AS orgId,
- IFNULL( b.ownership, 0 ) AS ownership,
- case when a.banking2021=1 then 2021 when a.banking2015=1 then 2015 when a.unGA38=1 then 1 else 0 end as complianceStatus,
- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS complianceDate,
- IF
- (
- a.unGA38=1,
- a.reason,
- ''
- ) AS reason,
- IF( a.unGA38=1, IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ),'') AS completeDate,
- c.address as address,
- c.address as address,
- c.affiliated_area as city,
- c.affiliated_bank as orgName,
- c.short_name as networkName
- FROM
- sys_org c
- LEFT JOIN (select org_id,date_of_compliance,reason,date_of_complete,
- banking2021,
- if(banking2015 > 0 and banking2021 = 0, 1, 0) as banking2015,
- if(unGA38 >0 and banking2015 = 0 and banking2021 = 0, 1, 0) as unGA38
- from (SELECT org_id,Max(date_of_compliance) as date_of_compliance,reason,date_of_complete,
- sum(standard = 1) banking2021,
- sum(standard = 2) banking2015,
- sum(standard = 3) unGA38
- FROM sys_org_physical_defense_construction
- WHERE type = 1
- GROUP BY org_id) t1) a ON c.id = a.org_id
- LEFT JOIN sys_org_extend b ON c.id = b.org_id
- WHERE c.type=4
- and c.deleted = 0
- and c.is_lock = 0
- and c.path like concat(#{orgPath}, '%')
- ORDER BY
- FIND_IN_SET( c.affiliated_bank, #{findInSetOrder} ),
- c.is_lock,
- isnull( c.sort ),
- c.sort,
- c.short_name
- </select>
- <select id="getReachNumber" resultType="java.lang.Integer">
- select SUM(a.size) from (select org_id,if(count(*) > 0,1,0) as size from sys_org_physical_defense_construction where standard in (1,2) and type = 1 GROUP BY org_id) a
- LEFT JOIN sys_org b on a.org_id = b.id
- where 1=1
- AND b.deleted = 0
- and b.is_lock = 0
- and 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.deleted = 0 and b.is_lock = 0 and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getOutside" resultType="java.lang.Integer">
- SELECT
- IFNULL( SUM( IF ( a.outside_area = 0, 1, 0 )), 0 )
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where
- 1=1
- and b.path LIKE concat(#{orgPath}, '%')
- and b.is_lock = 0
- and b.deleted = 0
- </select>
- <select id="getLibrary" resultType="java.util.Map">
- SELECT
- sum( a.yywd + a.zxywk ) AS total,
- a.one,
- a.two,
- a.three,
- a.four
- FROM
- (
- SELECT
- IFNULL( sum( IF ( b.type = 6, 1, 0 )), 0 ) AS yywd,
- IFNULL( sum( IF ( b.type = 4 AND a.business_library = 1, 1, 0 )), 0 ) AS zxywk,
- IFNULL( sum( IF ( a.business_library_type = 1, 1, 0 )), 0 ) AS one,
- IFNULL( SUM( IF ( a.business_library_type = 2, 1, 0 )), 0 ) AS two,
- IFNULL( SUM( IF ( a.business_library_type = 3, 1, 0 )), 0 ) AS three,
- IFNULL( SUM( IF ( a.business_library_type = 4, 1, 0 )), 0 ) AS four
- FROM
- sys_org b
- LEFT JOIN sys_org_extend a ON a.org_id = b.id
- WHERE
- b.is_lock = 0
- and b.path LIKE concat(#{orgPath}, '%')
- and b.deleted = 0
- AND (b.type = 4 OR b.type = 5 OR b.type = 6)
- ) a
- </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
- 1=1
- and b.path LIKE concat(#{orgPath}, '%')
- and b.is_lock = 0
- and b.deleted = 0
- </select>
- <select id="getOnLine" resultType="java.util.Map">
- SELECT
- (
- SELECT
- IFNULL( SUM( IF ( b.self_service_bank = 1, 1, 0 )), 0 ) AS onLineTotal
- FROM
- sys_org a
- LEFT JOIN sys_org_extend b ON a.id = b.org_id
- WHERE
- 1=1
- AND a.deleted = 0
- and a.is_lock = 0
- and a.path LIKE concat( #{orgPath}, '%' )) AS onLineTotal,
- (
- select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from sys_org_physical_defense_construction where standard =1 and type = 2 GROUP BY org_id) a
- LEFT JOIN sys_org b on a.org_id = b.id
- where 1=1
- AND b.deleted = 0
- and b.is_lock = 0
- AND b.path LIKE concat(#{orgPath}, '%' )) AS onLineReachNumber
- FROM
- DUAL
- </select>
- <select id="getDeparture" resultType="java.util.Map">
- SELECT
- (
- SELECT
- count( 1 )
- FROM
- sys_org
- WHERE
- type = 5
- AND deleted = 0
- AND is_lock = 0
- AND path LIKE concat( #{orgPath}, '%' )) AS departureTotal,
- (
- select SUM(a.size) from (select org_id,if(count(1) > 0,1,0) as size from
- sys_org_physical_defense_construction where standard =1 and type = 3 GROUP BY org_id) a
- LEFT JOIN sys_org b on a.org_id = b.id
- where 1=1
- AND b.deleted = 0
- and b.is_lock = 0
- AND b.path LIKE concat(#{orgPath}, '%' )) AS departureReachNumber
- FROM
- DUAL
- </select>
- <select id="getSelfEquipment" resultType="java.util.Map">
- select
- t.onLineThroughWalls,
- t.onLineLobbyImplement,
- t.departureThroughWalls,
- t.departureLobbyImplement,
- ( t.onLineThroughWalls + t.onLineLobbyImplement + t.departureThroughWalls + t.departureLobbyImplement ) AS selfServiceDevicesTotal
- from (
- select
- (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineLobbyImplement,
- (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 4 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as onLineThroughWalls,
- (select IFNULL( SUM( a.lobby_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureLobbyImplement,
- (select IFNULL( SUM( a.wall_penetrating_equipment ), 0 ) from sys_org_extend a LEFT JOIN sys_org b on a.org_id = b.id WHERE 1=1 and b.type = 5 and b.is_lock = 0 and b.deleted = 0 and b.path LIKE concat(#{orgPath}, '%')) as departureThroughWalls
- from dual
- ) t
- </select>
- <select id="getCenterConstruction" resultType="java.util.Map">
- SELECT
- IFNULL(SUBSTR( b.construction_time, 1, 4 ), '' ) as centerConstructionTime,
- IFNULL(SUBSTR( b.last_update_time, 1, 4 ), '' )AS transformTime,
- b.platform_brand AS brand,
- IFNULL( b.hd_camera_count, 0 ) AS hdCameraCount,
- IFNULL( b.total_camera_count, 0 ) AS totalCameraCount
- FROM
- ( SELECT id FROM sys_org WHERE type = 10 and is_lock = 0 and deleted = 0 AND path LIKE concat( #{orgPath}, '%' ) ORDER BY create_time DESC LIMIT 0, 1 ) a
- LEFT JOIN sys_org_extend b ON a.id = b.org_id
- </select>
- <select id="getCamera" resultType="java.util.Map">
- SELECT
- IFNULL( COUNT( a.id ), 0 ) AS cameraTotal,
- IFNULL( SUM( IF ( a.definition = 1, 1, 0 )), 0 ) AS definitionNumber
- FROM
- sys_device a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- a.del_flag = 0
- AND a.device_type = 2
- AND b.deleted = 0
- and b.is_lock = 0
- AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getRemote" resultType="java.util.Map">
- SELECT
- IFNULL( SUM( a.cash_adding_room ), 0 ) AS cashAddingRoom,
- IFNULL( SUM( a.remote_count ), 0 ) AS remoteCount,
- IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
- IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
- FROM
- ( SELECT * FROM sys_org WHERE type = 10 and is_lock = 0 and deleted = 0 AND path LIKE concat( #{orgPath}, '%' ) ORDER BY create_time DESC LIMIT 0, 1 ) b
- LEFT JOIN sys_org_extend a ON a.org_id = b.id
- where
- 1=1
- and b.type = 10
- and b.deleted = 0
- and b.is_lock = 0
- </select>
- <select id="getDuty" resultType="java.util.Map">
- SELECT
- IFNULL( SUM( IF ( duty_mode = 2, 1, 0 )), 0 ) AS localDutyNetworkNumber,
- IFNULL( SUM( IF ( duty_mode = 1, 1, 0 )), 0 ) AS remoteDutyNetworkNumber
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- 1=1
- and b.deleted = 0
- and b.is_lock = 0
- and b.type = 4
- and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getCertificate" resultType="java.util.Map">
- SELECT
- IFNULL( SUM( a.inner_count ), 0 ) AS internalCertificateNumber,
- IFNULL( SUM( a.outside_count ), 0 ) AS outsourceCertificateNumber,
- IFNULL( SUM( a.inner_count )+ SUM( a.outside_count ), 0 ) AS certificateTotal,
- (
- SELECT
- count(*)
- FROM
- sys_user a
- LEFT JOIN sys_user_information b ON a.id = b.user_id
- LEFT JOIN sys_org c ON a.org_id = c.id
- WHERE
- 1 = 1
- AND b.dept_id = 2
- AND b.certificate_work = '1'
- AND a.is_manage = 'Y'
- AND c.deleted = 0
- and c.is_lock = 0
- AND c.path LIKE concat(#{orgPath}, '%')) AS certificatePeopleNumber
- FROM
- sys_org_extend a
- LEFT JOIN sys_org b ON a.org_id = b.id
- WHERE
- 1=1
- AND b.deleted = 0
- and b.is_lock = 0
- and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getSafe" resultType="java.lang.Integer">
- SELECT
- COUNT( a.id )
- FROM
- core_safety_task a
- LEFT JOIN sys_org b ON a.org_id = b.id
- LEFT JOIN core_safecheck_plan c ON a.plan_id = c.id
- WHERE
- a.deleted = 0
- AND b.deleted = 0
- and b.is_lock = 0
- AND c.check_type =3
- AND a.`status` =3
- and a.org_path LIKE concat(#{orgPath}, '%')
- AND a.start_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="getEduNumber" resultType="java.lang.Integer">
- SELECT
- COUNT( a.id )
- FROM
- core_edu_training_task a
- LEFT JOIN sys_org c ON a.org_id = c.id
- WHERE
- c.type =3
- AND a.`status`=2
- and a.org_path like concat(concat('%',#{orgPath}),'%')
- AND a.training_start_date_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="getEduUser" resultType="java.lang.Integer">
- SELECT
- COUNT( b.edu_training_task_id )
- FROM
- core_edu_training_task a
- LEFT JOIN core_edu_training_task_to_user b ON a.id = b.edu_training_task_id
- WHERE
- b.type = 1 and a.org_path like concat(concat('%',#{orgPath}),'%')
- </select>
- <select id="getQuarterDrillNumber" resultType="java.lang.Integer">
- SELECT
- COUNT(a.id)
- FROM
- core_drill_task a
- -- LEFT JOIN core_drill_plan b ON a.plan_id = b.id
- LEFT JOIN sys_org c ON a.org_id = c.id
- WHERE c.type=3
- AND a.`status`=2
- and a.org_path like concat(concat('%',#{orgPath}),'%')
- AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="getQuarterDrillPeopleNumber" resultType="java.lang.Integer">
- SELECT
- COUNT( c.drill_task_id )
- FROM
- core_drill_task a
- LEFT JOIN core_drill_plan b ON a.plan_id = b.id
- LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
- WHERE
- b.exec_org_type = 3
- and a.org_path like concat(concat('%',#{orgPath}),'%')
- </select>
- <select id="getQuarterAllNetworkDrillNumber" resultType="java.lang.Integer">
- SELECT
- COUNT(a.id)
- FROM
- core_drill_task a
- LEFT JOIN core_drill_plan b ON a.plan_id = b.id
- WHERE b.exec_org_type=4
- and a.`status`=2
- and a.org_path like concat(concat('%',#{orgPath}),'%')
- AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="getQuarterAllNetworkDrillPeopleNumber" resultType="java.lang.Integer">
- SELECT
- COUNT( c.drill_task_id )
- FROM
- core_drill_task a
- LEFT JOIN core_drill_plan b ON a.plan_id = b.id
- LEFT JOIN core_drill_task_to_user c ON c.drill_task_id = a.id
- WHERE
- b.exec_org_type = 4
- and a.org_path like concat(concat('%',#{orgPath}),'%')
- AND a.drill_start_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="getAlone" resultType="java.lang.Integer">
- select count(*) from sys_org_extend a
- LEFT JOIN sys_org b on a.org_id = b.id where a.alone_dept = 'Y' and b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getManager" resultType="java.lang.Integer">
- SELECT
- COUNT( * )
- FROM
- sys_user_information a
- LEFT JOIN sys_user b ON a.user_id = b.id
- LEFT JOIN sys_org c ON b.org_id = c.id
- WHERE
- 1 = 1
- AND c.deleted = 0
- and c.is_lock = 0
- AND a.is_full_time = #{isFull}
- AND a.duties in ('1','2','3')
- AND b.is_manage = 'Y'
- AND c.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getManagerCertificate" resultType="java.lang.Integer">
- SELECT
- COUNT( * )
- FROM
- sys_user_information a
- LEFT JOIN sys_user b ON a.user_id = b.id
- LEFT JOIN sys_org c ON b.org_id = c.id
- WHERE
- 1 = 1
- AND c.deleted = 0
- and c.is_lock = 0
- AND a.certificate_work = 1
- AND a.duties in ('1','2','3')
- AND b.is_manage = 'Y'
- AND c.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getIsMonitor" resultType="java.lang.String">
- SELECT
- IF
- ( COUNT( a.id ) > 0, '是', '否' )
- FROM
- sys_user_information a
- LEFT JOIN sys_user b ON a.user_id = b.id
- LEFT JOIN sys_org c ON b.org_id = c.id
- WHERE
- a.duties = #{duties}
- and c.deleted = 0
- and c.is_lock = 0
- AND b.is_manage = 'Y'
- AND c.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getMonitorPeople" resultType="java.util.Map">
- SELECT
- COUNT( a.id ) AS monitorTotal,
- IFNULL( SUM( IF ( a.work_type IN ( 0, 1 ), 1, 0 )), 0 ) AS innerPeople,
- IFNULL( SUM( IF ( a.work_type = 2, 1, 0 )), 0 ) AS outPeople
- FROM
- sys_user_information a
- LEFT JOIN sys_user b ON a.user_id = b.id
- LEFT JOIN sys_org c ON b.org_id = c.id
- WHERE
- a.duties IN ( 2, 4, 5 )
- AND c.deleted = 0
- and c.is_lock = 0
- AND b.is_manage = 'Y'
- AND c.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getSafeHeadToNetwork" resultType="java.lang.Integer">
- SELECT
- COUNT( a.id )
- FROM
- core_safety_book_new a
- LEFT JOIN sys_org b ON a.party_b_org = b.id
- WHERE
- a.type = #{type}
- AND a.sign_level = #{level}
- AND b.deleted = 0
- and b.is_lock = 0
- AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getJointHeadToNetwork" resultType="java.lang.Integer">
- SELECT
- COUNT( a.id )
- FROM
- core_safety_book_new a
- LEFT JOIN sys_org b ON a.party_a_org = b.id
- WHERE
- a.type = #{type}
- AND a.sign_level = #{level}
- AND b.path LIKE concat(#{orgPath}, '%')
- </select>
- <select id="getHaveSecurityNetworkNumber" resultType="java.lang.Integer">
- select count(*) from sys_org a
- LEFT JOIN sys_org_extend b on a.id = b.org_id
- WHERE 1=1
- and a.deleted = 0
- and a.is_lock = 0
- and a.type = 4
- and b.askari = 1
- and a.path LIKE concat( #{orgPath}, '%' )
- </select>
- <select id="getHeadSafeCheckNumber" resultType="java.lang.Integer">
- SELECT
- count(a.id)
- FROM
- core_safety_task a
- LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
- WHERE
- b.check_type = 4
- AND b.plan_create_org_id != b.plan_of_org_id
- AND a.`status` =3
- AND a.ymd_year =#{year}
- AND a.check_org_id =#{orgId}
- </select>
- <select id="getHeadSafeCheckNetworkNumber" resultType="java.lang.Integer">
- SELECT
- COUNT( DISTINCT a.org_id )
- FROM
- core_safety_task a
- LEFT JOIN core_safecheck_plan b ON a.plan_id = b.id
- -- LEFT JOIN sys_org c ON c.id = a.org_id
- WHERE
- b.check_type = 4
- AND b.plan_create_org_id != b.plan_of_org_id
- AND a.`status` =3
- -- AND c.deleted = 0
- -- and c.is_lock = 0
- -- AND c.type = 4
- AND a.ymd_year =#{year}
- AND a.check_org_id =#{orgId}
- </select>
- <select id="getDangerNumber" resultType="java.util.Map">
- SELECT
- IFNULL( SUM( IF ( confirm_status >= 2 AND reform_status IN ( 10, 11,12,13 ), 1, 0 )), 0 ) AS foundDangerNumber,
- IFNULL( SUM( IF ( reform_status = 11, 1, 0 )), 0 ) AS rectificationDangerNumber,
- IFNULL(
- SUM(
- IF
- ( confirm_status >= 2 AND reform_status IN ( 10,11,12,13 ), 1, 0 ))- SUM(
- IF
- ( reform_status = 11, 1, 0 )),
- 0
- ) AS noRectificationDangerNumber
- FROM
- core_question a
- LEFT JOIN core_safety_task b ON a.src_task_id = b.id
- LEFT JOIN core_safecheck_plan c ON c.id = b.plan_id
- WHERE
- src_type = 2
- AND c.check_type = 4
- AND c.plan_create_org_id != c.plan_of_org_id
- AND b.ymd_year =#{year}
- AND b.check_org_id =#{orgId}
- </select>
- <select id="selectSysOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
- SELECT
- *
- FROM
- sys_org
- WHERE
- is_lock=0 AND
- type = #{type}
- AND deleted = 0
- <if test="path != null">
- AND path LIKE concat(#{path}, '%')
- </if>
- ORDER BY
- sort
- </select>
- <select id="selectOrgByPathAndType" resultType="com.xunmei.system.api.domain.SysOrg">
- SELECT
- *
- FROM
- sys_org
- WHERE
- type = #{type}
- AND deleted = 0
- <if test="path != null">
- AND path LIKE concat(#{path}, '%')
- </if>
- ORDER BY
- sort
- </select>
- <select id="selectOrgs" resultType="com.xunmei.system.dto.SysSelectOrgComponentDto">
- SELECT
- id,
- type,
- yewd_level,
- short_name,
- path,
- affiliated_area,
- affiliated_bank
- FROM
- sys_org
- WHERE 1=1
- AND is_lock=0
- AND deleted = 0
- <if test="org.orgPath != null">
- AND path LIKE concat(#{org.orgPath}, '%')
- </if>
- <if test="org.orgType != null">
- AND type = #{org.orgType}
- </if>
- <if test="org.orgName != null">
- AND short_name LIKE concat('%',#{org.orgName}, '%')
- </if>
- ORDER BY
- affiliated_area,affiliated_bank,sort
- </select>
- <select id="exportOrgExtend" resultType="com.xunmei.system.util.OrgExtendExport">
- SELECT
- b.id AS orgId,
- b.affiliated_area AS city,
- b.affiliated_bank AS affiliatedBank,
- b.short_name AS shortName,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
- ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
- b.address AS address,
- IFNULL(SUBSTR( a.construction_time, 1, 4 ), '' ) AS constructionTime,
- IFNULL(SUBSTR( a.last_update_time, 1, 4 ), '' ) AS lastUpdateTime,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_platform_brand' AND dict_value = a.platform_brand ) AS platformBrand,
- IFNULL(a.cash_adding_room,0) AS cashAddingRoom,
- IFNULL(a.cash_adding_room_control_count,0) AS cashAddingRoomControlCount,
- IFNULL(a.remote_count,0) AS remoteCount,
- IFNULL(a.remote_control_count,0) AS remoteControlCount,
- IFNULL(a.total_camera_count,0) AS totalCameraCount,
- IFNULL(a.hd_camera_count,0) AS hdCameraCount,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'property_situation' AND dict_value = a.ownership ) AS ownerShipName,
- ( CASE a.outside_area WHEN 1 THEN '区域内' WHEN 0 THEN '区域外' ELSE '' END ) AS outsideArea,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'duty_options' AND dict_value = a.duty_mode ) AS dutyMode,
- ( CASE a.safe_box WHEN 1 THEN '是' ELSE '否' END ) AS safeBox,
- ( CASE a.self_service_bank WHEN 1 THEN '是' ELSE '否' END ) AS selfServiceBank,
- IF(b.type = 4,IFNULL(a.wall_penetrating_equipment,0),0) AS onLineWallPenetratingEquipment,
- IF(b.type = 4,IFNULL(a.lobby_equipment,0),0) AS onLineLobbyEquipment,
- IF(b.type = 5,IFNULL(a.wall_penetrating_equipment,0),0) AS departureWallPenetratingEquipment,
- IF(b.type = 5,IFNULL(a.lobby_equipment,0),0) AS departureLobbyEquipment,
- ( CASE a.business_library WHEN 1 THEN '是' ELSE '否' END ) AS businessLibrary,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'business_type' AND dict_value = a.business_library_type ) AS businessLibraryTypeName,
- ( CASE a.askari WHEN 1 THEN '是' ELSE '否' END ) AS askari,
- IFNULL(a.inner_count,0) AS innerCount,
- IFNULL(a.outside_count,0) AS outsideCount,
- ( CASE WHEN a.askari_certificate IS NULL THEN '否' ELSE '是' END ) AS isAskariCertificate,
- a.askari_certificate AS askariCertificate
- FROM
- sys_org b
- LEFT JOIN sys_org_extend a ON a.org_id = b.id
- -- LEFT JOIN core_weather_city c on a.weather_area_code = c.AREAID
- WHERE
- b.deleted = 0
- <!-- <if test="org.checkSub==true">
- and b.path like concat(#{org.path},"%")
- </if>
- <if test="org.checkSub==false">
- and b.id = #{org.parentId}
- </if>-->
- <if test=" org.checkSub != null and org.checkSub == true">
- and b.path like concat(concat('%',#{org.path}),'%')
- </if>
- <if test=" org.checkSub != null and org.checkSub == false">
- and b.path like concat('%',#{org.path})
- </if>
- <if test=" org.isLock != null ">
- AND b.is_lock = #{org.isLock}
- </if>
- <if test="typeList != null and typeList.size > 0">
- AND b.type IN
- <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
- #{orgType}
- </foreach>
- </if>
- ORDER BY
- FIND_IN_SET( b.affiliated_bank, #{findInSetOrder} ),
- b.is_lock,
- isnull( b.sort ),
- b.sort,
- b.short_name
- </select>
- <select id="exportDefenseDetailExtend" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport">
- SELECT
- b.id AS orgId,
- b.affiliated_area AS city,
- b.affiliated_bank AS affiliatedBank,
- b.short_name AS shortName,
- b.type AS orgType,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
- ( CASE b.is_lock WHEN 1 THEN '停用' ELSE '正常' END ) AS status,
- b.address AS address,
- a.type AS ga38Type,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_type' AND dict_value = a.type ) AS extendTypeName,
- ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_standard' AND dict_value = a.standard ) AS standard,
- IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS dateOfCompliance,
- a.reason as reason,
- IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS dateOfComplete,
- a.certificate as certificate
- FROM
- sys_org b
- LEFT JOIN sys_org_physical_defense_construction a ON a.org_id = b.id
- WHERE
- b.deleted = 0
- <if test=" org.checkSub != null and org.checkSub == true">
- and b.path like concat(concat('%',#{org.path}),'%')
- </if>
- <if test=" org.checkSub != null and org.checkSub == false">
- and b.path like concat('%',#{org.path})
- </if>
- <if test=" org.isLock != null ">
- AND b.is_lock = #{org.isLock}
- </if>
- <if test="typeList != null and typeList.size > 0">
- AND b.type IN
- <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
- #{orgType}
- </foreach>
- </if>
- ORDER BY
- FIND_IN_SET( b.affiliated_bank, #{findInSetOrder} ),
- b.is_lock,
- isnull( b.sort ),
- b.sort,
- b.short_name
- </select>
- </mapper>
|