198 lines
5.0 KiB
XML
198 lines
5.0 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.hx.slj.modules.sys.dao.SysFileTemplateMagDao">
|
|
|
|
<sql id="sysFileMagColumns">
|
|
a.id AS "id",
|
|
a.create_by AS "createBy.id",
|
|
a.create_date AS "createDate",
|
|
a.update_by AS "updateBy.id",
|
|
a.update_date AS "updateDate",
|
|
a.remarks AS "remarks",
|
|
a.del_flag AS "delFlag",
|
|
a.file_cd AS "fileCd",
|
|
a.file_nm AS "fileNm",
|
|
a.file_type AS "fileType",
|
|
a.file_path AS "filePath",
|
|
a.file_ext AS "fileExt",
|
|
a.treename AS "treeName",
|
|
a.other_id AS "otherId"
|
|
/*a.check_reason AS "checkReason",
|
|
a.check_by AS "checkBy",
|
|
a.check_date AS "checkDate"*/
|
|
</sql>
|
|
|
|
<sql id="sysFileMagJoins">
|
|
</sql>
|
|
|
|
|
|
<select id="get" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
<include refid="sysFileMagJoins"/>
|
|
WHERE a.id = #{id}
|
|
</select>
|
|
<!--根据文件otherid和文件类型查询文件-->
|
|
<select id="findFileByOtherIdAndFType" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
WHERE a.other_id = #{otherId}
|
|
AND a.file_type=#{fileType}
|
|
</select>
|
|
<!--根据文件类型查询文件列表-->
|
|
<select id="findFileListByType" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
WHERE a.file_type=#{fileType}
|
|
<if test="treeName != null and treeName != ''">
|
|
AND a.treename = #{treeName}
|
|
</if>
|
|
<if test="fileNm != null and fileNm != ''">
|
|
AND a.file_nm =#{fileNm}
|
|
</if>
|
|
</select>
|
|
<!--根据文件otherid查询文件列表-->
|
|
<select id="findListByOtherId" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
WHERE a.other_id = #{otherId}
|
|
</select>
|
|
|
|
<!-- 根据treeName id查询 name -->
|
|
<!-- <select id="fingTreeNameById" resultType="String">
|
|
SELECT a.name FROM DEVTREE a WHERE a.id=#{id}
|
|
</select>-->
|
|
|
|
<select id="findList" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
<include refid="sysFileMagJoins"/>
|
|
<where>
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="fileCd != null and fileCd != ''">
|
|
AND a.file_cd LIKE
|
|
<if test="dbName == 'oracle'">'%'||#{fileCd}||'%'</if>
|
|
<if test="dbName == 'mssql'">'%'+#{fileCd}+'%'</if>
|
|
<if test="dbName == 'mysql'">concat('%',#{fileCd},'%')</if>
|
|
</if>
|
|
<if test="fileNm != null and fileNm != ''">
|
|
AND a.file_nm LIKE
|
|
<if test="dbName == 'oracle'">'%'||#{fileNm}||'%'</if>
|
|
<if test="dbName == 'mssql'">'%'+#{fileNm}+'%'</if>
|
|
<if test="dbName == 'mysql'">concat('%',#{fileNm},'%')</if>
|
|
</if>
|
|
<if test="fileType != null and fileType != ''">
|
|
AND a.file_type = #{fileType}
|
|
</if>
|
|
</where>
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.update_date DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<select id="findAllList" resultType="SysFileTempMag" >
|
|
SELECT
|
|
<include refid="sysFileMagColumns"/>
|
|
FROM sys_file_temp_mag a
|
|
<include refid="sysFileMagJoins"/>
|
|
<where>
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
</where>
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.update_date DESC
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<insert id="insert">
|
|
INSERT INTO sys_file_temp_mag(
|
|
id,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date,
|
|
remarks,
|
|
del_flag,
|
|
file_cd,
|
|
file_nm,
|
|
file_type,
|
|
file_path,
|
|
file_ext,
|
|
treename,
|
|
other_id
|
|
) VALUES (
|
|
#{id},
|
|
#{createBy.id},
|
|
#{createDate},
|
|
#{updateBy.id},
|
|
#{updateDate},
|
|
#{remarks},
|
|
#{delFlag},
|
|
#{fileCd},
|
|
#{fileNm},
|
|
#{fileType},
|
|
#{filePath},
|
|
#{fileExt},
|
|
#{treeName},
|
|
#{otherId}
|
|
)
|
|
</insert>
|
|
|
|
<update id="update">
|
|
UPDATE sys_file_temp_mag SET
|
|
update_by = #{updateBy.id},
|
|
update_date = #{updateDate},
|
|
remarks = #{remarks},
|
|
file_cd = #{fileCd},
|
|
file_nm = #{fileNm},
|
|
file_type = #{fileType},
|
|
file_path = #{filePath},
|
|
file_ext = #{fileExt},
|
|
treename=#{treeName},
|
|
other_id = #{otherId}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
|
|
<!--物理删除-->
|
|
<update id="delete">
|
|
DELETE FROM sys_file_temp_mag
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--逻辑删除-->
|
|
<update id="deleteByLogic">
|
|
UPDATE sys_file_temp_mag SET
|
|
del_flag = #{DEL_FLAG_DELETE}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
|
<select id="findUniqueByProperty" resultType="SysFileTempMag" statementType="STATEMENT">
|
|
select * FROM sys_file_temp_mag where ${propertyName} = '${value}'
|
|
</select>
|
|
<!--首页 文件下载 列表-->
|
|
<select id="findNewFile" resultType="SysFileTempMag">
|
|
select t.*
|
|
from sys_file_temp_mag t
|
|
order by t.create_date desc
|
|
</select>
|
|
|
|
|
|
</mapper> |