模板管理优化

This commit is contained in:
18792927508
2024-02-06 10:54:39 +08:00
parent c7149351bc
commit d73e891c3c
12 changed files with 385 additions and 106 deletions
@@ -126,8 +126,8 @@
</where>
</update>
<select id="selectById" resultType="java.lang.String">
SELECT identify_name identifyName
FROM ms_dept_identify where id=#{id}
</select>
</mapper>
@@ -6,36 +6,26 @@
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" id="TemplateManageResult">
<id property="id" column="id" />
<result property="identifyId" column="identify_id" />
<result property="fileId" column="file_id" />
<result property="temName" column="tem_name" />
<result property="temType" column="tem_type" />
<result property="temFormat" column="tem_format" />
<result property="temOrigPath" column="tem_orig_path" />
<result property="temRevisPath" column="tem_revis_path" />
<result property="delFlag" column="del_flag" />
<result property="fileName" column="file_name" />
</resultMap>
<insert id="insertTemplateManage" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" useGeneratedKeys="true" keyProperty="id">
insert into ms_template_manage(
<if test="identifyId != null">identify_id,</if>
<if test="temName != null and temName != ''">tem_name,</if>
<if test="temType != null">tem_type,</if>
<if test="temFormat != null and temFormat != '' ">tem_format,</if>
<if test="temOrigPath != null and temOrigPath != '' ">tem_orig_path,</if>
<if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path,</if>
<if test="createBy != null and createBy != '' ">create_by,</if>
<if test="fileName != null and fileName != '' ">file_name,</if>
del_flag,create_time
identify_id,
tem_name,
create_by,
create_time
)values(
<if test="identifyId != null">#{identifyId},</if>
<if test="temName != null and temName != ''">#{temName},</if>
<if test="temType != null">#{temType},</if>
<if test="temFormat != null and temFormat != ''">#{temFormat},</if>
<if test="temOrigPath != null and temOrigPath != ''">#{temOrigPath},</if>
<if test="temRevisPath != null and temRevisPath != ''">#{temRevisPath},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
0,sysdate()
#{identifyId},
#{temName},
#{createBy},
sysdate()
)
</insert>
@@ -44,13 +34,7 @@
<set>
<if test="identifyId != null">identify_id = #{identifyId},</if>
<if test="temName != null and temName != ''">tem_name = #{temName},</if>
<if test="temType != null">tem_type = #{temType},</if>
<if test="temFormat != null and temFormat != '' ">tem_format = #{temFormat},</if>
<if test="temOrigPath != null and temOrigPath != ''">tem_orig_path = #{temOrigPath},</if>
<if test="delFlag != null ">del_flag = #{delFlag},</if>
<if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path = #{temRevisPath},</if>
<if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
<if test="fileName != null and fileName != '' ">file_name = #{fileName},</if>
update_time = sysdate()
</set>
<where>
@@ -62,7 +46,7 @@
</update>
<select id="selectTemplateList" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" resultMap="TemplateManageResult">
SELECT id, identify_id ,tem_name , tem_type,tem_format,tem_orig_path,tem_revis_path ,file_name
SELECT id, identify_id ,tem_name
FROM ms_template_manage
<where>
<if test="id != null">
@@ -77,7 +61,6 @@
<if test="temType != null ">
AND tem_type = #{temType}
</if>
AND del_flag =0
</where>
ORDER BY create_time DESC
</select>
@@ -89,4 +72,82 @@
<select id="selectByType" resultMap="TemplateManageResult">
select * from ms_template_manage where tem_type=#{type}
</select>
<update id="updateByIds">
update ms_template_manage
<set>
<if test="identifyId != null">identify_id = #{identifyId},</if>
<if test="temName != null and temName != ''">tem_name = #{temName},</if>
<if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where id in
<foreach collection="annexIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<insert id="insertTemplateManageFile" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage" useGeneratedKeys="true" keyProperty="fileId">
insert into ms_template_manage_file(
template_manage_id,
tem_type,
tem_format,
tem_orig_path,
file_name
)values(
#{id},
#{temType},
#{temFormat},
#{temOrigPath},
#{fileName}
)
</insert>
<delete id="deleteTemplateManage">
delete from ms_template_manage where id = #{id};
delete from ms_template_manage_file where template_manage_id = #{id};
</delete>
<update id="updateFileByIds">
update ms_template_manage_file
set template_manage_id=#{manage.id}
where file_id in
<foreach collection="manage.annexIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteTemplateManageFileById">
delete from ms_template_manage_file where template_manage_id = #{id} and file_id not in
<foreach collection="fileIds" item="it" open="(" separator="," close=")">
#{it}
</foreach>
;
</delete>
<select id="selectByIdAndType" resultMap="TemplateManageResult">
select f.* from ms_template_manage m join ms_template_manage_file f on m.id=f.template_manage_id
where f.template_manage_id=#{templateId} and f.tem_type=#{type} oeder by f.file_id desc limit 1
</select>
<select id="selectFileById" resultMap="TemplateManageResult">
select f.* from ms_template_manage_file f
where f.id=#{fileId}
</select>
<select id="selectTemplateListById" resultMap="TemplateManageResult">
select m.* ,f.* from ms_template_manage m join ms_template_manage_file f on m.id=f.template_manage_id
where m.id=#{id}
</select>
</mapper>