|
|
<?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.yohobuy.ufo.dal.brand.BrandMapper">
|
|
|
|
|
|
<resultMap id="brandMap" type="com.yohobuy.ufo.model.brand.Brand">
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="queryColumns">
|
|
|
id, brand_name, brand_name_en, brand_log, brand_search, status, create_time
|
|
|
</sql>
|
|
|
|
|
|
<insert id="insertBrand" parameterType="com.yohobuy.ufo.model.brand.Brand">
|
|
|
insert into brand(id, brand_name, brand_name_en, brand_log, brand_search, status, create_time, edit_time, edit_pid)
|
|
|
values (#{id}, #{brandName}, #{brandNameEn}, #{brandLogo}, #{brandSearch}, #{status}, #{createTime}, #{editTime}, #{editPid})
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateBrandStatus">
|
|
|
update brand set status = #{status}, edit_time = #{editTime}, edit_pid = #{editPid} where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<update id="updateBrand">
|
|
|
update brand
|
|
|
<set>
|
|
|
<if test="brand.brandName != null and brand.brandName !=''">
|
|
|
brand_name = #{brand.brandName},
|
|
|
</if>
|
|
|
<if test="brand.brandNameEn != null and brand.brandNameEn != ''">
|
|
|
brand_name_en = #{brand.brandNameEn},
|
|
|
</if>
|
|
|
<if test="brand.brandLogo != null and brand.brandLogo != ''">
|
|
|
brand_log = #{brand.brandLogo},
|
|
|
</if>
|
|
|
<if test="brand.brandSearch != null and brand.brandSearch !=''">
|
|
|
brand_search = #{brand.brandSearch},
|
|
|
</if>
|
|
|
<if test="brand.status != null and brand.status != ''">
|
|
|
status = #{brand.status},
|
|
|
</if>
|
|
|
<if test="brand.createTime != null">
|
|
|
create_time = #{brand.createTime},
|
|
|
</if>
|
|
|
<if test="brand.editTime != null">
|
|
|
edit_time = #{brand.editTime},
|
|
|
</if>
|
|
|
<if test="brand.editPid != null">
|
|
|
edit_pid = #{brand.editPid}
|
|
|
</if>
|
|
|
</set>
|
|
|
where id = #{brand.id}
|
|
|
</update>
|
|
|
|
|
|
<select id="selectOneById" resultMap="brandMap">
|
|
|
select <include refid="queryColumns" />
|
|
|
from brand where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectBrandCount" resultType="integer">
|
|
|
select count(*)
|
|
|
from brand
|
|
|
<where>
|
|
|
<if test="brand.brandName != null and brand.brandName != ''">
|
|
|
brand_name like concat('%', #{brand.brandName}, '%') or brand_name_en like concat('%', #{brand.brandName}, '%')
|
|
|
</if>
|
|
|
<if test="brand.status != null">
|
|
|
status = #{brand.status}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<select id="getBrandPageList" resultMap="brandMap">
|
|
|
select <include refid="queryColumns"/>
|
|
|
from brand
|
|
|
<where>
|
|
|
<if test="brand.brandName != null and brand.brandName != ''">
|
|
|
brand_name like concat('%', #{brand.brandName}, '%') or brand_name_en like concat('%', #{brand.brandName}, '%')
|
|
|
</if>
|
|
|
<if test="brand.status != null">
|
|
|
status = #{brand.status}
|
|
|
</if>
|
|
|
</where>
|
|
|
order by create_time desc
|
|
|
limit #{page.startIndex}, #{page.pageSize}
|
|
|
</select>
|
|
|
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|