<?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.ruoyi.project.dc.securityDocuments.mapper.SecurityDocumentsMapper">
|
|
<resultMap type="com.ruoyi.project.dc.securityDocuments.domain.SecurityDocuments" id="SecurityDocumentsResult">
|
<result property="documentsId" column="documents_id" />
|
<result property="companyId" column="company_id"/>
|
<result property="createBy" column="create_by" />
|
<result property="createUserId" column="create_user_id" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateUserId" column="update_user_id" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
<result property="documentType" column="document_type" />
|
<result property="documentName" column="document_name" />
|
<result property="trialScope" column="trial_scope" />
|
<result property="ownedFile" column="owned_file" />
|
<result property="ownedPicture" column="owned_picture" />
|
<association property="securityType" column="document_type" javaType="com.ruoyi.project.dc.securityType.domain.SecurityType" resultMap="typeResult" />
|
|
</resultMap>
|
|
<resultMap id="typeResult" type="com.ruoyi.project.dc.securityType.domain.SecurityType">
|
<result property="securityTypeId" column="security_type_id" />
|
<result property="parentId" column="parent_id" />
|
<result property="ancestors" column="ancestors" />
|
<result property="typeName" column="type_name" />
|
<result property="orderNum" column="order_num" />
|
</resultMap>
|
|
<sql id="selectSecurityDocumentsVo">
|
SELECT d.documents_id,d.company_id, d.create_by, d.create_user_id, d.create_time,
|
d.update_by, d.update_user_id, d.update_time, d.remark,
|
d.document_type, d.document_name, d.trial_scope,
|
d.owned_file, d.owned_picture,
|
t.parent_id, t.ancestors, t.type_name, t.order_num
|
FROM dc_security_documents AS d
|
LEFT JOIN `dc_security_type` AS t ON d.`document_type` = t.`security_type_id`
|
</sql>
|
|
<select id="selectSecurityDocumentsList" parameterType="SecurityDocuments" resultMap="SecurityDocumentsResult">
|
<include refid="selectSecurityDocumentsVo"/>
|
<where>
|
<if test="companyId != null "> and d.company_id = #{companyId}</if>
|
<if test="createUserId != null "> and d.create_user_id = #{createUserId}</if>
|
<if test="updateUserId != null "> and d.update_user_id = #{updateUserId}</if>
|
<if test="documentType != null ">
|
AND (d.document_type = #{documentType} OR d.document_type IN ( SELECT st.security_type_id FROM dc_security_type st WHERE FIND_IN_SET (#{documentType},ancestors) ))
|
</if>
|
<if test="documentName != null and documentName != ''"> and d.document_name like concat('%', #{documentName}, '%')</if>
|
<if test="trialScope != null and trialScope != ''"> and d.trial_scope = #{trialScope}</if>
|
<if test="ownedFile != null and ownedFile != ''"> and d.owned_file = #{ownedFile}</if>
|
<if test="ownedPicture != null and ownedPicture != ''"> and d.owned_picture = #{ownedPicture}</if>
|
</where>
|
</select>
|
|
<select id="selectSecurityDocumentsById" parameterType="Long" resultMap="SecurityDocumentsResult">
|
<include refid="selectSecurityDocumentsVo"/>
|
where documents_id = #{documentsId}
|
</select>
|
|
<insert id="insertSecurityDocuments" parameterType="SecurityDocuments" useGeneratedKeys="true" keyProperty="documentsId">
|
insert into dc_security_documents
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="companyId != null ">company_id,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createUserId != null ">create_user_id,</if>
|
<if test="createTime != null ">create_time,</if>
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
<if test="updateUserId != null ">update_user_id,</if>
|
<if test="updateTime != null ">update_time,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
<if test="documentType != null ">document_type,</if>
|
<if test="documentName != null and documentName != ''">document_name,</if>
|
<if test="trialScope != null and trialScope != ''">trial_scope,</if>
|
<if test="ownedFile != null and ownedFile != ''">owned_file,</if>
|
<if test="ownedPicture != null and ownedPicture != ''">owned_picture,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="companyId != null ">#{companyId},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createUserId != null ">#{createUserId},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
<if test="updateUserId != null ">#{updateUserId},</if>
|
<if test="updateTime != null ">#{updateTime},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="documentType != null ">#{documentType},</if>
|
<if test="documentName != null and documentName != ''">#{documentName},</if>
|
<if test="trialScope != null and trialScope != ''">#{trialScope},</if>
|
<if test="ownedFile != null and ownedFile != ''">#{ownedFile},</if>
|
<if test="ownedPicture != null and ownedPicture != ''">#{ownedPicture},</if>
|
</trim>
|
</insert>
|
|
<update id="updateSecurityDocuments" parameterType="SecurityDocuments">
|
update dc_security_documents
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="companyId != null ">company_id = #{companyId},</if>
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
<if test="createUserId != null ">create_user_id = #{createUserId},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateUserId != null ">update_user_id = #{updateUserId},</if>
|
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
<if test="documentType != null ">document_type = #{documentType},</if>
|
<if test="documentName != null and documentName != ''">document_name = #{documentName},</if>
|
<if test="trialScope != null and trialScope != ''">trial_scope = #{trialScope},</if>
|
<if test="ownedFile != null and ownedFile != ''">owned_file = #{ownedFile},</if>
|
<if test="ownedPicture != null and ownedPicture != ''">owned_picture = #{ownedPicture},</if>
|
</trim>
|
where documents_id = #{documentsId}
|
</update>
|
|
<delete id="deleteSecurityDocumentsById" parameterType="Long">
|
delete from dc_security_documents where documents_id = #{documentsId}
|
</delete>
|
|
<delete id="deleteSecurityDocumentsByIds" parameterType="String">
|
delete from dc_security_documents where documents_id in
|
<foreach item="documentsId" collection="array" open="(" separator="," close=")">
|
#{documentsId}
|
</foreach>
|
</delete>
|
|
</mapper>
|