123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?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.gyee.wisdom.alarm.sharding.mapper.Alertrule2Mapper">
- <resultMap type="Alertrule2" id="Alertrule2Result">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="station" column="station" />
- <result property="relatedParts" column="relatedParts" />
- <association property="windPowerStation" column="station" javaType="WindPowerStation" select="com.gyee.wisdom.alarm.sharding.mapper.WindPowerStationMapper.selectByid"/>
- <association property="datadictionary" column="relatedParts" javaType="Datadictionary" select="com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper.selectBycode"/>
- </resultMap>
- <select id="pageQueryAll" parameterType="java.util.Map" resultMap="Alertrule2Result">
- select a.* from ALERTRULE2 a
- left join windpowerstation w on w.id = a.station
- <where>
- 1=1
- <if test="name !=null and name !=''">
- and a.name like '%${name}%'
- </if>
- <if test="station !=null and station !=''">
- and a.station like '%${station}%'
- </if>
- <if test="modelId !=null and modelId !=''">
- and a.modelid like '%${modelId}%'
- </if>
- <if test="rank !=null and rank !=''">
- and a.rank = #{rank}
- </if>
- /* and a.range = 0*/
- </where>
- order by a.createtime desc
- </select>
- <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
- select max(a.ednavalue) from ALERTRULE2 a
- </select>
- <select id="getAllByStationIdAndModelId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
- select * from ALERTRULE2 a
- <where>
- 1=1
- <if test="idString !=null and idString !=''">
- and a.id like '%${idString}%'
- </if>
- </where>
- </select>
- <select id="getById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
- select * from ALERTRULE2 a
- <where>
- 1=1
- <if test="idString !=null and idString !=''">
- and a.id = #{idString}
- </if>
- </where>
- </select>
- <select id="quertByrelatedParts" resultType="java.util.HashMap">
- select a.name from ALERTRULE2 a
- where a.relatedparts = #{relatedParts}
- group by a.name
- </select>
- <select id="queryTree" resultMap="Alertrule2Result" >
- select distinct a.relatedparts,a.name,d.name from alertrule2 a
- left join DATADICTIONARY d
- on d.code = a.relatedparts
- where
- relatedparts is not null
- </select>
- <select id="queryMap" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
- select t.relatedparts,d.name from
- (select a.relatedparts from alertrule2 a
- where relatedparts is not null
- group by a.relatedparts) t
- left join DATADICTIONARY d
- on d.code = t.relatedparts
- </select>
- <insert id="insertAlertrule2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2" useGeneratedKeys="true">
- insert into alertrule2(name, description, expression, tag, rank, enabled,
- modelId,ednaValue,category,range,station,
- windturbine,line,project,electrical,taskstart,relatedParts,createtime)
- values (#{name}, #{description}, #{expression},
- #{tag}, #{rank}, #{enabled},#{modelId}, #{ednaValue}, #{category},#{range},#{station},
- #{windturbine}, #{line},#{project}, #{electrical}, #{taskstart},#{relatedParts},#{createtime})
- </insert>
- <update id="updateByAlertrule2Id" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
- update alertrule2 a
- <set >
- <if test="name != null">a.name = #{name},</if>
- <if test="description != null">a.description = #{description},</if>
- <if test="expression != null">a.expression = #{expression},</if>
- <if test="tag != null">a.tag = #{tag},</if>
- <if test="rank != null">a.rank = #{rank},</if>
- <if test="enabled != null">a.enabled = #{enabled},</if>
- <if test="modelId != null">a.modelId = #{modelId},</if>
- <if test="ednaValue != null">a.ednaValue = #{ednaValue},</if>
- <if test="category != null">a.category = #{category},</if>
- <if test="range != null">a.range = #{range},</if>
- <if test="station != null">a.station = #{station},</if>
- <if test="windturbine != null">a.windturbine = #{windturbine},</if>
- <if test="line != null">a.line = #{line},</if>
- <if test="project != null">a.project = #{project},</if>
- <if test="electrical != null">a.electrical = #{electrical},</if>
- <if test="taskstart != null">a.taskstart = #{taskstart},</if>
- <if test="relatedParts != null">a.relatedParts = #{relatedParts},</if>
- <if test="createtime != null">a.createtime = #{createtime}</if>
- </set>
- where a.id = #{id}
- </update>
- <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
- select * from alertrule2 a where a.id=#{id}
- </select>
- </mapper>
|