Files
tool-tech/tool-tech-admin/src/main/resources/mapper/DocumentCategoryMapper.xml
pan a272e06018 1、新增文档分类管理
2、新增资源管理开发
2024-08-28 17:40:03 +08:00

100 lines
5.4 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.rzdata.web.mapper.DocumentCategoryMapper">
<resultMap type="DocumentCategory" id="DocumentCategoryResult">
<result property="id" column="id" />
<result property="categoryName" column="category_name" />
<result property="categoryDescription" column="category_description" />
<result property="parentId" column="parent_id" />
<result property="createBy" column="create_by" />
<result property="createById" column="create_by_id" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateById" column="update_by_id" />
<result property="updateTime" column="update_time" />
<result property="types" column="types" />
</resultMap>
<sql id="selectDocumentCategoryVo">
select id, category_name, category_description, parent_id, create_by, create_by_id, create_time,
update_by, update_by_id, update_time, types from t_document_category
</sql>
<select id="selectDocumentCategoryList" parameterType="DocumentCategory" resultMap="DocumentCategoryResult">
<include refid="selectDocumentCategoryVo"/>
<where>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="categoryDescription != null and categoryDescription != ''"> and category_description = #{categoryDescription}</if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="createById != null and createById != ''"> and create_by_id = #{createById}</if>
<if test="updateById != null and updateById != ''"> and update_by_id = #{updateById}</if>
<if test="types != null and types != ''"> and types = #{types}</if>
</where>
</select>
<select id="selectDocumentCategoryById" parameterType="String" resultMap="DocumentCategoryResult">
<include refid="selectDocumentCategoryVo"/>
where id = #{id}
</select>
<insert id="insertDocumentCategory" parameterType="DocumentCategory">
insert into t_document_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="categoryName != null and categoryName != ''">category_name,</if>
<if test="categoryDescription != null">category_description,</if>
<if test="parentId != null">parent_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createById != null and createById != ''">create_by_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateById != null">update_by_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="types != null">types,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
<if test="categoryDescription != null">#{categoryDescription},</if>
<if test="parentId != null">#{parentId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createById != null and createById != ''">#{createById},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateById != null">#{updateById},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="types != null">#{types},</if>
</trim>
</insert>
<update id="updateDocumentCategory" parameterType="DocumentCategory">
update t_document_category
<trim prefix="SET" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
<if test="categoryDescription != null">category_description = #{categoryDescription},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createById != null and createById != ''">create_by_id = #{createById},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateById != null">update_by_id = #{updateById},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="types != null">types = #{types},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDocumentCategoryById" parameterType="String">
delete from t_document_category where id = #{id}
</delete>
<delete id="deleteDocumentCategoryByIds" parameterType="String">
delete from t_document_category where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>