Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/fileMaterialCenter/FileMaterialMapper.xml
T

74 lines
2.7 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.adc.da.slrs.fileMaterialCenter.dao.FileMaterialDao">
<update id="topping">
UPDATE file_material
SET is_top = (
(
SELECT
Max(is_top)
FROM
(SELECT * FROM file_material) AS x
) + 1
)
WHERE
id = #{id}
</update>
<select id="getFileMaterialPage" resultType="com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial">
SELECT
fm.id, fm.data_type, fm.data_title, fm.data_upload_time, fm.data_explain, fm.attach_file_id, fm.click_count,
fm.is_top, fm.del_flag, fm.is_show, zd.id as treeId, zt.name as treeName
FROM
file_material fm
LEFT JOIN zl_data zd ON zd.data_id=fm.id
LEFT JOIN zl_tree zt ON zd.id=zt.id
WHERE
fm.del_flag = '0'
<if test="flieM.treeId != null and flieM.treeId != ''">
and zd.id=#{flieM.treeId}
</if>
<if test="flieM.treeIdList != null">
and zd.id in
<foreach collection="flieM.treeIdList" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
</if>
<if test="flieM.id != null and flieM.id != ''">
and fm.id=#{flieM.id}
</if>
<if test="flieM.dataTitle != null and flieM.dataTitle != ''">
AND fm.data_title like concat('%',#{flieM.dataTitle},'%')
</if>
<if test="flieM.startDataUploadTime != null ">
AND fm.data_upload_time &gt;= #{flieM.startDataUploadTime}
</if>
<if test="flieM.endDataUploadTime != null ">
AND fm.data_upload_time &lt;= #{flieM.endDataUploadTime}
</if>
order by fm.data_upload_time desc
</select>
<select id="getFileMaterialIndex" resultType="com.adc.da.slrs.fileMaterialCenter.entity.FileMaterial">
SELECT
fm.id, fm.data_type, fm.data_title, fm.data_upload_time, fm.data_explain, fm.attach_file_id, fm.click_count,
fm.is_top, fm.del_flag, fm.is_show, zd.id as treeId, zt.name as treeName
FROM
file_material fm
LEFT JOIN zl_data zd ON zd.data_id=fm.id
LEFT JOIN zl_tree zt ON zd.id=zt.id
WHERE
fm.del_flag = '0'
<if test="treeIdList != null">
and zd.id in
<foreach collection="treeIdList" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
</if>
group by fm.id
order by fm.data_upload_time desc
limit 0,10
</select>
</mapper>