You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
6.7 KiB
XML

2 years ago
<?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.ruoyi.business.mapper.HwDeviceModeParameterMapper">
<resultMap type="HwDeviceModeParameter" id="HwDeviceModeParameterResult">
<result property="modeParameterId" column="mode_parameter_id" />
<result property="modeFunctionId" column="mode_function_id" />
<result property="releatedParameterId" column="releated_parameter_id" />
<result property="parameterType" column="parameter_type" />
<result property="parameterName" column="parameter_name" />
<result property="parameterIdentifier" column="parameter_identifier" />
<result property="dataType" column="data_type" />
<result property="dataDefinition" column="data_definition" />
<result property="propertyUnit" column="property_unit" />
<result property="propertyStep" column="property_step" />
</resultMap>
<sql id="selectHwDeviceModeParameterVo">
select mode_parameter_id, mode_function_id, releated_parameter_id, parameter_type, parameter_name, parameter_identifier, data_type, data_definition, property_unit, property_step from hw_device_mode_parameter
</sql>
<select id="selectHwDeviceModeParameterList" parameterType="HwDeviceModeParameter" resultMap="HwDeviceModeParameterResult">
<include refid="selectHwDeviceModeParameterVo"/>
<where>
<if test="modeFunctionId != null "> and mode_function_id = #{modeFunctionId}</if>
<if test="releatedParameterId != null "> and releated_parameter_id = #{releatedParameterId}</if>
<if test="parameterType != null and parameterType != ''"> and parameter_type = #{parameterType}</if>
<if test="parameterName != null and parameterName != ''"> and parameter_name like concat('%', #{parameterName}, '%')</if>
<if test="parameterIdentifier != null and parameterIdentifier != ''"> and parameter_identifier = #{parameterIdentifier}</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="dataDefinition != null and dataDefinition != ''"> and data_definition = #{dataDefinition}</if>
<if test="propertyUnit != null and propertyUnit != ''"> and property_unit = #{propertyUnit}</if>
<if test="propertyStep != null "> and property_step = #{propertyStep}</if>
</where>
</select>
<select id="selectHwDeviceModeParameterByModeParameterId" parameterType="Long" resultMap="HwDeviceModeParameterResult">
<include refid="selectHwDeviceModeParameterVo"/>
where mode_parameter_id = #{modeParameterId}
</select>
<insert id="insertHwDeviceModeParameter" parameterType="HwDeviceModeParameter" useGeneratedKeys="true" keyProperty="modeParameterId">
insert into hw_device_mode_parameter
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modeFunctionId != null">mode_function_id,</if>
<if test="releatedParameterId != null">releated_parameter_id,</if>
<if test="parameterType != null and parameterType != ''">parameter_type,</if>
<if test="parameterName != null and parameterName != ''">parameter_name,</if>
<if test="parameterIdentifier != null and parameterIdentifier != ''">parameter_identifier,</if>
<if test="dataType != null and dataType != ''">data_type,</if>
<if test="dataDefinition != null">data_definition,</if>
<if test="propertyUnit != null">property_unit,</if>
<if test="propertyStep != null">property_step,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modeFunctionId != null">#{modeFunctionId},</if>
<if test="releatedParameterId != null">#{releatedParameterId},</if>
<if test="parameterType != null and parameterType != ''">#{parameterType},</if>
<if test="parameterName != null and parameterName != ''">#{parameterName},</if>
<if test="parameterIdentifier != null and parameterIdentifier != ''">#{parameterIdentifier},</if>
<if test="dataType != null and dataType != ''">#{dataType},</if>
<if test="dataDefinition != null">#{dataDefinition},</if>
<if test="propertyUnit != null">#{propertyUnit},</if>
<if test="propertyStep != null">#{propertyStep},</if>
</trim>
</insert>
<update id="updateHwDeviceModeParameter" parameterType="HwDeviceModeParameter">
update hw_device_mode_parameter
<trim prefix="SET" suffixOverrides=",">
<if test="modeFunctionId != null">mode_function_id = #{modeFunctionId},</if>
<if test="releatedParameterId != null">releated_parameter_id = #{releatedParameterId},</if>
<if test="parameterType != null and parameterType != ''">parameter_type = #{parameterType},</if>
<if test="parameterName != null and parameterName != ''">parameter_name = #{parameterName},</if>
<if test="parameterIdentifier != null and parameterIdentifier != ''">parameter_identifier = #{parameterIdentifier},</if>
<if test="dataType != null and dataType != ''">data_type = #{dataType},</if>
<if test="dataDefinition != null">data_definition = #{dataDefinition},</if>
<if test="propertyUnit != null">property_unit = #{propertyUnit},</if>
<if test="propertyStep != null">property_step = #{propertyStep},</if>
</trim>
where mode_parameter_id = #{modeParameterId}
</update>
<delete id="deleteHwDeviceModeParameterByModeParameterId" parameterType="Long">
delete from hw_device_mode_parameter where mode_parameter_id = #{modeParameterId}
</delete>
<delete id="deleteHwDeviceModeParameterByModeParameterIds" parameterType="String">
delete from hw_device_mode_parameter where mode_parameter_id in
<foreach item="modeParameterId" collection="array" open="(" separator="," close=")">
#{modeParameterId}
</foreach>
</delete>
<insert id="batchHwDeviceModeParameters">
insert into hw_device_mode_parameter( mode_function_id, parameter_type, parameter_name, parameter_identifier, data_type, data_definition, property_unit, property_step) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.modeFunctionId}, #{item.parameterType}, #{item.parameterName}, #{item.parameterIdentifier}, #{item.dataType}, #{item.dataDefinition}, #{item.propertyUnit}, #{item.propertyStep})
</foreach>
</insert>
</mapper>