|
|
@ -1,9 +1,9 @@
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.ruoyi.traceability.mapper.BaseDeviceInfoMapper">
|
|
|
|
<mapper namespace="com.ruoyi.traceability.mapper.BaseDeviceInfoMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="BaseDeviceInfo" id="BaseDeviceInfoResult">
|
|
|
|
<resultMap type="BaseDeviceInfo" id="BaseDeviceInfoResult">
|
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
<result property="parentId" column="parent_id" />
|
|
|
|
<result property="parentId" column="parent_id" />
|
|
|
@ -16,32 +16,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
|
|
|
<result property="materialType" column="material_type" />
|
|
|
|
<result property="parentName" column="parent_name" />
|
|
|
|
<result property="parentName" column="parent_name" />
|
|
|
|
</resultMap>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="selectBaseDeviceInfoVo">
|
|
|
|
<sql id="selectBaseDeviceInfoVo">
|
|
|
|
select device_id, parent_id, device_name, order_num, resource, status, del_flag, create_by, create_time, update_by, update_time from base_deviceinfo
|
|
|
|
select device_id, parent_id, device_name, order_num, resource, status, del_flag, create_by, create_time, update_by, update_time, material_type from base_deviceinfo
|
|
|
|
</sql>
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseDeviceInfoList" parameterType="BaseDeviceInfo" resultMap="BaseDeviceInfoResult">
|
|
|
|
<select id="selectBaseDeviceInfoList" parameterType="BaseDeviceInfo" resultMap="BaseDeviceInfoResult">
|
|
|
|
<include refid="selectBaseDeviceInfoVo"/>
|
|
|
|
<include refid="selectBaseDeviceInfoVo"/>
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
|
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
|
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
|
|
|
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
|
|
|
<if test="resource != null and resource != ''"> and resource = #{resource}</if>
|
|
|
|
<if test="resource != null and resource != ''"> and resource = #{resource}</if>
|
|
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
|
|
|
|
<if test="materialType != null "> and material_type = #{materialType}</if>
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
order by parent_id
|
|
|
|
order by parent_id
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseDeviceInfoByDeviceId" parameterType="Long" resultMap="BaseDeviceInfoResult">
|
|
|
|
<select id="selectBaseDeviceInfoByDeviceId" parameterType="Long" resultMap="BaseDeviceInfoResult">
|
|
|
|
select t.device_id, t.parent_id, t.device_name, t.order_num, t.resource, t.status, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time, p.device_name as parent_name
|
|
|
|
select t.device_id, t.parent_id, t.device_name, t.order_num, t.resource, t.status, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time, t.material_type, p.device_name as parent_name
|
|
|
|
from base_deviceinfo t
|
|
|
|
from base_deviceinfo t
|
|
|
|
left join base_deviceinfo p on p.device_id = t.parent_id
|
|
|
|
left join base_deviceinfo p on p.device_id = t.parent_id
|
|
|
|
where t.device_id = #{deviceId}
|
|
|
|
where t.device_id = #{deviceId}
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertBaseDeviceInfo" parameterType="BaseDeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
|
|
|
|
<insert id="insertBaseDeviceInfo" parameterType="BaseDeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
|
|
|
|
insert into base_deviceinfo
|
|
|
|
insert into base_deviceinfo
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
@ -55,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
</trim>
|
|
|
|
<if test="materialType != null">material_type,</if>
|
|
|
|
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="parentId != null">#{parentId},</if>
|
|
|
|
<if test="parentId != null">#{parentId},</if>
|
|
|
|
<if test="deviceName != null">#{deviceName},</if>
|
|
|
|
<if test="deviceName != null">#{deviceName},</if>
|
|
|
@ -67,7 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
</trim>
|
|
|
|
<if test="materialType != null">#{materialType},</if>
|
|
|
|
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateBaseDeviceInfo" parameterType="BaseDeviceInfo">
|
|
|
|
<update id="updateBaseDeviceInfo" parameterType="BaseDeviceInfo">
|
|
|
@ -83,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
|
|
|
<if test="materialType != null">material_type = #{materialType},</if>
|
|
|
|
</trim>
|
|
|
|
</trim>
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
</update>
|
|
|
|
</update>
|
|
|
@ -92,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
</delete>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseDeviceInfoByDeviceIds" parameterType="String">
|
|
|
|
<delete id="deleteBaseDeviceInfoByDeviceIds" parameterType="String">
|
|
|
|
delete from base_deviceinfo where device_id in
|
|
|
|
delete from base_deviceinfo where device_id in
|
|
|
|
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
|
|
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{deviceId}
|
|
|
|
#{deviceId}
|
|
|
|
</foreach>
|
|
|
|
</foreach>
|
|
|
|