|
|
@@ -0,0 +1,103 @@
|
|
|
+<?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="org.dromara.physical.mapper.PhysicalTagMapper">
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAllPhysicalTagsPage" resultType="org.dromara.physical.domain.vo.PhysicalTagVo">
|
|
|
+ SELECT id, name, icon_url as iconUrl, color_code as colorCode,
|
|
|
+ is_enabled as isEnabled, sort_order as sortOrder,
|
|
|
+ remark, created_at as createdAt, updated_at as updatedAt,
|
|
|
+ created_by as createdBy, updated_by as updatedBy
|
|
|
+ FROM physical_tag ${ew.customSqlSegment}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAllPhysicalTagsList" resultType="org.dromara.physical.domain.vo.PhysicalTagVo">
|
|
|
+ SELECT id, name, icon_url as iconUrl, color_code as colorCode,
|
|
|
+ is_enabled as isEnabled, sort_order as sortOrder,
|
|
|
+ remark, created_at as createdAt, updated_at as updatedAt,
|
|
|
+ created_by as createdBy, updated_by as updatedBy
|
|
|
+ FROM physical_tag ${ew.customSqlSegment}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAllPhysicalTagsById" resultType="org.dromara.physical.domain.vo.PhysicalTagVo">
|
|
|
+ SELECT id, name, icon_url as iconUrl, color_code as colorCode,
|
|
|
+ is_enabled as isEnabled, sort_order as sortOrder,
|
|
|
+ remark, created_at as createdAt, updated_at as updatedAt,
|
|
|
+ created_by as createdBy, updated_by as updatedBy
|
|
|
+ FROM physical_tag where id=#{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAllPhysicalTagsByName" resultType="org.dromara.physical.domain.vo.PhysicalTagVo">
|
|
|
+ SELECT id, name, icon_url as iconUrl, color_code as colorCode,
|
|
|
+ is_enabled as isEnabled, sort_order as sortOrder,
|
|
|
+ remark, created_at as createdAt, updated_at as updatedAt,
|
|
|
+ created_by as createdBy, updated_by as updatedBy
|
|
|
+ FROM physical_tag where name=#{name}
|
|
|
+ <if test="id != null">
|
|
|
+ and id!=#{id}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertPhysicalTag" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO physical_tag (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <if test="name != null and name.trim() != ''">name,</if>
|
|
|
+ <if test="iconUrl != null and iconUrl != ''">icon_url,</if>
|
|
|
+ <if test="colorCode != null and colorCode != ''">color_code,</if>
|
|
|
+ <if test="isEnabled != null">is_enabled,</if>
|
|
|
+ <if test="sortOrder != null">sort_order,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="createdBy != null">created_by,</if>
|
|
|
+ <if test="updatedBy != null">updated_by,</if>
|
|
|
+ created_at,
|
|
|
+ updated_at
|
|
|
+ </trim>
|
|
|
+ ) VALUES (
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <if test="name != null and name.trim() != ''">#{name},</if>
|
|
|
+ <if test="iconUrl != null and iconUrl != ''">#{iconUrl},</if>
|
|
|
+ <if test="colorCode != null and colorCode != ''">#{colorCode},</if>
|
|
|
+ <if test="isEnabled != null">#{isEnabled},</if>
|
|
|
+ <if test="sortOrder != null">#{sortOrder},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="createdBy != null">#{createdBy},</if>
|
|
|
+ <if test="updatedBy != null">#{updatedBy},</if>
|
|
|
+ NOW(),
|
|
|
+ NOW()
|
|
|
+ </trim>
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updatePhysicalTag">
|
|
|
+ UPDATE physical_tag
|
|
|
+ <set>
|
|
|
+ <if test="name != null and name.trim() != ''">name = #{name},</if>
|
|
|
+ <if test="iconUrl != null and iconUrl != ''">icon_url = #{iconUrl},</if>
|
|
|
+ <if test="colorCode != null and colorCode != ''">color_code = #{colorCode},</if>
|
|
|
+ <if test="isEnabled != null">is_enabled = #{isEnabled},</if>
|
|
|
+ <if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
|
|
+ updated_at = NOW()
|
|
|
+ </set>
|
|
|
+ WHERE id = #{id} AND id IS NOT NULL
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deletePhysicalTag">
|
|
|
+ DELETE FROM physical_tag
|
|
|
+ <where>
|
|
|
+ id IN
|
|
|
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
|
+ <if test="id > 0">
|
|
|
+ #{id}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|