2024-11-08 15:03:37 +08:00
|
|
|
<?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">
|
2024-11-09 17:11:58 +08:00
|
|
|
<mapper namespace="com.ruoyi.system.mapper.EAccessoryMapper">
|
2024-11-08 15:03:37 +08:00
|
|
|
|
2024-11-09 17:11:58 +08:00
|
|
|
<resultMap type="EAccessoryVO" id="RlAccessoryResult" autoMapping="true" />
|
2024-11-08 15:03:37 +08:00
|
|
|
|
|
|
|
<sql id="selectRlAccessoryVo">
|
2024-11-14 20:53:08 +08:00
|
|
|
select a.accessory_id, a.name, a.status, a.create_by, a.create_time, a.update_time, mo.model,a.merchant_id from e_accessory a
|
2024-11-08 15:03:37 +08:00
|
|
|
left join e_model_accessory ma on a.accessory_id = ma.accessory_id
|
2024-11-14 20:53:08 +08:00
|
|
|
left join e_model mo on mo.model_id = ma.model_id
|
|
|
|
left join e_user m on m.user_id = a.merchant_id
|
2024-11-08 15:03:37 +08:00
|
|
|
</sql>
|
|
|
|
|
2024-11-09 17:11:58 +08:00
|
|
|
<select id="selectRlAccessoryList" parameterType="EAccessory" resultMap="RlAccessoryResult">
|
2024-11-08 15:03:37 +08:00
|
|
|
<include refid="selectRlAccessoryVo"/>
|
|
|
|
where 1=1
|
|
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
<if test="status != null "> and status = #{status}</if>
|
|
|
|
${params.dataScope}
|
|
|
|
GROUP BY
|
|
|
|
a.accessory_id
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectRlDeviceAccessoryByDeviceId" parameterType="Long" resultMap="RlAccessoryResult">
|
|
|
|
select
|
|
|
|
a.accessory_id,
|
|
|
|
a.name,
|
|
|
|
a.status,
|
|
|
|
a.create_by,
|
|
|
|
a.create_time,
|
|
|
|
a.update_time from e_accessory a
|
|
|
|
left join rl_device_accessory da on a.accessory_id = da.accessory_id
|
|
|
|
where da.device_id = #{deviceId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectRlAccessoryByAccessoryId" parameterType="Long" resultMap="RlAccessoryResult">
|
|
|
|
<include refid="selectRlAccessoryVo"/>
|
|
|
|
where a.accessory_id = #{accessoryId}
|
|
|
|
GROUP BY
|
|
|
|
a.accessory_id, a.NAME, a.STATUS, a.create_by, a.create_time, a.update_time;
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectRlAccessoryListByModelId" parameterType="Long" resultMap="RlAccessoryResult">
|
|
|
|
<include refid="selectRlAccessoryVo"/>
|
|
|
|
where ma.model_id = #{modelId}
|
|
|
|
</select>
|
|
|
|
|
2024-11-09 17:11:58 +08:00
|
|
|
<insert id="insertRlAccessory" parameterType="EAccessory">
|
2024-11-08 15:03:37 +08:00
|
|
|
insert into e_accessory
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="accessoryId != null">accessory_id,</if>
|
|
|
|
<if test="name != null">name,</if>
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
2024-11-14 20:53:08 +08:00
|
|
|
<if test="merchantId != null">merchant_id,</if>
|
2024-11-08 15:03:37 +08:00
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="accessoryId != null">#{accessoryId},</if>
|
|
|
|
<if test="name != null">#{name},</if>
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
2024-11-14 20:53:08 +08:00
|
|
|
<if test="merchantId != null">#{merchantId},</if>
|
2024-11-08 15:03:37 +08:00
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
2024-11-09 17:11:58 +08:00
|
|
|
<update id="updateRlAccessory" parameterType="EAccessory">
|
2024-11-08 15:03:37 +08:00
|
|
|
update e_accessory
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="name != null">name = #{name},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
</trim>
|
|
|
|
where accessory_id = #{accessoryId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteRlAccessoryByAccessoryId" parameterType="Long">
|
|
|
|
delete from e_accessory where accessory_id = #{accessoryId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteRlAccessoryByAccessoryIds" parameterType="String">
|
|
|
|
delete from e_accessory where accessory_id in
|
|
|
|
<foreach item="accessoryId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{accessoryId}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|