|
@@ -17,10 +17,6 @@
|
|
|
<select id="selectListByParentId" resultType="SapOrg">
|
|
|
select * from sap_org
|
|
|
where 1=1
|
|
|
- and id in (SELECT DISTINCT firstOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT secondOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT thirdOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT fourthOrgId from sap_user where delFlag = 0)
|
|
|
<if test="parentId != null and parentId != ''">
|
|
|
and parentId=#{parentId}
|
|
|
</if>
|
|
@@ -29,10 +25,6 @@
|
|
|
<select id="selectListByName" resultType="SapOrg">
|
|
|
select * from sap_org
|
|
|
where sapName like CONCAT(CONCAT('%', #{pd.name}),'%')
|
|
|
- and id in (SELECT DISTINCT firstOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT secondOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT thirdOrgId from sap_user where delFlag = 0
|
|
|
- union all SELECT DISTINCT fourthOrgId from sap_user where delFlag = 0)
|
|
|
</select>
|
|
|
|
|
|
<select id="selectById" resultType="SapOrg">
|
|
@@ -42,4 +34,12 @@
|
|
|
<update id="updateWxDepartId">
|
|
|
update sap_org set wxDepartId=#{wxDepartId} where id=#{id}
|
|
|
</update>
|
|
|
+
|
|
|
+ <delete id="deleteNotUsed">
|
|
|
+ delete from sap_org
|
|
|
+ where id not in (SELECT DISTINCT firstOrgId from sap_user where delFlag = 0
|
|
|
+ union all SELECT DISTINCT secondOrgId from sap_user where delFlag = 0
|
|
|
+ union all SELECT DISTINCT thirdOrgId from sap_user where delFlag = 0
|
|
|
+ union all SELECT DISTINCT fourthOrgId from sap_user where delFlag = 0)
|
|
|
+ </delete>
|
|
|
</mapper>
|