<?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="cn.gistack.sm.sjztmd.mapper.AttAdBaseMapper">
|
|
<resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
|
<id column="id" property="id"/>
|
<result column="parent_id" property="parentId"/>
|
<result column="title" property="title"/>
|
<result column="value" property="value"/>
|
<result column="key" property="key"/>
|
<result column="has_children" property="hasChildren"/>
|
</resultMap>
|
<insert id="customizeSave">
|
INSERT INTO "att_ad_base"
|
("guid","ad_code","ad_name","p_ad_code","p_ad_name","ad_grad")
|
VALUES
|
(#{attAdBase.adCode},#{attAdBase.adCode},#{attAdBase.adName},#{attAdBase.pAdCode},#{attAdBase.pAdName},#{attAdBase.adGrad})
|
</insert>
|
|
<select id="lazyTree" resultMap="treeNodeResultMap">
|
SELECT
|
region."ad_code" AS "id",
|
region."p_ad_code" AS "parent_id",
|
region."ad_name" AS "title",
|
region."ad_code" AS "value",
|
region."ad_grad" AS "adGrad",
|
region."ad_code" AS "key",
|
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM "SJZT_MD"."att_ad_base" WHERE "p_ad_code" = region."ad_code" ) AS "has_children"
|
FROM
|
"SJZT_MD"."att_ad_base" region
|
<where>
|
<if test="param1!=null">
|
and region."p_ad_code" = #{param1}
|
</if>
|
<if test="param2.code!=null and param2.code!=''">
|
and region."ad_code" like concat(#{param2.code},'%')
|
</if>
|
<if test="param2.name!=null and param2.name!=''">
|
and region."ad_name" like concat('%',#{param2.name},'%')
|
</if>
|
<if test="param2.showFour !=null and param2.showFour !=''">
|
and IF(#{param2.showFour} = 'true',region."ad_grad" != 5,region."ad_grad" != 4)
|
</if>
|
</where>
|
ORDER BY region."order_id"
|
</select>
|
|
<select id="selectAttAdBaseTree" resultType="cn.gistack.common.node.TreeNode">
|
SELECT
|
region."ad_code" AS "id",
|
region."p_ad_code" AS "parent_id",
|
region."ad_name" AS "name",
|
region."ad_grad" AS "level",
|
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM "SJZT_MD"."att_ad_base" WHERE "p_ad_code" = region."ad_code" ) AS "has_children"
|
FROM
|
"SJZT_MD"."att_ad_base" region
|
<where>
|
<if test="param1!=null">
|
and region."p_ad_code" = #{param1}
|
</if>
|
<if test="param2.code!=null and param2.code!=''">
|
and region."ad_code" like concat(concat('%', #{param2.code}),'%')
|
</if>
|
<if test="param2.name!=null and param2.name!=''">
|
and region."ad_name" like concat(concat('%', #{param2.name}),'%')
|
</if>
|
and region."ad_grad" != 4
|
</where>
|
ORDER BY region."order_id"
|
</select>
|
|
<select id="lazyTreeAll" resultMap="treeNodeResultMap">
|
SELECT
|
region."ad_code" AS "id",
|
region."p_ad_code" AS "parent_id",
|
region."ad_name" AS "title",
|
region."ad_code" AS "value",
|
region."ad_grad" AS "adGrad",
|
region."ad_code" AS "key",
|
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM "SJZT_MD"."att_ad_base" WHERE "p_ad_code" = region."ad_code" ) AS "has_children"
|
FROM
|
"SJZT_MD"."att_ad_base" region
|
<where>
|
<if test="param1!=null">
|
and region."p_ad_code" = #{param1}
|
</if>
|
<if test="param2.code!=null and param2.code!=''">
|
and region."ad_code" like concat(concat('%', #{param2.code}),'%')
|
</if>
|
<if test="param2.name!=null and param2.name!=''">
|
and region."ad_name" like concat(concat('%', #{param2.name}),'%')
|
</if>
|
</where>
|
ORDER BY region."order_id"
|
</select>
|
|
<!--根据水库编号查询除责任人之外的人员信息-->
|
<select id="getPersonListByResGuid" resultType="cn.gistack.sm.sjztmd.vo.PersonVO">
|
select bu.real_name as name,bu.phone,bd.ad_code from YWXT.blade_user bu
|
left join YWXT.blade_dept bd on locate(bd.id,bu.dept_id)>0 and bd.is_deleted = 0
|
left join YWXT.blade_role br on locate(br.id,bu.role_id)>0 and br.is_deleted = 0
|
where bu.is_deleted = 0
|
and bd.ad_code in (
|
select "ad_code" from SJZT_MD."att_ad_base"
|
start with "ad_code" = (select "interior_ad_guid" from SJZT_MD."att_res_base" where "guid" = #{res_cd} )
|
CONNECT BY PRIOR "p_ad_code" = "ad_code"
|
)
|
and br.role_name like concat('%',#{roleName},'%')
|
and bu.phone is not null and bu.phone!=''
|
</select>
|
|
<select id="getDetail" resultType="cn.gistack.sm.sjztmd.vo.AttAdBaseVO">
|
SELECT
|
region."guid",
|
region."ad_code",
|
region."p_ad_code",
|
region."ad_name",
|
region."ad_grad",
|
region."p_ad_name" AS pAdName,
|
region."order_id" AS orderId,
|
( SELECT CASE WHEN count( 1 ) > 0 THEN 1 ELSE 0 END FROM "SJZT_MD"."att_ad_base" WHERE "p_ad_code" = region."ad_code" ) AS "has_children"
|
FROM "SJZT_MD"."att_ad_base" region
|
WHERE region."guid" = #{attAdBase.guid}
|
</select>
|
|
</mapper>
|