149 lines
6.9 KiB
XML
149 lines
6.9 KiB
XML
<?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.device.mapper.AsModelMapper">
|
|
|
|
<resultMap type="AsModel" id="AsModelResult">
|
|
<result property="modelId" column="model_id" />
|
|
<result property="classifyId" column="classify_id" />
|
|
<result property="modelName" column="model_name" />
|
|
<result property="model" column="model" />
|
|
<result property="picture" column="picture" />
|
|
<result property="idCode" column="id_code" />
|
|
<result property="classifyName" column="classify_name" />
|
|
<result property="versionId" column="version_id" />
|
|
<result property="introduce" column="introduce" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAsModelVo">
|
|
select
|
|
am.model_id,
|
|
am.classify_id,
|
|
am.model_name,
|
|
am.model,
|
|
am.picture,
|
|
am.id_code,
|
|
am.classify_name,
|
|
am.version_id,
|
|
am.introduce,
|
|
am.create_by,
|
|
am.create_time,
|
|
am.update_by,
|
|
am.update_time,
|
|
am.pre,
|
|
am.remark,
|
|
adv.version
|
|
from as_model am
|
|
left join as_device_version adv on am.version_id = adv.version_id
|
|
</sql>
|
|
|
|
<select id="selectAsModelList" parameterType="AsModel" resultMap="AsModelResult">
|
|
<include refid="selectAsModelVo"/>
|
|
<where>
|
|
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
|
|
<if test="model != null and model != ''"> and model = #{model}</if>
|
|
<if test="picture != null and picture != ''"> and picture = #{picture}</if>
|
|
<if test="idCode != null and idCode != ''"> and id_code = #{idCode}</if>
|
|
<if test="classifyName != null and classifyName != ''"> and classify_name like concat('%', #{classifyName}, '%')</if>
|
|
<if test="versionId != null "> and version_id = #{versionId}</if>
|
|
<if test="introduce != null and introduce != ''"> and introduce = #{introduce}</if>
|
|
<if test="pre != null and introduce != ''"> and pre = #{pre}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectAsModelByModelId" parameterType="Long" resultMap="AsModelResult">
|
|
<include refid="selectAsModelVo"/>
|
|
where model_id = #{modelId}
|
|
</select>
|
|
|
|
<select id="checkModelUnique" parameterType="String" resultMap="AsModelResult">
|
|
select model_id, model from as_model where model = #{model} limit 1
|
|
</select>
|
|
|
|
<select id="selectAsModelByModel" parameterType="string" resultMap="AsModelResult">
|
|
<include refid="selectAsModelVo"/>
|
|
where model = #{model}
|
|
</select>
|
|
<select id="checkModelByPre" resultType="com.ruoyi.device.domain.vo.AsModelVO">
|
|
<include refid="selectAsModelVo"/>
|
|
<where>
|
|
<if test="pre != null and pre != ''">and FIND_IN_SET (#{pre},am.pre) </if>
|
|
<if test="modelId != null and modelId != ''">and model_id != #{modelId}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="insertAsModel" parameterType="AsModel" useGeneratedKeys="true" keyProperty="modelId">
|
|
insert into as_model
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="classifyId != null">classify_id,</if>
|
|
<if test="modelName != null">model_name,</if>
|
|
<if test="model != null">model,</if>
|
|
<if test="picture != null">picture,</if>
|
|
<if test="idCode != null">id_code,</if>
|
|
<if test="classifyName != null">classify_name,</if>
|
|
<if test="versionId != null">version_id,</if>
|
|
<if test="introduce != null">introduce,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="pre != null">pre,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="classifyId != null">#{classifyId},</if>
|
|
<if test="modelName != null">#{modelName},</if>
|
|
<if test="model != null">#{model},</if>
|
|
<if test="picture != null">#{picture},</if>
|
|
<if test="idCode != null">#{idCode},</if>
|
|
<if test="classifyName != null">#{classifyName},</if>
|
|
<if test="versionId != null">#{versionId},</if>
|
|
<if test="introduce != null">#{introduce},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="pre != null">#{pre},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAsModel" parameterType="AsModel">
|
|
update as_model
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="picture != null">picture = #{picture},</if>
|
|
<if test="classifyId != null">classify_id = #{classifyId},</if>
|
|
<if test="modelName != null">model_name = #{modelName},</if>
|
|
<if test="model != null">model = #{model},</if>
|
|
<if test="idCode != null">id_code = #{idCode},</if>
|
|
<if test="classifyName != null">classify_name = #{classifyName},</if>
|
|
<if test="versionId != null">version_id = #{versionId},</if>
|
|
<if test="introduce != null">introduce = #{introduce},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="pre != null">pre = #{pre},</if>
|
|
</trim>
|
|
where model_id = #{modelId}
|
|
</update>
|
|
|
|
<delete id="deleteAsModelByModelId" parameterType="Long">
|
|
delete from as_model where model_id = #{modelId}
|
|
</delete>
|
|
|
|
<delete id="deleteAsModelByModelIds" parameterType="String">
|
|
delete from as_model where model_id in
|
|
<foreach item="modelId" collection="array" open="(" separator="," close=")">
|
|
#{modelId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|