lanan-system/dl-module-knowledge/src/main/resources/mapper/TArchivesMapper.xml
愉快的大福 58f3d3d4a3 知识模块
2024-08-12 21:27:02 +08:00

193 lines
8.2 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="cn.iocoder.yudao.module.knowledge.mapper.TArchivesMapper">
<select id="selectTArchivesList" parameterType="cn.iocoder.yudao.module.knowledge.entity.TArchives"
resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select
base.id,base.parent_id,base.orders,base.code,base.original_filename,base.cur_filename,base.file_url,base.file_size,base.is_dir,base.deleted,base.is_recycled,base.type,base.creator,base.creator_id,base.create_time,base.update_time,base.dept_id,base.identity_id
from t_archives base
<if test=" param.isRecycled == '0'.toString()">
LEFT JOIN t_archives par on par.id = base.parent_id
</if>
<where>
base.deleted = 0
<choose>
<when test="param.parentId!=null">
and base.parent_id = #{param.parentId}
</when>
<otherwise>
<choose>
<when test="param.isRecycled == '0'.toString()">
and ( base.parent_id is null or par.is_recycled='1')
</when>
<otherwise>
and base.parent_id is null
</otherwise>
</choose>
</otherwise>
</choose>
<if test="param.type!=null and param.type!=''">
and (base.type = #{param.type} or base.type = 0)
</if>
<if test="param.originalFilename!=null and param.originalFilename!=''">
and base.cur_filename like concat('%', #{param.originalFilename},'%')
</if>
and base.is_recycled = #{param.isRecycled}
order by base.orders desc,base.is_dir,base.create_time desc
</where>
</select>
<select id="selectTArchivesListOfName" parameterType="cn.iocoder.yudao.module.knowledge.entity.TArchives"
resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select
base.id,base.parent_id,base.orders,base.code,base.original_filename,base.cur_filename,base.file_url,base.file_size,base.is_dir,base.deleted,base.is_recycled,base.type,base.creator,base.creator_id,base.create_time,base.update_time,base.dept_id,base.identity_id
from t_archives base
<where>
base.deleted = 0
<if test="param.type!=null and param.type!=''">
and (base.type = #{param.type} or base.type = 0)
</if>
<if test="param.originalFilename!=null and param.originalFilename!=''">
and base.cur_filename like concat('%', #{param.originalFilename},'%')
</if>
<if test="param.code!=null and param.code!=''">
and base.code like concat(#{param.code},'%')
</if>
and base.is_recycled = #{param.isRecycled}
order by base.orders desc, base.is_dir,base.create_time desc
</where>
</select>
<select id="findAllDoc" parameterType="cn.iocoder.yudao.module.knowledge.entity.TArchives"
resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select
base.id,base.parent_id,base.code,base.original_filename,base.cur_filename,base.file_url,base.file_size,base.is_dir,base.deleted,base.is_recycled,base.type,base.creator,base.creator_id,base.create_time,base.update_time,base.dept_id,base.identity_id
from t_archives base
<where>
base.is_dir = 1
and base.deleted = 0
<if test="param.originalFilename!=null and param.originalFilename!=''">
and base.original_filename like concat('%', #{param.originalFilename},'%')
</if>
<if test="param.parentId!=null and param.parentId!=''">
and base.code like concat('%',#{param.parentId},'%')
</if>
and base.is_recycled = '1'
order by base.is_dir,base.create_time desc
</where>
</select>
<select id="getParByCode" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
where is_dir = 0
and #{code} like concat(code, '%')
</select>
<select id="selectByCondition" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
<if test="param.parentId != null ">and parent_id = #{param.parentId}</if>
<if test="param.curFilename != null ">and cur_filename = #{param.curFilename}</if>
<if test="param.code != null ">and code = #{param.code}</if>
</where>
</select>
<select id="selectOnleByCondition" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
deleted = 0 and is_recycled = 1
and parent_id = #{param.parentId}
<if test="param.curFilename != null ">and cur_filename = #{param.curFilename}</if>
</where>
order by create_time desc
limit 1
</select>
<select id="selectOneByCondition" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
deleted = 0
and parent_id = #{param.parentId}
<if test="param.curFilename != null ">and cur_filename = #{param.curFilename}</if>
<if test="param.originalFilename != null ">and original_filename = #{param.originalFilename}</if>
<if test="param.type != null ">and type = #{param.type}</if>
</where>
order by create_time desc
limit 1
</select>
<select id="selectOnleByConditionDir" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
deleted = 0 and is_recycled = 1
and parent_id IS NULL
<if test="param.curFilename != null ">and cur_filename = #{param.curFilename}</if>
<if test="param.type != null ">and type = #{param.type}</if>
</where>
</select>
<select id="findAllDocList" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
deleted = 0
and is_dir =1
<if test="param.curFilename != null ">and cur_filename like concat('%',#{param.curFilename},'%') </if>
<if test="param.originalFilename != null ">and original_filename like concat('%',#{param.originalFilename},'%')</if>
</where>
</select>
<select id="selectByCode" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
<if test="code != null ">and code = #{code}</if>
</where>
</select>
<select id="getParentId" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
<if test="id != null ">and id = #{id}</if>
</where>
</select>
<select id="selectOneByCode" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
<where>
is_dir ='1' and deleted='0'
<if test="code != null and code!='' ">and code like concat(#{code},'%')</if>
</where>
order by create_time desc
</select>
<select id="selectByArchivId" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
where parent_id = (select id from t_archives where parent_id = #{parentId} and cur_filename = '归档')
and cur_filename = '2024'
</select>
<select id="selectByArchivParentId" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select * from t_archives where parent_id = #{parentId} and cur_filename = '归档'
</select>
<select id="appFindByParentId" resultType="cn.iocoder.yudao.module.knowledge.entity.TArchives">
select *
from t_archives
where
deleted = 0
and type =#{param.type}
and parent_id = #{param.parentId}
</select>
</mapper>