<?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.jeecg.modules.andon.mapper.AndonButtonConfigMapper">
|
<select id="getAndonButtonById" resultType="org.jeecg.modules.andon.entity.AndonButtonConfig">
|
SELECT *
|
FROM andon_button_config
|
WHERE id = #{id}
|
and del_flag = 0
|
and button_status = '启用'
|
</select>
|
<select id="queryUserAndonButtonList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">
|
select arc.id,
|
abc.id as button_id,
|
abc.button_name,
|
abc.button_code,
|
(select count(1)
|
from andon_order ao
|
where ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status != '3') as blinking_flag, STUFF((SELECT ',' + CAST (ao.id AS VARCHAR)
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
FOR XML PATH ('')), 1, 1, '') as order_ids
|
from andon_response_config arc
|
left join andon_button_config abc
|
on arc.button_id = abc.id
|
where arc.factory_id=#{factoryId};
|
</select>
|
|
<select id="queryUserAndonCallList" resultType="org.jeecg.modules.andon.dto.AndonOrdeDto">
|
SELECT
|
ao.*,
|
bf.factory_name as factoryName,
|
parent_bf.factory_name as parentFactoryName,
|
abc.button_name as buttonName,
|
abc.upgrade_response_duration as upgradeResponseDuration,
|
abc.second_upgrade_response_duration as secondUpgradeResponseDuration,
|
su.username as operatorName
|
FROM andon_order ao
|
LEFT JOIN base_factory bf ON ao.factory_id = bf.id
|
LEFT JOIN base_factory parent_bf ON bf.parent_id = parent_bf.id
|
LEFT JOIN andon_button_config abc ON ao.button_id = abc.id
|
LEFT JOIN sys_user su ON ao.operator = su.id
|
WHERE ao.factory_id = #{factoryId}
|
AND ao.del_flag = 0
|
AND ao.order_status = #{orderStatus}
|
</select>
|
|
<select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonOrdeDto">
|
select arc.id,
|
abc.id as buttonId,
|
abc.button_name as buttonName,
|
abc.button_code as buttonCode,
|
(select count(1)
|
from andon_order ao
|
where ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '2') as blinkingFlag,
|
STUFF((SELECT ',' + CAST(ao.id AS VARCHAR)
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '2'
|
FOR XML PATH ('')), 1, 1, '') as orderIds,
|
bf.factory_name as factoryName,
|
parent_bf.factory_name as parentFactoryName,
|
abc.upgrade_response_duration as upgradeResponseDuration,
|
abc.second_upgrade_response_duration as secondUpgradeResponseDuration,
|
arc.firster_responder as responder,
|
arc.second_responder,
|
arc.third_responder,
|
STUFF((SELECT ',' + ao.order_status
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '2'
|
FOR XML PATH ('')), 1, 1, '') as orderStatus,
|
(SELECT TOP 1 ao.operator
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '2') as operator
|
from andon_response_config arc
|
left join andon_button_config abc
|
on arc.button_id = abc.id
|
left join base_factory bf on arc.factory_id = bf.id
|
left join base_factory parent_bf on bf.parent_id = parent_bf.id
|
where arc.factory_id = #{factoryId}
|
and (select count(1)
|
from andon_order ao
|
where ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '2') = 1
|
</select>
|
<!-- <select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">-->
|
<!-- select arc.id,-->
|
<!-- abc.id as buttonId,-->
|
<!-- abc.button_name as buttonName,-->
|
<!-- abc.button_code as buttonCode,-->
|
<!-- (select count(1)-->
|
<!-- from andon_order ao-->
|
<!-- where ao.button_id = arc.button_id-->
|
<!-- and ao.factory_id = arc.factory_id-->
|
<!-- and ao.order_status = '2') as blinkingFlag,-->
|
<!-- STUFF((SELECT ',' + CAST(ao.id AS VARCHAR)-->
|
<!-- FROM andon_order ao-->
|
<!-- WHERE ao.button_id = arc.button_id-->
|
<!-- and ao.factory_id = arc.factory_id-->
|
<!-- and ao.order_status = '2'-->
|
<!-- FOR XML PATH ('')), 1, 1, '') as orderIds,-->
|
<!-- bf.factory_name as factoryName,-->
|
<!-- parent_bf.factory_name as parentFactoryName,-->
|
<!-- abc.upgrade_response_duration as upgradeResponseDuration,-->
|
<!-- abc.second_upgrade_response_duration as secondUpgradeResponseDuration,-->
|
<!-- arc.firster_responder as responder,-->
|
<!-- arc.second_responder,-->
|
<!-- arc.third_responder,-->
|
<!-- STUFF((SELECT ',' + ao.order_status-->
|
<!-- FROM andon_order ao-->
|
<!-- WHERE ao.button_id = arc.button_id-->
|
<!-- and ao.factory_id = arc.factory_id-->
|
<!-- and ao.order_status = '2'-->
|
<!-- FOR XML PATH ('')), 1, 1, '') as orderStatus-->
|
<!-- from andon_response_config arc-->
|
<!-- left join andon_button_config abc-->
|
<!-- on arc.button_id = abc.id-->
|
<!-- left join base_factory bf on arc.factory_id = bf.id-->
|
<!-- left join base_factory parent_bf on bf.parent_id = parent_bf.id-->
|
<!-- where arc.factory_id = #{factoryId}-->
|
<!-- and (select count(1)-->
|
<!-- from andon_order ao-->
|
<!-- where ao.button_id = arc.button_id-->
|
<!-- and ao.factory_id = arc.factory_id-->
|
<!-- and ao.order_status = '2') = 1-->
|
<!-- </select>-->
|
|
|
<select id="queryUserAndonHandelList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO">
|
select arc.id,
|
abc.id as buttonId,
|
abc.button_name as buttonName,
|
abc.button_code as buttonCode,
|
(select count(1)
|
from andon_order ao
|
where ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '3') as blinkingFlag,
|
STUFF((SELECT ',' + CAST(ao.id AS VARCHAR)
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '3'
|
FOR XML PATH ('')), 1, 1, '') as orderIds,
|
bf.factory_name as factoryName,
|
parent_bf.factory_name as parentFactoryName,
|
abc.upgrade_response_duration as upgradeResponseDuration,
|
abc.second_upgrade_response_duration as secondUpgradeResponseDuration,
|
arc.firster_responder as responder,
|
arc.second_responder,
|
arc.third_responder,
|
STUFF((SELECT ',' + ao.order_status
|
FROM andon_order ao
|
WHERE ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '3'
|
FOR XML PATH ('')), 1, 1, '') as orderStatus
|
from andon_response_config arc
|
left join andon_button_config abc
|
on arc.button_id = abc.id
|
left join base_factory bf on arc.factory_id = bf.id
|
left join base_factory parent_bf on bf.parent_id = parent_bf.id
|
where arc.factory_id = #{factoryId}
|
and (select count(1)
|
from andon_order ao
|
where ao.button_id = arc.button_id
|
and ao.factory_id = arc.factory_id
|
and ao.order_status = '3') = 1
|
</select>
|
|
|
</mapper>
|