Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmFileInfoMapper.xml

92 lines
4.2 KiB
XML
Raw Normal View History

2024-09-26 16:15:51 +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">
<mapper namespace="com.bonus.material.basic.mapper.BmFileInfoMapper">
<resultMap type="com.bonus.material.basic.domain.BmFileInfo" id="BmFileInfoResult">
<result property="id" column="id" />
2024-11-05 11:04:02 +08:00
<result property="taskType" column="task_type" />
2024-09-26 16:15:51 +08:00
<result property="modelId" column="model_id" />
2024-10-30 09:41:25 +08:00
<result property="name" column="name" />
<result property="url" column="url" />
2024-11-05 11:04:02 +08:00
<result property="fileType" column="file_type" />
2024-09-26 16:15:51 +08:00
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectBmFileInfoVo">
2024-11-06 14:54:42 +08:00
select id, task_type, model_id, name, url, file_type, create_by, create_time from bm_file_info
2024-09-26 16:15:51 +08:00
</sql>
<select id="selectBmFileInfoList" parameterType="com.bonus.material.basic.domain.BmFileInfo" resultMap="BmFileInfoResult">
<include refid="selectBmFileInfoVo"/>
2024-10-30 10:45:31 +08:00
<where>
2024-11-05 11:04:02 +08:00
<if test="taskType != null "> and task_type = #{taskType}</if>
2024-09-26 16:15:51 +08:00
<if test="modelId != null "> and model_id = #{modelId}</if>
2024-10-30 09:41:25 +08:00
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="url != null and url != ''"> and url = #{url}</if>
2024-11-05 11:04:02 +08:00
<if test="fileType != null "> and file_type = #{fileType}</if>
2024-09-26 16:15:51 +08:00
</where>
</select>
<select id="selectBmFileInfoById" parameterType="Long" resultMap="BmFileInfoResult">
<include refid="selectBmFileInfoVo"/>
where id = #{id}
</select>
<insert id="insertBmFileInfo" parameterType="com.bonus.material.basic.domain.BmFileInfo" useGeneratedKeys="true" keyProperty="id">
insert into bm_file_info
<trim prefix="(" suffix=")" suffixOverrides=",">
2024-11-05 11:04:02 +08:00
<if test="taskType != null">task_type,</if>
2024-09-26 16:15:51 +08:00
<if test="modelId != null">model_id,</if>
2024-10-30 09:41:25 +08:00
<if test="name != null">name,</if>
<if test="url != null">url,</if>
2024-11-05 11:04:02 +08:00
<if test="fileType != null">file_type,</if>
2024-09-26 16:15:51 +08:00
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
2024-11-05 11:04:02 +08:00
<if test="taskType != null">#{taskType},</if>
2024-09-26 16:15:51 +08:00
<if test="modelId != null">#{modelId},</if>
2024-10-30 09:41:25 +08:00
<if test="name != null">#{name},</if>
<if test="url != null">#{url},</if>
2024-11-05 11:04:02 +08:00
<if test="fileType != null">#{fileType},</if>
2024-09-26 16:15:51 +08:00
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateBmFileInfo" parameterType="com.bonus.material.basic.domain.BmFileInfo">
update bm_file_info
<trim prefix="SET" suffixOverrides=",">
2024-11-05 11:04:02 +08:00
<if test="taskType != null">task_type = #{taskType},</if>
2024-09-26 16:15:51 +08:00
<if test="modelId != null">model_id = #{modelId},</if>
2024-10-30 09:41:25 +08:00
<if test="name != null">name = #{name},</if>
<if test="url != null">url = #{url},</if>
2024-11-05 11:04:02 +08:00
<if test="fileType != null">file_type = #{fileType},</if>
2024-09-26 16:15:51 +08:00
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBmFileInfoById" parameterType="Long">
delete from bm_file_info where id = #{id}
</delete>
<delete id="deleteBmFileInfoByIds" parameterType="String">
delete from bm_file_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2024-10-30 10:45:31 +08:00
<delete id="deleteBmFileInfoByBizInfo" parameterType="com.bonus.material.basic.domain.BmFileInfo">
delete from bm_file_info
<where>
2024-11-05 11:04:02 +08:00
<if test="taskType != null "> and task_type = #{taskType}</if>
2024-10-30 10:45:31 +08:00
<if test="modelId != null "> and model_id = #{modelId}</if>
2024-11-05 11:04:02 +08:00
<if test="fileType != null "> and file_type = #{fileType}</if>
2024-10-30 10:45:31 +08:00
</where>
</delete>
2024-09-26 16:15:51 +08:00
</mapper>