智慧保安后台管理-验收版本
tangzy
2021-12-06 30df94c05573a426d030510d4dd58ae1d93bfb7a
src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
@@ -10,12 +10,77 @@
        <result column="dispatcher" property="dispatcher"/>
        <result column="dispatcherTime" property="dispatchertime"/>
        <result column="dispatcherAddress" property="dispatcheraddress"/>
        <result column="dispatchercompany" property="dispatchercompany"/>
        <result column="jurisdiction" property="jurisdiction"/>
    </resultMap>
    <!--派遣记录分页数据-->
    <select id="selectDispatcherPage" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
        select
        sd.*,
        bu.real_name securityName,sdu.name dispatcherCompany,bu.cardid idCardNo,bu.phone securityPhone,
        bd.dept_name deptName,
        sdu.linkman,sdu.phone
        from
        sys_dispatcher sd
        left join
        sys_dispatcher_unit sdu
        on
        sdu.id = sd.dispatcher_unit_id
        left join
        blade_user bu
        on
        bu.id = sd.user_ids
        left join
        blade_dept bd
        on
        bd.id = bu.dept_id
        where 1=1
        and bu.is_deleted = 0
        and bu.status = 1
        <if test="dispatcher.dispatcherUnitId!=null">
            and sd.dispatcher_unit_id = #{dispatcher.dispatcherUnitId}
        </if>
        <if test="dispatcher.deptId!=null">
            and sd.dept_id = #{dispatcher.deptId}
        </if>
        <if test="dispatcher.dispatch!=null and dispatcher.dispatch!=''">
            and bu.dispatch = #{dispatcher.dispatch}
            and sd.status = #{dispatcher.dispatch}
        </if>
        <if test="dispatcher.userIds!=null and  dispatcher.userIds!=''">
            and sd.user_ids like concat('%', #{dispatcher.userIds},'%')
        </if>
        <if test="dispatcher.name!=null and  dispatcher.name!=''">
            and sd.name like concat('%', #{dispatcher.name},'%')
        </if>
        <if test="dispatcher.cardid!=null and  dispatcher.cardid!=''">
            and sd.cardid like concat('%', #{dispatcher.cardid},'%')
        </if>
        <if test="dispatcher.dispatcherCompany!=null and  dispatcher.dispatcherCompany!=''">
            and sdu.name like concat('%', #{dispatcher.dispatcherCompany},'%')
        </if>
        <if test="dispatcher.beginTime!=null or dispatcher.overTime!=null">
            <if test="dispatcher.beginTime!='' or dispatcher.overTime!=''">
                and sd.end_time &lt;= #{dispatcher.overTime} and sd.end_time &gt;= #{dispatcher.beginTime}
                or ( sd.dispatcherTime &lt;= #{dispatcher.overTime} and sd.dispatcherTime &gt;= #{dispatcher.beginTime})
            </if>
        </if>
    </select>
    <select id="selectDispatcherPage" resultMap="dispatcherResultMap">
        select * from sys_dispatcher where is_deleted = 0
    <!--派遣记录详情-->
    <select id="getDispatcherInfo" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
        select
            sd.*,sdu.name dispatcherCompany
        from
            sys_dispatcher sd
        left join
            sys_dispatcher_unit sdu
        on
            sdu.id = sd.dispatcher_unit_id
        where 1=1
        <if test="dispatcher.id!=null">
            and sd.id = #{dispatcher.id}
        </if>
    </select>
</mapper>