<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.LGuaziOfferRecordMapper">

	<resultMap id="lGuaziOfferRecordMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.LGuaziOfferRecord">
		<id property="id" column="id"/>
		<result property="offerId" column="offer_id"/>
		<result property="content" column="content"/>
		<result property="recordFrom" column="record_from"/>
		<result property="delFlag" column="del_flag"/>
		<result property="createTime" column="create_time"/>
		<result property="createBy" column="create_by"/>
		<result property="createName" column="create_name"/>
		<result property="updateBy" column="update_by"/>
		<result property="updateTime" column="update_time"/>
	</resultMap>
	<sql id="Base_Column_List">
                a.id,
                a.offer_id,
                a.content,
                a.record_from,
                a.del_flag,
                a.create_time,
                a.create_by,
                a.create_name,
                a.update_by,
                a.update_time
    </sql>
	<sql id="lGuaziOfferRecord_where">
		<if test="lGuaziOfferRecord != null">
			<if test="lGuaziOfferRecord.id != null and lGuaziOfferRecord.id.trim() != ''">
				AND a.id = #{lGuaziOfferRecord.id}
			</if>
			<if test="lGuaziOfferRecord.offerId != null ">
				AND a.offer_id = #{lGuaziOfferRecord.offerId}
			</if>
			<if test="lGuaziOfferRecord.content != null and lGuaziOfferRecord.content.trim() != ''">
				AND a.content = #{lGuaziOfferRecord.content}
			</if>
			<if test="lGuaziOfferRecord.recordFrom != null and lGuaziOfferRecord.recordFrom.trim() != ''">
				AND a.record_from = #{lGuaziOfferRecord.recordFrom}
			</if>
			<if test="lGuaziOfferRecord.delFlag != null and lGuaziOfferRecord.delFlag.trim() != ''">
				AND a.del_flag = #{lGuaziOfferRecord.delFlag}
			</if>
			<if test="lGuaziOfferRecord.createTime != null">
				AND a.create_time = #{lGuaziOfferRecord.createTime}
			</if>
			<if test="lGuaziOfferRecord.createBy != null and lGuaziOfferRecord.createBy.trim() != ''">
				AND a.create_by = #{lGuaziOfferRecord.createBy}
			</if>
			<if test="lGuaziOfferRecord.createName != null and lGuaziOfferRecord.createName.trim() != ''">
				AND a.create_name = #{lGuaziOfferRecord.createName}
			</if>
		</if>
	</sql>
	<!--lGuaziOfferRecord简单分页查询-->
	<select id="getLGuaziOfferRecordPage" resultMap="lGuaziOfferRecordMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM l_guazi_offer_record a
		<where>
			a.del_flag = '0'
			<if test="lGuaziOfferRecord.offerId == null">
				AND a.offer_id = 0
			</if>
			<include refid="lGuaziOfferRecord_where"/>
		</where>
		ORDER by a.create_time desc,a.id desc
	</select>
</mapper>
