49 lines
2.0 KiB
XML
49 lines
2.0 KiB
XML
<?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.securitycontrol.system.mapper.OrgMapper">
|
|
<insert id="addOrg">
|
|
insert into sys_org(org_id, org_name, abb_name, b_name, p_id, del_flag)
|
|
values (#{orgId},#{orgName},#{abbName},#{bName},#{pId},'0')
|
|
</insert>
|
|
<update id="updateOrg">
|
|
update sys_org set
|
|
org_name=#{orgName},abb_name=#{abbName},b_name=#{bName},p_id=#{pId}
|
|
where org_id=#{orgId}
|
|
</update>
|
|
<delete id="delOrg">
|
|
update sys_org set del_flag=1 where org_id=#{orgId}
|
|
</delete>
|
|
<select id="getOrgList" resultType="com.securitycontrol.entity.system.vo.OrgVo" parameterType="com.securitycontrol.entity.system.dto.OrgDto">
|
|
select org_id orgId,org_name orgName,abb_name abbName,b_name bName,p_id pId
|
|
FROM sys_org
|
|
where del_flag=0
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
and ( org_name like concat('%',#{keyWord},'%')
|
|
|
|
)
|
|
</if>
|
|
<!--依据子节点查询父节点-->
|
|
<if test="pId!=null and pId!=''">
|
|
and org_id=#{pId}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="getDetails" resultType="com.securitycontrol.entity.system.vo.OrgVo">
|
|
select org_id orgId,org_name orgName,abb_name abbName,b_name bName,p_id pId
|
|
FROM sys_org where org_id=#{orgId}
|
|
</select>
|
|
<select id="getChildNum" resultType="java.lang.Integer">
|
|
select count(1)
|
|
FROM sys_org
|
|
where p_id=#{orgId} and del_flag=0
|
|
</select>
|
|
<select id="getNumByName" resultType="java.lang.Integer">
|
|
select count(1)
|
|
FROM sys_org
|
|
where p_id=#{pId} and del_flag=0 and org_name=#{orgName}
|
|
<if test="orgId!=null and orgId!=''">
|
|
and org_id!=#{orgId}
|
|
</if>
|
|
</select>
|
|
</mapper> |