89 lines
4.4 KiB
XML
89 lines
4.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.ruoyi.system.mapper.CmsMaterialGroupMapper">
|
|
|
|
<resultMap type="CmsMaterialGroup" id="CmsMaterialGroupResult">
|
|
<result property="groupId" column="group_id" />
|
|
<result property="parentId" column="parent_id" />
|
|
<result property="deptId" column="dept_id" />
|
|
<result property="groupName" column="group_name" />
|
|
<result property="description" column="description" />
|
|
<result property="sort" column="sort" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectCmsMaterialGroupVo">
|
|
select group_id, parent_id, dept_id, group_name, description, sort, user_id, create_by, create_time from cms_material_group
|
|
</sql>
|
|
|
|
<select id="selectCmsMaterialGroupList" parameterType="CmsMaterialGroup" resultMap="CmsMaterialGroupResult">
|
|
<include refid="selectCmsMaterialGroupVo"/>
|
|
<where>
|
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
|
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
|
<if test="sort != null "> and sort = #{sort}</if>
|
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectCmsMaterialGroupByGroupId" parameterType="Long" resultMap="CmsMaterialGroupResult">
|
|
<include refid="selectCmsMaterialGroupVo"/>
|
|
where group_id = #{groupId}
|
|
</select>
|
|
|
|
<insert id="insertCmsMaterialGroup" parameterType="CmsMaterialGroup" useGeneratedKeys="true" keyProperty="groupId">
|
|
insert into cms_material_group
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id,</if>
|
|
<if test="deptId != null">dept_id,</if>
|
|
<if test="groupName != null">group_name,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="sort != null">sort,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">#{parentId},</if>
|
|
<if test="deptId != null">#{deptId},</if>
|
|
<if test="groupName != null">#{groupName},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="sort != null">#{sort},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateCmsMaterialGroup" parameterType="CmsMaterialGroup">
|
|
update cms_material_group
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
<if test="groupName != null">group_name = #{groupName},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where group_id = #{groupId}
|
|
</update>
|
|
|
|
<delete id="deleteCmsMaterialGroupByGroupId" parameterType="Long">
|
|
delete from cms_material_group where group_id = #{groupId}
|
|
</delete>
|
|
|
|
<delete id="deleteCmsMaterialGroupByGroupIds" parameterType="String">
|
|
delete from cms_material_group where group_id in
|
|
<foreach item="groupId" collection="array" open="(" separator="," close=")">
|
|
#{groupId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |