<?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.yeshi.fanli.dao.mybatis.brand.BrandInfoRecordMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandInfoRecord">
|
<id column="bir_id" property="id" jdbcType="BIGINT"/>
|
<result column="bir_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="bir_device" property="device" jdbcType="VARCHAR"/>
|
<result column="bir_state" property="state" jdbcType="INTEGER"/>
|
<result column="bir_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="bir_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<association column="bir_bid" property="brandInfo"
|
resultMap="com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper.BaseResultMap">
|
</association>
|
</resultMap>
|
<sql id="Base_Column_List">bir_id,bir_bid,bir_uid,bir_device,bir_state,bir_create_time,bir_update_time</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_brand_info_record where bir_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info_record where bir_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info_record (bir_id,bir_bid,bir_uid,bir_device,bir_state,bir_create_time,bir_update_time) values (#{id,jdbcType=BIGINT},#{brandInfo.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">bir_id,</if>
|
<if test="brandInfo != null">bir_bid,</if>
|
<if test="uid != null">bir_uid,</if>
|
<if test="device != null">bir_device,</if>
|
<if test="state != null">bir_state,</if>
|
<if test="createTime != null">bir_create_time,</if>
|
<if test="updateTime != null">bir_update_time,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="brandInfo != null">#{brandInfo.id,jdbcType=BIGINT},</if>
|
<if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
<if test="device != null">#{device,jdbcType=VARCHAR},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord">update yeshi_ec_brand_info_record set bir_bid = #{brandInfo.id,jdbcType=BIGINT},bir_uid = #{uid,jdbcType=BIGINT},bir_device = #{device,jdbcType=VARCHAR},bir_state = #{state,jdbcType=INTEGER},bir_create_time = #{createTime,jdbcType=TIMESTAMP},bir_update_time = #{updateTime,jdbcType=TIMESTAMP} where bir_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfoRecord">update yeshi_ec_brand_info_record
|
<set>
|
<if test="brandInfo != null">bir_bid=#{brandInfo.id,jdbcType=BIGINT},</if>
|
<if test="uid != null">bir_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="device != null">bir_device=#{device,jdbcType=VARCHAR},</if>
|
<if test="state != null">bir_state=#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">bir_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">bir_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where bir_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<update id="updateState">
|
update yeshi_ec_brand_info_record set bir_state = 1
|
where bir_bid = #{brandId}
|
<if test="uid != null">AND bir_uid = #{uid}</if>
|
<if test="device != null">AND bir_device = #{device}</if>
|
</update>
|
|
<select id="getRecord" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_brand_info_record
|
WHERE bir_bid = #{brandId}
|
<if test="uid != null">AND bir_uid = #{uid}</if>
|
<if test="device != null">AND bir_device = #{device}</if>
|
ORDER BY bir_update_time DESC
|
LIMIT 1
|
</select>
|
|
<select id="listRecord" resultMap="BaseResultMap">
|
SELECT * FROM
|
(SELECT bir_id FROM yeshi_ec_brand_info_record
|
WHERE bir_state = 0
|
<if test="uid != null">AND bir_uid = #{uid}</if>
|
<if test="device != null">AND bir_device = #{device}</if>
|
GROUP BY bir_bid)A
|
LEFT JOIN yeshi_ec_brand_info_record h on A.bir_id = h.bir_id
|
LEFT JOIN `yeshi_ec_brand_info` p ON h.`bir_bid` = p.`bf_id`
|
ORDER BY h.bir_update_time DESC
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countRecord" resultType="Long">
|
SELECT IFNULL(COUNT(DISTINCT bir_bid),0) FROM yeshi_ec_brand_info_record
|
WHERE bir_state = 0
|
<if test="uid != null">AND bir_uid = #{uid}</if>
|
<if test="device != null">AND bir_device = #{device}</if>
|
</select>
|
|
|
<select id="listValidByCidToApp" resultMap="BaseResultMap">
|
SELECT * FROM
|
(SELECT bir_id FROM yeshi_ec_brand_info_record
|
WHERE bir_state = 0
|
<if test="uid != null">AND bir_uid = #{uid}</if>
|
<if test="device != null">AND bir_device = #{device}</if>
|
GROUP BY bir_bid)A
|
LEFT JOIN yeshi_ec_brand_info_record h on A.bir_id = h.bir_id
|
LEFT JOIN `yeshi_ec_brand_info` p ON h.`bir_bid` = p.`bf_id`
|
ORDER BY h.bir_update_time DESC
|
LIMIT ${start},${count}
|
</select>
|
</mapper>
|