<?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="org.springblade.modules.dispatcher.mapper.DispatcherUnitMapper">
|
|
<!--派遣公司分页信息-->
|
<select id="selectDispatcherUnitPage" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
|
select
|
sdu.*,bt.dept_name deptName,sj.dept_name jurisdictionName
|
from
|
sys_dispatcher_unit sdu
|
LEFT JOIN
|
blade_dept bt
|
ON
|
sdu.dept_id = bt.id
|
left join
|
sys_jurisdiction sj
|
on
|
sj.id = sdu.jurisdiction
|
WHERE
|
1=1
|
<if test="dispatcherUnit.deptName!=null and dispatcherUnit.deptName!=''">
|
and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
|
</if>
|
<if test="dispatcherUnit.name!=null and dispatcherUnit.name!=''">
|
and sdu.name like concat('%', #{dispatcherUnit.name},'%')
|
</if>
|
<if test="dispatcherUnit.linkman!=null and dispatcherUnit.linkman!=''">
|
and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
|
</if>
|
<if test="dispatcherUnit.phone!=null and dispatcherUnit.phone!=''">
|
and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
|
</if>
|
<if test="dispatcherUnit.province!=null">
|
and sdu.province = #{dispatcherUnit.province}
|
</if>
|
<if test="dispatcherUnit.city!=null">
|
and sdu.city = #{dispatcherUnit.city}
|
</if>
|
<if test="dispatcherUnit.jurisdiction!=null and dispatcherUnit.jurisdiction!='' and dispatcherUnit.jurisdiction!='1372091709474910209'">
|
and (sj.id = #{dispatcherUnit.jurisdiction} or sj.parent_id = #{dispatcherUnit.jurisdiction})
|
</if>
|
<if test="dispatcherUnit.deptId!=null and dispatcherUnit.deptId!=''">
|
and sdu.dept_id in
|
(
|
select id from blade_dept where id = #{dispatcherUnit.deptId}
|
union
|
SELECT
|
id
|
FROM
|
(
|
SELECT
|
t1.id,t1.parent_id,t1.dept_name,
|
IF
|
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
|
FROM
|
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
|
( SELECT @pids := #{dispatcherUnit.deptId} ) t2
|
) t3
|
WHERE
|
ischild != 0
|
)
|
</if>
|
<if test="dispatcherUnit.district!=null">
|
and sdu.district = #{dispatcherUnit.district}
|
</if>
|
<if test="dispatcherUnit.beginTime!=null or dispatcherUnit.overTime!=null">
|
<if test="dispatcherUnit.beginTime!='' or dispatcherUnit.overTime!=''">
|
and sdu.end_time <= #{dispatcherUnit.overTime} and sdu.end_time >= #{dispatcherUnit.beginTime}
|
or ( sdu.start_time <= #{dispatcherUnit.overTime} and sdu.start_time >= #{dispatcherUnit.beginTime})
|
</if>
|
</if>
|
<if test="dispatcherUnit.isExpire==1">
|
and sdu.start_time <= now()
|
and sdu.end_time > now()
|
</if>
|
<if test="dispatcherUnit.isExpire==2">
|
and sdu.end_time <= now()
|
</if>
|
</select>
|
|
<!--自定义树-->
|
<select id="selectDispatcherUnitPageTree" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
|
select
|
sdu.id,sdu.name
|
from
|
sys_dispatcher_unit sdu
|
LEFT JOIN
|
blade_dept bt
|
ON
|
sdu.dept_id = bt.id
|
WHERE
|
1=1
|
<if test="dispatcherUnit.deptName!=null and dispatcherUnit.deptName!=''">
|
and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
|
</if>
|
<if test="dispatcherUnit.deptId!=null and dispatcherUnit.deptId!=''">
|
and sdu.dept_id like concat('%', #{dispatcherUnit.deptId},'%')
|
</if>
|
<if test="dispatcherUnit.name!=null and dispatcherUnit.name!=''">
|
and sdu.name like concat('%', #{dispatcherUnit.name},'%')
|
</if>
|
<if test="dispatcherUnit.linkman!=null and dispatcherUnit.linkman!=''">
|
and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
|
</if>
|
<if test="dispatcherUnit.phone!=null and dispatcherUnit.phone!=''">
|
and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
|
</if>
|
<if test="dispatcherUnit.province!=null">
|
and sdu.province = #{dispatcherUnit.province}
|
</if>
|
<if test="dispatcherUnit.city!=null">
|
and sdu.city = #{dispatcherUnit.city}
|
</if>
|
<if test="dispatcherUnit.jurisdiction!=null">
|
and sdu.jurisdiction = #{dispatcherUnit.jurisdiction}
|
</if>
|
<if test="dispatcherUnit.district!=null">
|
and sdu.district = #{dispatcherUnit.district}
|
</if>
|
</select>
|
|
|
<!--派遣公司详细信息-->
|
<select id="selectDispatcherUnitInfo" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
|
select
|
sdu.*,bt.dept_name deptName
|
from
|
sys_dispatcher_unit sdu
|
LEFT JOIN
|
blade_dept bt
|
ON
|
sdu.dept_id = bt.id
|
where
|
1=1
|
<if test="dispatcherUnit.id!=null">
|
and sdu.id = #{dispatcherUnit.id}
|
</if>
|
</select>
|
</mapper>
|