<?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="com.newfiber.led.business.dao.LedDao"> <resultMap id="BaseResultMap" type="com.newfiber.led.business.entity.LedInformation"> <id property="id" column="id"/> <result property="idsDev" column="ids_dev"/> <result property="idsName" column="ids_name"/> <result property="idsAddress" column="ids_address"/> <result property="programAttribute" column="program_attribute"/> <result property="siteNo" column="site_no"/> <result property="siteName" column="site_name"/> <result property="display" column="display"/> <result property="displayAttribute" column="display_attribute"/> <result property="earlyValue" column="early_value"/> <result property="earlyDisplay" column="early_display"/> <result property="policeValue" column="police_value"/> <result property="policeDisplay" column="police_display"/> <result property="fontSize" column="font_size"/> <result property="color" column="color"/> <result property="tipsDisplay" column="tips_display"/> <result property="tipsAttribute" column="tips_attribute"/> <result property="tipsFontSize" column="tips_font_size"/> <result property="tipsColor" column="tips_color"/> <result property="logStatus" column="log_status"/> <result property="pushStatus" column="push_status"/> <result property="createTime" column="create_time"/> <result property="pushTime" column="push_time"/> <result property="pushValue" column="push_value"/> <result property="typeColor" column="type_color"/> <result property="adminMail" column="admin_mail"/> </resultMap> <select id="queryZ" resultType="com.newfiber.led.business.entity.TempdataEntity"> SELECT s.st_code AS st, s.`value` AS z FROM led_information l LEFT JOIN station_config s ON l.site_no = s.st_code WHERE l.ids_dev = #{idsDev} AND s.`key` = 'Z' </select> <select id="querySubtitle" resultMap="BaseResultMap"> SELECT id, ids_dev, ids_name, ids_address, program_attribute, site_no , site_name, display, display_attribute, early_value, early_display, police_value, police_display, font_size, color, tips_display, tips_attribute, tips_font_size, tips_color, log_status, push_status, create_time, push_time, push_value, type_color, admin_mail FROM led_information WHERE 1 = 1 <if test="idsDev != null and idsDev.trim() != ''"> AND ids_dev = #{idsDev} </if> <if test="siteNo != null and siteNo.trim() != ''"> AND (ids_name like concat('%', #{siteNo},'%') or ids_address like concat('%', #{siteNo},'%') or site_name like concat('%', #{siteNo},'%') or tips_display like concat('%', #{siteNo},'%')) </if> </select> <insert id="save" parameterType="com.newfiber.led.business.entity.LedInformation"> insert into led_information <trim prefix="(" suffix=")" suffixOverrides=","> <if test="idsDev != null"> ids_dev, </if> <if test="idsName != null"> ids_name, </if> <if test="idsAddress != null"> ids_address, </if> <if test="programAttribute != null"> program_attribute, </if> <if test="siteNo != null"> site_no, </if> <if test="siteName != null"> site_name, </if> <if test="display != null"> display, </if> <if test="displayAttribute != null"> display_attribute, </if> <if test="earlyValue != null"> early_value, </if> <if test="earlyDisplay != null"> early_display, </if> <if test="policeValue != null"> police_value, </if> <if test="policeDisplay != null"> police_display, </if> <if test="fontSize != null"> font_size, </if> <if test="tipsDisplay != null"> tips_display, </if> <if test="tipsAttribute != null"> tips_attribute, </if> <if test="tipsFontSize != null"> tips_font_size, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="idsDev != null"> #{idsDev}, </if> <if test="idsName != null"> #{idsName}, </if> <if test="idsAddress != null"> #{idsAddress}, </if> <if test="programAttribute != null"> #{programAttribute}, </if> <if test="siteNo != null"> #{siteNo}, </if> <if test="siteName != null"> #{siteName}, </if> <if test="display != null"> #{display}, </if> <if test="displayAttribute != null"> #{displayAttribute}, </if> <if test="earlyValue != null"> #{earlyValue}, </if> <if test="earlyDisplay != null"> #{earlyDisplay}, </if> <if test="policeValue != null"> #{policeValue}, </if> <if test="policeDisplay != null"> #{policeDisplay}, </if> <if test="fontSize != null"> #{fontSize}, </if> <if test="tipsDisplay != null"> #{tipsDisplay}, </if> <if test="tipsAttribute != null"> #{tipsAttribute}, </if> <if test="tipsFontSize != null"> #{tipsFontSize}, </if> </trim> </insert> <update id="update" parameterType="com.newfiber.led.business.entity.LedInformation"> update led_information <set> <if test="idsName != null"> ids_name = #{idsName}, </if> <if test="idsAddress != null"> ids_address = #{idsAddress}, </if> <if test="programAttribute != null"> program_attribute = #{programAttribute}, </if> <if test="siteNo != null"> site_no = #{siteNo}, </if> <if test="siteName != null"> site_name = #{siteName}, </if> <if test="typeColor != null"> type_color = #{typeColor}, </if> <if test="display != null"> display = #{display}, </if> <if test="displayAttribute != null"> display_attribute = #{displayAttribute}, </if> <if test="earlyValue != null"> early_value = #{earlyValue}, </if> <if test="earlyDisplay != null"> early_display = #{earlyDisplay}, </if> <if test="policeValue != null"> police_value = #{policeValue}, </if> <if test="policeDisplay != null"> police_display = #{policeDisplay}, </if> <if test="fontSize != null"> font_size = #{fontSize}, </if> <if test="color != null"> color = #{color}, </if> <if test="tipsDisplay != null"> tips_display = #{tipsDisplay}, </if> <if test="tipsAttribute != null"> tips_attribute = #{tipsAttribute}, </if> <if test="tipsFontSize != null"> tips_font_size = #{tipsFontSize}, </if> <if test="tipsColor != null"> tips_color = #{tipsColor}, </if> <if test="logStatus != null"> log_status = #{logStatus}, </if> <if test="pushStatus != null"> push_status = #{pushStatus}, </if> <if test="pushTime != null"> push_time = #{pushTime}, </if> <if test="pushValue != null"> push_value = #{pushValue}, </if> <if test="adminMail != null"> admin_mail = #{adminMail}, </if> </set> where ids_dev = #{idsDev} </update> <delete id="delete" parameterType="com.newfiber.led.business.entity.LedInformation"> DELETE FROM led_information WHERE ids_dev = #{idsDev} </delete> <insert id="addSiteGroup" parameterType="map"> insert into led_site_grouping (platform_code,group_name,parent_id,site_no,site_name) VALUES <foreach collection="list" item="item" index="index" separator=","> (#{item.platformCode},#{item.groupName},#{item.parentId},#{item.siteNo},#{item.siteName}) </foreach> </insert> <select id="querySiteGroup" resultType="com.newfiber.led.business.entity.LedSiteGrouping"> SELECT DISTINCT l.id, l.platform_code AS platformCode, l.group_name AS groupName, l.parent_id AS parentId, l.site_no AS siteNo, l.site_name AS siteName, l.create_time AS createTime FROM led_site_grouping l LEFT JOIN om_user_platform u ON l.platform_code = u.platfrom_code WHERE <if test="parentId == null "> l.parent_id IS NULL </if> <if test="parentId != null "> l.parent_id = #{parentId} </if> <if test="userNo != null "> AND u.user_account = #{userNo} </if> <if test=" rows != 0"> LIMIT #{page},#{rows} </if> </select> <update id="updateSiteGroup" parameterType="com.newfiber.led.business.entity.LedInformation"> update led_site_grouping <set> <if test="platformCode != null"> platform_code = #{platformCode}, </if> <if test="groupName != null"> group_name = #{groupName}, </if> <if test="siteNo != null"> site_no = #{siteNo}, </if> <if test="siteName != null"> site_name = #{siteName}, </if> </set> where id = #{id} </update> <delete id="deleteSiteGroup"> DELETE FROM led_site_grouping WHERE id IN <foreach item="id" collection="list" open="(" separator="," close=")"> #{id} </foreach> OR parent_id IN <foreach item="id" collection="list" open="(" separator="," close=")"> #{id} </foreach> </delete> <select id="querySiteMes" resultType="com.newfiber.led.business.entity.LedSiteGrouping"> SELECT DISTINCT s.st_code AS siteNo, s.st_name AS siteName FROM station_base s LEFT JOIN om_user_platform u ON s.platform_code = u.platfrom_code WHERE s.st_code NOT IN ( SELECT site_no FROM led_site_grouping WHERE parent_id IS NOT NULL ) <if test="userNo != null and userNo.trim() != '' "> AND u.user_account = #{userNo} </if> <if test="siteName != null and siteName.trim() != '' "> AND s.st_name like concat('%', #{siteName},'%') </if> <if test=" rows != 0"> LIMIT #{page},#{rows} </if> </select> <insert id="saveLog" parameterType="map"> insert into led_state (ids_dev,ids_name) VALUES <foreach collection="list" item="item" index="index" separator=","> (#{item.idsDev},#{item.idsName}) </foreach> </insert> <select id="queryLogs" resultType="com.newfiber.led.business.entity.LedState"> SELECT id, ids_dev AS idsDev, ids_name AS idsName, create_time AS createTime FROM led_state WHERE ids_dev = #{idsDev} <if test="startTime != null and endTime != null"> AND create_time BETWEEN #{startTime} AND #{endTime} </if> ORDER BY create_time DESC <if test=" rows != 0"> LIMIT #{page},#{rows} </if> </select> <select id="queryLed" resultMap="BaseResultMap"> SELECT id, ids_dev, ids_name, ids_address, program_attribute, site_no , site_name, display, display_attribute, early_value, early_display, police_value, police_display, font_size, color, tips_display, tips_attribute, tips_font_size, tips_color, log_status, push_status, create_time, push_time, push_value, type_color, admin_mail FROM led_information WHERE 1 = 1 and ids_dev in <foreach item="item" collection="asList" open="(" separator="," close=")"> #{item} </foreach> </select> </mapper>