liusuyi
2023-07-26 4b838e2a64b4f441819f43fccd067c076eb422b9
ard-work/src/main/resources/mapper/alarm/ArdAlarmTypeConfigMapper.xml
@@ -5,16 +5,13 @@
<mapper namespace="com.ruoyi.alarm.config.mapper.ArdAlarmTypeConfigMapper">
    
    <resultMap type="ArdAlarmTypeConfig" id="ArdAlarmTypeConfigResult">
        <result property="id"    column="id"    />
        <result property="command"    column="command"    />
        <result property="alarmType"    column="alarm_type"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="userId"    column="user_id"    />
    </resultMap>
    <sql id="selectArdAlarmTypeConfigVo">
        select id, command, alarm_type, create_time, user_id from ard_alarm_type_user
        select command, alarm_type, user_id from ard_alarm_type_user
    </sql>
    <select id="selectArdAlarmTypeConfigList" parameterType="ArdAlarmTypeConfig" resultMap="ArdAlarmTypeConfigResult">
@@ -33,19 +30,13 @@
    <insert id="insertArdAlarmTypeConfig" parameterType="ArdAlarmTypeConfig">
        insert into ard_alarm_type_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="command != null">command,</if>
            <if test="alarmType != null">alarm_type,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="userId != null">user_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="command != null">#{command},</if>
            <if test="alarmType != null">#{alarmType},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="userId != null">#{userId},</if>
         </trim>
    </insert>
@@ -55,8 +46,6 @@
        <trim prefix="SET" suffixOverrides=",">
            <if test="command != null">command = #{command},</if>
            <if test="alarmType != null">alarm_type = #{alarmType},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="userId != null">user_id = #{userId},</if>
        </trim>
        where id = #{id}
@@ -67,12 +56,18 @@
    </delete>
    <delete id="deleteArdAlarmTypeConfigByIds" parameterType="String">
        delete from ard_alarm_type_user where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        delete from ard_alarm_type_user where user_id in
        <foreach item="userId" collection="array" open="(" separator="," close=")">
            #{userId}
        </foreach>
    </delete>
    <delete id="deleteArdAlarmTypeConfigByCurrentUserId">
    <delete id="deleteArdAlarmTypeConfigByUserId">
        delete from ard_alarm_type_user where user_id=#{userId}
    </delete>
    <insert id="batchAlarmTypeConfig">
        insert into ard_alarm_type_user(user_id,command,alarm_type) values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.userId},#{item.command},#{item.alarmType})
        </foreach>
    </insert>
</mapper>