| | |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND ic.operateType = 1 |
| | | |
| | | <if test = "id != null and id > 0"> |
| | | AND con.id = ${id} |
| | | </if> |
| | | |
| | | <if test = "controllerCode != null and controllerCode !=''"> |
| | | AND con.code like CONCAT('%',#{controllerCode},'%') |
| | | </if> |
| | |
| | | <select id="getControllers" resultType="com.dy.pipIrrGlobal.voPr.VoController"> |
| | | SELECT |
| | | (@i:=@i+1) AS id, |
| | | con.code AS controllerCode, |
| | | (CASE |
| | | WHEN con.onlineState = 1 THEN "在线" |
| | | WHEN con.onlineState = 2 THEN "离线" |
| | | END) AS onlineState, |
| | | inta.name AS intakeName, |
| | | (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber, |
| | | con.reportTime |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id |
| | | INNER JOIN pr_intake inta ON ic.intakeId = inta.id |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | AND ic.operateType = 1 |
| | | <if test = "controllerCode != null and controllerCode !=''"> |
| | | AND con.code like CONCAT('%',#{controllerCode},'%') |
| | | </if> |
| | | t.* FROM( |
| | | SELECT |
| | | con.code AS controllerCode, |
| | | (CASE |
| | | WHEN con.onlineState = 1 THEN "在线" |
| | | WHEN con.onlineState = 2 THEN "离线" |
| | | END) AS onlineState, |
| | | inta.name AS intakeName, |
| | | (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber, |
| | | con.reportTime |
| | | FROM pr_controller con |
| | | INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id |
| | | INNER JOIN pr_intake inta ON ic.intakeId = inta.id |
| | | <where> |
| | | AND ic.operateType = 1 |
| | | |
| | | <if test = "onlineState != null and onlineState > 0"> |
| | | AND con.onlineState = ${onlineState} |
| | | </if> |
| | | <if test = "id != null and id > 0"> |
| | | AND con.id = ${id} |
| | | </if> |
| | | |
| | | <if test = "bindNumber != null and bindNumber > 0"> |
| | | AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) = ${bindNumber} |
| | | </if> |
| | | </where> |
| | | ORDER BY con.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | <if test = "controllerCode != null and controllerCode !=''"> |
| | | AND con.code like CONCAT('%',#{controllerCode},'%') |
| | | </if> |
| | | |
| | | <if test = "onlineState != null and onlineState > 0"> |
| | | AND con.onlineState = ${onlineState} |
| | | </if> |
| | | |
| | | <if test = "bindNumber != null and bindNumber > 0"> |
| | | AND (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) = ${bindNumber} |
| | | </if> |
| | | </where> |
| | | ORDER BY con.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | ) t |
| | | , (SELECT @i:=0) AS itable |
| | | </select> |
| | | |
| | | <!--根据控制器编号获取控制器列表--> |
| | | <select id="getControllersByCode" resultType="java.util.Map"> |
| | | SELECT id, code FROM pr_controller WHERE code LIKE CONCAT('%',#{controllerCode},'%') |
| | | </select> |
| | | |
| | | <!--根据控制器编号逻辑删除控制--> |
| | | <update id="deleteControllerById"> |
| | | UPDATE pr_controller SET deleted = 1 WHERE id = ${controllerId} |
| | | </update> |
| | | |
| | | <!--根据控制器编号获取未删除的控制器数量--> |
| | | <select id="getRecordCountOfController" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) AS recordCount FROM pr_controller WHERE deleted = 0 AND id = ${controllerId} |
| | | </select> |
| | | </mapper> |