<?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.api.manage.dao.operationManagement.SysElectronicCommerceCategoryDao">

    <select id="list" parameterType="com.api.model.operationManagement.SearchElectronicCommerceCategory" resultType="com.api.vo.operationManagement.VoElectronicCommerceCategory">
        select secc.id,secc.code,secc.name,su.actual_name as create_name,secc.create_date
        from sys_electronic_commerce_category as secc,sys_user as su
        <where>
            secc.create_id = su.id
            <if test="code != null and code != ''">
                and secc.code like concat('%',#{code},'%')
            </if>
            <if test="name != null and name != ''">
                and secc.name like concat('%',#{name},'%')
            </if>
            <if test="createName != null and createName != ''">
                and su.actual_name like concat('%',#{createName},'%')
            </if>
        </where>
        order by secc.create_date DESC
    </select>

    <insert id="insert" parameterType="com.api.model.operationManagement.SysElectronicCommerceCategory">
        insert into sys_electronic_commerce_category(
            code,
            name,
            create_id,
            create_date
        )values (
            #{code},
            #{name},
            #{createId},
            #{createDate}
        )
    </insert>

    <select id="findById" resultType="com.api.vo.operationManagement.VoElectronicCommerceCategory">
        select secc.id,secc.code,secc.name,su.actual_name as create_name,secc.create_date
        from sys_electronic_commerce_category as secc,sys_user as su
        where secc.create_id = su.id and secc.id = #{id}
    </select>

    <update id="update" parameterType="com.api.model.operationManagement.SysElectronicCommerceCategory">
        update sys_electronic_commerce_category
        set name = #{name},
        modify_id = #{modifyId},
        modify_date = #{modifyDate}
        where id = #{id}
    </update>

    <delete id="delete" parameterType="java.lang.Integer">
        delete from sys_electronic_commerce_category where id = #{id}
    </delete>



</mapper>