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.
183 lines
8.3 KiB
XML
183 lines
8.3 KiB
XML
6 months 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.PlcDeviceModeFunctionDao">
|
||
|
|
||
|
<resultMap type="com.ruoyi.business.domain.PlcDeviceModeFunction" id="PlcDeviceModeFunctionMap">
|
||
|
<result property="modeFunctionId" column="mode_function_id" jdbcType="INTEGER"/>
|
||
|
<result property="deviceModeId" column="device_mode_id" jdbcType="INTEGER"/>
|
||
|
<result property="functionName" column="function_name" jdbcType="VARCHAR"/>
|
||
|
<result property="functionIdentifier" column="function_identifier" jdbcType="VARCHAR"/>
|
||
|
<result property="dataType" column="data_type" jdbcType="INTEGER"/>
|
||
|
<result property="dataDefinition" column="data_definition" jdbcType="VARCHAR"/>
|
||
|
<result property="propertyUnit" column="property_unit" jdbcType="VARCHAR"/>
|
||
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||
|
<result property="functionMode" column="function_mode" jdbcType="VARCHAR"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!--查询单个-->
|
||
|
<select id="queryById" resultMap="PlcDeviceModeFunctionMap">
|
||
|
select
|
||
|
mode_function_id, device_mode_id, function_name, function_identifier, data_type, data_definition, property_unit, remark,function_mode
|
||
|
from plc_device_mode_function
|
||
|
where mode_function_id = #{modeFunctionId}
|
||
|
</select>
|
||
|
|
||
|
<!--查询指定行数据-->
|
||
|
<select id="queryAllByLimit" resultMap="PlcDeviceModeFunctionMap">
|
||
|
select
|
||
|
mode_function_id, device_mode_id, function_name, function_identifier, data_type, data_definition, property_unit, remark
|
||
|
from plc_device_mode_function
|
||
|
<where>
|
||
|
<if test="modeFunctionId != null">
|
||
|
and mode_function_id = #{modeFunctionId}
|
||
|
</if>
|
||
|
<if test="deviceModeId != null">
|
||
|
and device_mode_id = #{deviceModeId}
|
||
|
</if>
|
||
|
<if test="functionName != null and functionName != ''">
|
||
|
and function_name = #{functionName}
|
||
|
</if>
|
||
|
<if test="functionIdentifier != null and functionIdentifier != ''">
|
||
|
and function_identifier = #{functionIdentifier}
|
||
|
</if>
|
||
|
<if test="dataType != null">
|
||
|
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="remark != null and remark != ''">
|
||
|
and remark = #{remark}
|
||
|
</if>
|
||
|
</where>
|
||
|
limit #{pageable.offset}, #{pageable.pageSize}
|
||
|
</select>
|
||
|
|
||
|
<!--统计总行数-->
|
||
|
<select id="count" resultType="java.lang.Long">
|
||
|
select count(1)
|
||
|
from plc_device_mode_function
|
||
|
<where>
|
||
|
<if test="modeFunctionId != null">
|
||
|
and mode_function_id = #{modeFunctionId}
|
||
|
</if>
|
||
|
<if test="deviceModeId != null">
|
||
|
and device_mode_id = #{deviceModeId}
|
||
|
</if>
|
||
|
<if test="functionName != null and functionName != ''">
|
||
|
and function_name = #{functionName}
|
||
|
</if>
|
||
|
<if test="functionIdentifier != null and functionIdentifier != ''">
|
||
|
and function_identifier = #{functionIdentifier}
|
||
|
</if>
|
||
|
<if test="dataType != null">
|
||
|
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="remark != null and remark != ''">
|
||
|
and remark = #{remark}
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
<select id="selectFunctions" resultType="com.ruoyi.business.domain.PlcDeviceModeFunction"
|
||
|
parameterType="java.lang.Long">
|
||
|
SELECT
|
||
|
x.*
|
||
|
FROM
|
||
|
`hwsaas-cloud`.plc_device_mode_function x
|
||
|
WHERE
|
||
|
x.device_mode_id = #{deviceModeId}
|
||
|
</select>
|
||
|
<select id="selectFunctionList" resultType="com.ruoyi.business.domain.PlcDeviceModeFunction"
|
||
|
parameterType="java.lang.Long">
|
||
|
select * from plc_device_mode_function where device_mode_id = #{deviceModeId}
|
||
|
</select>
|
||
|
<select id="selectHwDeviceModeFunctionList" resultType="com.ruoyi.business.domain.HwDeviceModeFunction"
|
||
|
parameterType="com.ruoyi.business.domain.HwDeviceModeFunction">
|
||
|
select * from plc_device_mode_function where device_mode_id = #{deviceModeId}
|
||
|
</select>
|
||
|
|
||
|
<!--新增所有列-->
|
||
|
<insert id="insert" keyProperty="modeFunctionId" useGeneratedKeys="true">
|
||
|
insert into plc_device_mode_function(device_mode_id, function_name, function_identifier, data_type, data_definition, property_unit, remark,function_mode)
|
||
|
values (#{deviceModeId}, #{functionName}, #{functionIdentifier}, #{dataType}, #{dataDefinition}, #{propertyUnit}, #{remark},#{functionMode})
|
||
|
</insert>
|
||
|
|
||
|
<insert id="insertBatch" keyProperty="modeFunctionId" useGeneratedKeys="true">
|
||
|
insert into plc_device_mode_function(device_mode_id, function_name, function_identifier, data_type, data_definition, property_unit, remark,function_mode)
|
||
|
values
|
||
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
(#{entity.deviceModeId}, #{entity.functionName}, #{entity.functionIdentifier}, #{entity.dataType}, #{entity.dataDefinition}, #{entity.propertyUnit}, #{entity.remark},#{entity.functionMode})
|
||
|
</foreach>
|
||
|
</insert>
|
||
|
|
||
|
<insert id="insertOrUpdateBatch" keyProperty="modeFunctionId" useGeneratedKeys="true">
|
||
|
insert into plc_device_mode_function(device_mode_id, function_name, function_identifier, data_type, data_definition, property_unit, remark)
|
||
|
values
|
||
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
(#{entity.deviceModeId}, #{entity.functionName}, #{entity.functionIdentifier}, #{entity.dataType}, #{entity.dataDefinition}, #{entity.propertyUnit}, #{entity.remark})
|
||
|
</foreach>
|
||
|
on duplicate key update
|
||
|
device_mode_id = values(device_mode_id),
|
||
|
function_name = values(function_name),
|
||
|
function_identifier = values(function_identifier),
|
||
|
data_type = values(data_type),
|
||
|
data_definition = values(data_definition),
|
||
|
property_unit = values(property_unit),
|
||
|
remark = values(remark)
|
||
|
</insert>
|
||
|
|
||
|
<!--通过主键修改数据-->
|
||
|
<update id="update">
|
||
|
update plc_device_mode_function
|
||
|
<set>
|
||
|
<if test="deviceModeId != null">
|
||
|
device_mode_id = #{deviceModeId},
|
||
|
</if>
|
||
|
<if test="functionName != null and functionName != ''">
|
||
|
function_name = #{functionName},
|
||
|
</if>
|
||
|
<if test="functionIdentifier != null and functionIdentifier != ''">
|
||
|
function_identifier = #{functionIdentifier},
|
||
|
</if>
|
||
|
<if test="dataType != null">
|
||
|
data_type = #{dataType},
|
||
|
</if>
|
||
|
<if test="dataDefinition != null and dataDefinition != ''">
|
||
|
data_definition = #{dataDefinition},
|
||
|
</if>
|
||
|
<if test="propertyUnit != null and propertyUnit != ''">
|
||
|
property_unit = #{propertyUnit},
|
||
|
</if>
|
||
|
<if test="remark != null and remark != ''">
|
||
|
remark = #{remark},
|
||
|
</if>
|
||
|
</set>
|
||
|
where mode_function_id = #{modeFunctionId}
|
||
|
</update>
|
||
|
|
||
|
<!--通过主键删除-->
|
||
|
<delete id="deleteById">
|
||
|
delete from plc_device_mode_function where mode_function_id = #{modeFunctionId}
|
||
|
</delete>
|
||
|
<delete id="deleteHwDeviceModeParameterByModeFunctionId" parameterType="java.lang.Long">
|
||
|
|
||
|
</delete>
|
||
|
<delete id="deleteHwDeviceModeFunctionByDeviceModeIds">
|
||
|
delete from plc_device_mode_function where device_mode_id in
|
||
|
<foreach item="deviceModeId" collection="array" open="(" separator="," close=")">
|
||
|
#{deviceModeId}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
</mapper>
|
||
|
|