542 lines
23 KiB
XML
542 lines
23 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.yutou.nas.mybatis.dao.MusicDataDao">
|
|
<resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.MusicData">
|
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
|
<result column="artist" jdbcType="VARCHAR" property="artist"/>
|
|
<result column="album" jdbcType="VARCHAR" property="album"/>
|
|
<result column="title" jdbcType="VARCHAR" property="title"/>
|
|
<result column="comment" jdbcType="VARCHAR" property="comment"/>
|
|
<result column="year" jdbcType="VARCHAR" property="year"/>
|
|
<result column="track" jdbcType="VARCHAR" property="track"/>
|
|
<result column="disc_no" jdbcType="VARCHAR" property="discNo"/>
|
|
<result column="composer" jdbcType="VARCHAR" property="composer"/>
|
|
<result column="artist_sort" jdbcType="VARCHAR" property="artistSort"/>
|
|
<result column="file" jdbcType="VARCHAR" property="file"/>
|
|
<result column="lastDir" jdbcType="VARCHAR" property="lastdir"/>
|
|
<result column="isDir" jdbcType="INTEGER" property="isdir"/>
|
|
<result column="bitRate" jdbcType="INTEGER" property="bitrate"/>
|
|
<result column="sampleRate" jdbcType="INTEGER" property="samplerate"/>
|
|
<result column="noOfSamples" jdbcType="BIGINT" property="noofsamples"/>
|
|
<result column="channelCount" jdbcType="INTEGER" property="channelcount"/>
|
|
<result column="encodingType" jdbcType="VARCHAR" property="encodingtype"/>
|
|
<result column="durationAsDouble" jdbcType="DOUBLE" property="durationasdouble"/>
|
|
<result column="lossless" jdbcType="INTEGER" property="lossless"/>
|
|
<result column="variableBitRate" jdbcType="INTEGER" property="variablebitrate"/>
|
|
<result column="md5" jdbcType="VARCHAR" property="md5"/>
|
|
</resultMap>
|
|
<sql id="Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Update_By_Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Base_Column_List">
|
|
id
|
|
, artist, album, title, `comment`, `year`, track, disc_no, composer, artist_sort,
|
|
`file`, lastDir, isDir, bitRate, sampleRate, noOfSamples, channelCount, encodingType,
|
|
durationAsDouble, lossless, variableBitRate, md5
|
|
</sql>
|
|
<sql id="Base_Column_ListNotFile">
|
|
id
|
|
, artist, album, title, `comment`, `year`, track, disc_no, composer, artist_sort,
|
|
isDir, bitRate, sampleRate, noOfSamples, channelCount, encodingType,
|
|
durationAsDouble, lossless, variableBitRate, md5
|
|
</sql>
|
|
<select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.MusicDataExample" resultMap="BaseResultMap">
|
|
select
|
|
|
|
<if test="isDelFile ==true">
|
|
<include refid="Base_Column_ListNotFile"/>
|
|
</if>
|
|
<if test="isDelFile != true">
|
|
<include refid="Base_Column_List"/>
|
|
</if>
|
|
from music_data
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause"/>
|
|
</if>
|
|
<if test="example.orderByClause != null">
|
|
order by ${example.orderByClause}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
|
|
<if test="isDelFile ==true">
|
|
<include refid="Base_Column_ListNotFile"/>
|
|
</if>
|
|
<if test="isDelFile != true">
|
|
<include refid="Base_Column_List"/>
|
|
</if>
|
|
from music_data
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete
|
|
from music_data
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.MusicDataExample">
|
|
delete from music_data
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause"/>
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.MusicData"
|
|
useGeneratedKeys="true">
|
|
insert into music_data (artist, album, title,
|
|
`comment`, `year`, track,
|
|
disc_no, composer, artist_sort,
|
|
`file`, lastDir, isDir,
|
|
bitRate, sampleRate, noOfSamples,
|
|
channelCount, encodingType, durationAsDouble,
|
|
lossless, variableBitRate, md5)
|
|
values (#{artist,jdbcType=VARCHAR}, #{album,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
|
|
#{comment,jdbcType=VARCHAR}, #{year,jdbcType=VARCHAR}, #{track,jdbcType=VARCHAR},
|
|
#{discNo,jdbcType=VARCHAR}, #{composer,jdbcType=VARCHAR}, #{artistSort,jdbcType=VARCHAR},
|
|
#{file,jdbcType=VARCHAR}, #{lastdir,jdbcType=VARCHAR}, #{isdir,jdbcType=INTEGER},
|
|
#{bitrate,jdbcType=INTEGER}, #{samplerate,jdbcType=INTEGER}, #{noofsamples,jdbcType=BIGINT},
|
|
#{channelcount,jdbcType=INTEGER}, #{encodingtype,jdbcType=VARCHAR}, #{durationasdouble,jdbcType=DOUBLE},
|
|
#{lossless,jdbcType=INTEGER}, #{variablebitrate,jdbcType=INTEGER}, #{md5,jdbcType=VARCHAR})
|
|
</insert>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.MusicData"
|
|
useGeneratedKeys="true">
|
|
insert into music_data
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="artist != null">
|
|
artist,
|
|
</if>
|
|
<if test="album != null">
|
|
album,
|
|
</if>
|
|
<if test="title != null">
|
|
title,
|
|
</if>
|
|
<if test="comment != null">
|
|
`comment`,
|
|
</if>
|
|
<if test="year != null">
|
|
`year`,
|
|
</if>
|
|
<if test="track != null">
|
|
track,
|
|
</if>
|
|
<if test="discNo != null">
|
|
disc_no,
|
|
</if>
|
|
<if test="composer != null">
|
|
composer,
|
|
</if>
|
|
<if test="artistSort != null">
|
|
artist_sort,
|
|
</if>
|
|
<if test="file != null">
|
|
`file`,
|
|
</if>
|
|
<if test="lastdir != null">
|
|
lastDir,
|
|
</if>
|
|
<if test="isdir != null">
|
|
isDir,
|
|
</if>
|
|
<if test="bitrate != null">
|
|
bitRate,
|
|
</if>
|
|
<if test="samplerate != null">
|
|
sampleRate,
|
|
</if>
|
|
<if test="noofsamples != null">
|
|
noOfSamples,
|
|
</if>
|
|
<if test="channelcount != null">
|
|
channelCount,
|
|
</if>
|
|
<if test="encodingtype != null">
|
|
encodingType,
|
|
</if>
|
|
<if test="durationasdouble != null">
|
|
durationAsDouble,
|
|
</if>
|
|
<if test="lossless != null">
|
|
lossless,
|
|
</if>
|
|
<if test="variablebitrate != null">
|
|
variableBitRate,
|
|
</if>
|
|
<if test="md5 != null">
|
|
md5,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="artist != null">
|
|
#{artist,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="album != null">
|
|
#{album,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="title != null">
|
|
#{title,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="comment != null">
|
|
#{comment,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="year != null">
|
|
#{year,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="track != null">
|
|
#{track,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="discNo != null">
|
|
#{discNo,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="composer != null">
|
|
#{composer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="artistSort != null">
|
|
#{artistSort,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="file != null">
|
|
#{file,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="lastdir != null">
|
|
#{lastdir,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isdir != null">
|
|
#{isdir,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="bitrate != null">
|
|
#{bitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="samplerate != null">
|
|
#{samplerate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="noofsamples != null">
|
|
#{noofsamples,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="channelcount != null">
|
|
#{channelcount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="encodingtype != null">
|
|
#{encodingtype,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="durationasdouble != null">
|
|
#{durationasdouble,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="lossless != null">
|
|
#{lossless,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="variablebitrate != null">
|
|
#{variablebitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="md5 != null">
|
|
#{md5,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="com.yutou.nas.mybatis.model.MusicDataExample"
|
|
resultType="java.lang.Long">
|
|
select count(*) from music_data
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause"/>
|
|
</if>
|
|
</select>
|
|
<select id="selectByRegexp" resultType="com.yutou.nas.mybatis.model.MusicData">
|
|
select
|
|
|
|
<if test="isDelFile ==true">
|
|
<include refid="Base_Column_ListNotFile"/>
|
|
</if>
|
|
<if test="isDelFile != true">
|
|
<include refid="Base_Column_List"/>
|
|
</if>
|
|
from music_data
|
|
where `file` REGEXP #{regexp,jdbcType=VARCHAR}
|
|
</select>
|
|
<select id="selectAllAlbum" resultType="com.yutou.nas.mybatis.model.MusicData">
|
|
SELECT album,`md5`
|
|
FROM music_data a
|
|
group by `album`;
|
|
</select>
|
|
<select id="selectAllArtist" resultType="com.yutou.nas.mybatis.model.MusicData">
|
|
SELECT artist,`md5`
|
|
FROM music_data
|
|
group by `artist`;
|
|
</select>
|
|
<select id="selectAlbum" resultType="com.yutou.nas.mybatis.model.MusicData">
|
|
select
|
|
|
|
<if test="isDelFile ==true">
|
|
<include refid="Base_Column_ListNotFile"/>
|
|
</if>
|
|
<if test="isDelFile != true">
|
|
<include refid="Base_Column_List"/>
|
|
</if>
|
|
from music_data where `album`= #{album,jdbcType=VARCHAR}
|
|
</select>
|
|
<select id="selectArtist" resultType="com.yutou.nas.mybatis.model.MusicData">
|
|
select
|
|
|
|
<if test="isDelFile ==true">
|
|
<include refid="Base_Column_ListNotFile"/>
|
|
</if>
|
|
<if test="isDelFile != true">
|
|
<include refid="Base_Column_List"/>
|
|
</if>
|
|
from music_data where `artist`= #{artist,jdbcType=VARCHAR}
|
|
</select>
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
update music_data
|
|
<set>
|
|
<if test="record.id != null">
|
|
id = #{record.id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.artist != null">
|
|
artist = #{record.artist,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.album != null">
|
|
album = #{record.album,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.title != null">
|
|
title = #{record.title,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.comment != null">
|
|
`comment` = #{record.comment,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.year != null">
|
|
`year` = #{record.year,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.track != null">
|
|
track = #{record.track,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.discNo != null">
|
|
disc_no = #{record.discNo,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.composer != null">
|
|
composer = #{record.composer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.artistSort != null">
|
|
artist_sort = #{record.artistSort,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.file != null">
|
|
`file` = #{record.file,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.lastdir != null">
|
|
lastDir = #{record.lastdir,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.isdir != null">
|
|
isDir = #{record.isdir,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.bitrate != null">
|
|
bitRate = #{record.bitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.samplerate != null">
|
|
sampleRate = #{record.samplerate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.noofsamples != null">
|
|
noOfSamples = #{record.noofsamples,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="record.channelcount != null">
|
|
channelCount = #{record.channelcount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.encodingtype != null">
|
|
encodingType = #{record.encodingtype,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.durationasdouble != null">
|
|
durationAsDouble = #{record.durationasdouble,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="record.lossless != null">
|
|
lossless = #{record.lossless,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.variablebitrate != null">
|
|
variableBitRate = #{record.variablebitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.md5 != null">
|
|
md5 = #{record.md5,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
</if>
|
|
</update>
|
|
<update id="updateByExample" parameterType="map">
|
|
update music_data
|
|
set id = #{record.id,jdbcType=INTEGER},
|
|
artist = #{record.artist,jdbcType=VARCHAR},
|
|
album = #{record.album,jdbcType=VARCHAR},
|
|
title = #{record.title,jdbcType=VARCHAR},
|
|
`comment` = #{record.comment,jdbcType=VARCHAR},
|
|
`year` = #{record.year,jdbcType=VARCHAR},
|
|
track = #{record.track,jdbcType=VARCHAR},
|
|
disc_no = #{record.discNo,jdbcType=VARCHAR},
|
|
composer = #{record.composer,jdbcType=VARCHAR},
|
|
artist_sort = #{record.artistSort,jdbcType=VARCHAR},
|
|
`file` = #{record.file,jdbcType=VARCHAR},
|
|
lastDir = #{record.lastdir,jdbcType=VARCHAR},
|
|
isDir = #{record.isdir,jdbcType=INTEGER},
|
|
bitRate = #{record.bitrate,jdbcType=INTEGER},
|
|
sampleRate = #{record.samplerate,jdbcType=INTEGER},
|
|
noOfSamples = #{record.noofsamples,jdbcType=BIGINT},
|
|
channelCount = #{record.channelcount,jdbcType=INTEGER},
|
|
encodingType = #{record.encodingtype,jdbcType=VARCHAR},
|
|
durationAsDouble = #{record.durationasdouble,jdbcType=DOUBLE},
|
|
lossless = #{record.lossless,jdbcType=INTEGER},
|
|
variableBitRate = #{record.variablebitrate,jdbcType=INTEGER},
|
|
md5 = #{record.md5,jdbcType=VARCHAR}
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
</if>
|
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.MusicData">
|
|
update music_data
|
|
<set>
|
|
<if test="artist != null">
|
|
artist = #{artist,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="album != null">
|
|
album = #{album,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="title != null">
|
|
title = #{title,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="comment != null">
|
|
`comment` = #{comment,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="year != null">
|
|
`year` = #{year,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="track != null">
|
|
track = #{track,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="discNo != null">
|
|
disc_no = #{discNo,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="composer != null">
|
|
composer = #{composer,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="artistSort != null">
|
|
artist_sort = #{artistSort,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="file != null">
|
|
`file` = #{file,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="lastdir != null">
|
|
lastDir = #{lastdir,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isdir != null">
|
|
isDir = #{isdir,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="bitrate != null">
|
|
bitRate = #{bitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="samplerate != null">
|
|
sampleRate = #{samplerate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="noofsamples != null">
|
|
noOfSamples = #{noofsamples,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="channelcount != null">
|
|
channelCount = #{channelcount,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="encodingtype != null">
|
|
encodingType = #{encodingtype,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="durationasdouble != null">
|
|
durationAsDouble = #{durationasdouble,jdbcType=DOUBLE},
|
|
</if>
|
|
<if test="lossless != null">
|
|
lossless = #{lossless,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="variablebitrate != null">
|
|
variableBitRate = #{variablebitrate,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="md5 != null">
|
|
md5 = #{md5,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.MusicData">
|
|
update music_data
|
|
set artist = #{artist,jdbcType=VARCHAR},
|
|
album = #{album,jdbcType=VARCHAR},
|
|
title = #{title,jdbcType=VARCHAR},
|
|
`comment` = #{comment,jdbcType=VARCHAR},
|
|
`year` = #{year,jdbcType=VARCHAR},
|
|
track = #{track,jdbcType=VARCHAR},
|
|
disc_no = #{discNo,jdbcType=VARCHAR},
|
|
composer = #{composer,jdbcType=VARCHAR},
|
|
artist_sort = #{artistSort,jdbcType=VARCHAR},
|
|
`file` = #{file,jdbcType=VARCHAR},
|
|
lastDir = #{lastdir,jdbcType=VARCHAR},
|
|
isDir = #{isdir,jdbcType=INTEGER},
|
|
bitRate = #{bitrate,jdbcType=INTEGER},
|
|
sampleRate = #{samplerate,jdbcType=INTEGER},
|
|
noOfSamples = #{noofsamples,jdbcType=BIGINT},
|
|
channelCount = #{channelcount,jdbcType=INTEGER},
|
|
encodingType = #{encodingtype,jdbcType=VARCHAR},
|
|
durationAsDouble = #{durationasdouble,jdbcType=DOUBLE},
|
|
lossless = #{lossless,jdbcType=INTEGER},
|
|
variableBitRate = #{variablebitrate,jdbcType=INTEGER},
|
|
md5 = #{md5,jdbcType=VARCHAR}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="truncate">
|
|
TRUNCATE `web_tools`.`music_data`;
|
|
</update>
|
|
</mapper> |