Files
zhxg_java/srs-comprehensive/src/main/resources/mapper/comprehensive/AffixItemMapper.xml
2025-07-28 15:14:11 +08:00

73 lines
2.5 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.srs.comprehensive.mapper.AffixItemMapper">
<resultMap type="com.srs.comprehensive.domain.AffixItem" id="affixItemMap">
<result property="id" column="id"/>
<result property="affixId" column="affix_id"/>
<result property="trueName" column="true_name"/>
<result property="savePath" column="save_path"/>
<result property="fileSize" column="file_size"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="queryBy" resultMap="affixItemMap">
select * from srs_affix_item where id = #{id}
</select>
<select id="queryList" resultMap="affixItemMap">
select * from srs_affix_item
<where>
<if test='affixId != null and affixId != ""'>
and affix_id=#{affixId}
</if>
<if test='trueName != null and trueName != ""'>
and true_name like concat('%', #{trueName}, '%')
</if>
<if test='savePath != null and savePath != ""'>
and save_path like concat('%', #{savePath}, '%')
</if>
<if test="affixIds != null and affixIds.length > 0">
and affix_id in
<foreach item="id" collection="affixIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<insert id="insert" parameterType="com.srs.comprehensive.domain.AffixItem" useGeneratedKeys="true" keyProperty="id">
insert into srs_affix_item(
affix_id,
true_name,
save_path,
file_size,
create_time)
values (
#{affixId},
#{trueName},
#{savePath},
#{fileSize},
now())
</insert>
<update id="update" parameterType="com.srs.comprehensive.domain.AffixItem">
update srs_affix_item set
affix_id=#{affixId},
true_name=#{trueName},
save_path=#{savePath},
file_size=#{fileSize}
where id = #{id}
</update>
<update id="updateSavePath" parameterType="com.srs.comprehensive.domain.AffixItem">
update srs_affix_item set
save_path=#{savePath}
where id = #{id}
</update>
<delete id="delete">
delete from srs_affix_item where id=#{id}
</delete>
</mapper>