emis-service/emis-biz/src/main/resources/mapper/EmisBrandMapper.xml

144 lines
8.5 KiB
XML
Raw Normal View History

2023-12-14 13:08:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2024-04-18 09:26:43 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2023-12-14 13:08:36 +00:00
<mapper namespace="com.xdadan.erp.emis.mapper.EmisBrandMapper">
2024-04-18 09:26:43 +00:00
2024-05-11 10:57:59 +00:00
2024-06-02 01:10:24 +00:00
<resultMap type="EmisBrand" id="EmisBrandResult" extends="com.xdadan.erp.emis.mapper.EmisBaseResult">
2023-12-14 13:08:36 +00:00
<result property="id" column="id" />
2024-04-18 09:26:43 +00:00
<result property="code" column="code" />
2023-12-14 13:08:36 +00:00
<result property="name" column="name" />
<result property="nameEn" column="name_en" />
<result property="logo" column="logo" />
<result property="url" column="url" />
<result property="status" column="status" />
<result property="brandImg" column="brand_img" />
2024-05-11 10:57:59 +00:00
<result property="orderNum" column="order_num" />
2024-06-02 01:10:24 +00:00
<!-- <result property="remark" column="remark" />-->
<!-- <result property="tenantId" column="tenant_id" />-->
<!-- <result property="delFlag" column="del_flag" />-->
<!-- <result property="createBy" column="create_by" />-->
<!-- <result property="createTime" column="create_time" />-->
<!-- <result property="updateBy" column="update_by" />-->
<!-- <result property="updateTime" column="update_time" />-->
<!-- <result property="createSite" column="create_site" />-->
<!-- <result property="updateSite" column="update_site" />-->
2023-12-14 13:08:36 +00:00
</resultMap>
<sql id="selectEmisBrandVo">
2024-05-11 10:57:59 +00:00
select id, code, name, name_en, logo, url, status, brand_img, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_brand
2023-12-14 13:08:36 +00:00
</sql>
<select id="selectEmisBrandList" parameterType="EmisBrand" resultMap="EmisBrandResult">
<include refid="selectEmisBrandVo"/>
2024-04-18 09:26:43 +00:00
<where>
2024-05-11 11:16:05 +00:00
del_flag = '0'
2023-12-14 13:08:36 +00:00
<if test="id != null "> and id = #{id}</if>
2024-05-11 10:57:59 +00:00
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
2023-12-14 13:08:36 +00:00
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
<if test="logo != null and logo != ''"> and logo like concat('%', #{logo}, '%')</if>
<if test="url != null and url != ''"> and url like concat('%', #{url}, '%')</if>
<if test="status != null "> and status = #{status}</if>
<if test="brandImg != null and brandImg != ''"> and brand_img like concat('%', #{brandImg}, '%')</if>
2024-05-11 10:57:59 +00:00
<if test="orderNum != null "> and order_num = #{orderNum}</if>
2023-12-14 13:08:36 +00:00
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
2024-05-11 10:57:59 +00:00
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
2023-12-14 13:08:36 +00:00
</where>
order by create_time desc
</select>
2024-04-18 09:26:43 +00:00
2023-12-14 13:08:36 +00:00
<select id="selectEmisBrandById" parameterType="Long" resultMap="EmisBrandResult">
2024-05-11 10:57:59 +00:00
select id, code, name, name_en, logo, url, status, brand_img, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2023-12-14 13:08:36 +00:00
from emis_brand a
where a.id = #{id}
</select>
2024-04-18 09:26:43 +00:00
2023-12-14 13:08:36 +00:00
<insert id="insertEmisBrand" parameterType="EmisBrand">
insert into emis_brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
2024-04-18 09:26:43 +00:00
<if test="code != null and code != ''">code,</if>
2023-12-14 13:08:36 +00:00
<if test="name != null and name != ''">name,</if>
<if test="nameEn != null and nameEn != ''">name_en,</if>
<if test="logo != null and logo != ''">logo,</if>
<if test="url != null and url != ''">url,</if>
<if test="status != null">status,</if>
<if test="brandImg != null and brandImg != ''">brand_img,</if>
2024-05-11 10:57:59 +00:00
<if test="orderNum != null">order_num,</if>
2023-12-14 13:08:36 +00:00
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
2024-05-11 10:57:59 +00:00
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
2024-04-18 09:26:43 +00:00
</trim>
2023-12-14 13:08:36 +00:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
2024-04-18 09:26:43 +00:00
<if test="code != null and code != ''">#{code},</if>
2023-12-14 13:08:36 +00:00
<if test="name != null and name != ''">#{name},</if>
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
<if test="logo != null and logo != ''">#{logo},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="status != null">#{status},</if>
<if test="brandImg != null and brandImg != ''">#{brandImg},</if>
2024-05-11 10:57:59 +00:00
<if test="orderNum != null">#{orderNum},</if>
2023-12-14 13:08:36 +00:00
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
2024-05-11 10:57:59 +00:00
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
2024-04-18 09:26:43 +00:00
</trim>
2023-12-14 13:08:36 +00:00
</insert>
<update id="updateEmisBrand" parameterType="EmisBrand">
update emis_brand
<trim prefix="SET" suffixOverrides=",">
2024-04-18 09:26:43 +00:00
<if test="code != null and code != ''">code = #{code},</if>
2023-12-14 13:08:36 +00:00
<if test="name != null and name != ''">name = #{name},</if>
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
<if test="logo != null and logo != ''">logo = #{logo},</if>
<if test="url != null and url != ''">url = #{url},</if>
<if test="status != null">status = #{status},</if>
<if test="brandImg != null and brandImg != ''">brand_img = #{brandImg},</if>
2024-05-11 10:57:59 +00:00
<if test="orderNum != null">order_num = #{orderNum},</if>
2023-12-14 13:08:36 +00:00
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
2024-05-11 10:57:59 +00:00
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
2023-12-14 13:08:36 +00:00
</trim>
where id = #{id}
</update>
<delete id="deleteEmisBrandById" parameterType="Long">
2024-05-11 10:57:59 +00:00
update emis_brand set del_flag='1' where id = #{id}
2023-12-14 13:08:36 +00:00
</delete>
<delete id="deleteEmisBrandByIds" parameterType="String">
2024-05-11 10:57:59 +00:00
update emis_brand set del_flag='1' where id in
2023-12-14 13:08:36 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>