Examination_system/Examination_system-1/.svn/pristine/9b/9b75f6c375faf187e633b79fc46...

247 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.bonus.sys.dao.FileUploadInfoDao" >
<resultMap id="baseResultMap" type="com.bonus.sys.beans.FileUploadInfoBean" >
<id column="ID" property="id" jdbcType="INTEGER" />
<result column="model_id" property="model.id" jdbcType="VARCHAR" />
<result column="folder_name" property="folderName" jdbcType="VARCHAR" />
<result column="pre_name" property="preName" jdbcType="VARCHAR" />
<result column="save_name" property="saveName" jdbcType="VARCHAR" />
<result column="type" property="type.id" jdbcType="VARCHAR" />
<result column="suffix" property="suffix" jdbcType="VARCHAR" />
<result column="model_flag" property="modelFlag" jdbcType="VARCHAR" />
<result column="upload_time" property="uploadTime" jdbcType="DATE" />
<result column="temp_flag" property="tempFlag" jdbcType="INTEGER" />
<result column="IS_ACTIVE" property="isActive" jdbcType="INTEGER" />
<result column="owner_id" property="ownerId" jdbcType="INTEGER" />
<result column="user_id" property="creator.id" jdbcType="INTEGER" />
</resultMap>
<resultMap id="viewImgMap" type="com.bonus.sys.beans.ViewImgBean" >
<collection property="data" ofType="com.bonus.sys.beans.ViewImgBean">
<id column="pid" property="pid" jdbcType="INTEGER" />
<result column="preName" property="alt" jdbcType="VARCHAR" />
<result column="saveName" property="src" jdbcType="VARCHAR" />
<result column="thumb" property="thumb" jdbcType="VARCHAR" />
</collection>
</resultMap>
<!-- 门户网站专用 -->
<select id="findImgByOwnerIdOfAudit" resultMap="viewImgMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id as pid,
pre_name AS preName,
CONCAT("/img",folder_name,"/",save_name,suffix) AS saveName,
"" AS thumb
from
file_upload_info
where
1=1
and
owner_id = #{ownerId,jdbcType=INTEGER}
and
model_flag = #{modelFlag,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="com.bonus.sys.beans.FileUploadInfoBean" >
delete from pm_organization
where ID = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertBean" keyProperty="id" useGeneratedKeys="true" parameterType="com.bonus.sys.beans.FileUploadInfoBean" >
insert into
file_upload_info (
model_id,
folder_name,
pre_name,
save_name,
model_flag,
upload_time,
<if test="type != null">
type,
</if>
<if test="suffix != null and suffix != ''">
suffix,
</if>
<if test="tempFlag != null">
temp_flag,
</if>
<if test="isActive != null">
IS_ACTIVE,
</if>
owner_id,
user_id
)
values (
#{model.id,jdbcType=INTEGER},
#{folderName,jdbcType=VARCHAR},
#{preName,jdbcType=VARCHAR},
#{saveName,jdbcType=VARCHAR},
#{modelFlag,jdbcType=VARCHAR},
#{uploadTime,jdbcType=DATE},
<if test="type != null">
#{type.id,jdbcType=INTEGER},
</if>
<if test="suffix != null and suffix != ''">
#{suffix,jdbcType=VARCHAR},
</if>
<if test="tempFlag != null">
#{tempFlag,jdbcType=INTEGER},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
#{ownerId,jdbcType=INTEGER},
#{creator.id,jdbcType=INTEGER}
)
</insert>
<select id="findByFileId" resultMap="baseResultMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id,
model_id,
folder_name,
pre_name,
type,
suffix,
save_name,
model_flag,
upload_time,
temp_flag,
IS_ACTIVE,
owner_id,
user_id
from
file_upload_info
where
id = #{id}
</select>
<select id="findByFileModelFlag" resultMap="baseResultMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id,
model_id,
folder_name,
pre_name,
type,
suffix,
save_name,
model_flag,
upload_time,
temp_flag,
IS_ACTIVE,
owner_id,
user_id
from
file_upload_info
where
model_flag = #{modelFlag}
</select>
<select id="findListByOwnerId" resultMap="baseResultMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id,
model_id,
folder_name,
pre_name,
type,
suffix,
save_name,
model_flag,
upload_time,
temp_flag,
IS_ACTIVE,
owner_id,
user_id
from
file_upload_info
where
1 = 1
and
owner_id = #{ownerId}
and
model_flag = #{modelFlag}
</select>
<!-- 门户网站专用 -->
<select id="findListByOwnerIdOfPortal" resultMap="baseResultMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id,
model_id,
folder_name,
pre_name,
save_name,
type,
suffix,
model_flag,
upload_time,
temp_flag,
IS_ACTIVE,
owner_id,
user_id
from
file_upload_info
where
1 = 1
and owner_id = #{ownerId}
and model_flag = #{modelFlag}
and temp_flag = #{tempFlag}
</select>
<delete id="deleteByid" parameterType="com.bonus.sys.beans.FileUploadInfoBean" >
delete
from
file_upload_info
where
id = #{id}
and
owner_id = #{ownerId}
and
model_flag = #{modelFlag}
<if test="tempFlag != null">
and temp_flag = #{tempFlag}
</if>
</delete>
<delete id="deleteByFileId" parameterType="com.bonus.sys.beans.FileUploadInfoBean" >
delete from
file_upload_info
where
id = #{id}
</delete>
<select id="findByOwnerId" resultMap="baseResultMap" parameterType="com.bonus.sys.beans.FileUploadInfoBean">
select
id,
model_id,
folder_name,
pre_name,
type,
suffix,
save_name,
model_flag,
upload_time,
temp_flag,
IS_ACTIVE,
owner_id,
user_id
from
file_upload_info
where
1 = 1 and del_flag=0
and
owner_id = #{ownerId}
and
model_flag = #{modelFlag}
ORDER BY id
LIMIT 1
</select>
<update id="updateOwnerId" parameterType="com.bonus.sys.beans.FileUploadInfoBean" >
UPDATE file_upload_info set owner_id = #{param.ownerId}
<where>
id IN
<foreach item="ids" index="index" collection="param1.idss" open="(" separator="," close=")">
#{ids}
</foreach>
</where>
</update>
</mapper>