<?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.social.mapper.TAgentConfigMapper">

  <resultMap id="tAgentConfigMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig">
    <id property="id" column="ID"/>
    <result property="openFlag" column="OPEN_FLAG"/>
    <result property="target" column="TARGET"/>
    <result property="province" column="PROVINCE"/>
    <result property="city" column="CITY"/>
    <result property="medical" column="MEDICAL"/>
    <result property="injury" column="INJURY"/>
    <result property="bear" column="BEAR"/>
    <result property="pension" column="PENSION"/>
    <result property="unemployed" column="UNEMPLOYED"/>
    <result property="year" column="YEAR"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateTime" column="UPDATE_TIME"/>
    <result property="startMonth" column="START_MONTH"/>
    <result property="endMonth" column="END_MONTH"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.ID,
                a.OPEN_FLAG,
                a.TARGET,
                a.PROVINCE,
                a.CITY,
                a.MEDICAL,
                a.INJURY,
                a.BEAR,
                a.PENSION,
                a.UNEMPLOYED,
                a.YEAR,
                a.START_MONTH,
                a.END_MONTH,
				a.CREATE_BY,
				a.UPDATE_BY,
				a.CREATE_NAME,
				a.CREATE_TIME,
				a.UPDATE_TIME
    </sql>
    <sql id="tAgentConfig_where">
        <if test="tAgentConfig != null">
                    <if test="tAgentConfig.id != null and tAgentConfig.id.trim() != ''">
                        AND a.ID = #{tAgentConfig.id}
                    </if>
                    <if test="tAgentConfig.openFlag != null">
                        AND a.OPEN_FLAG = #{tAgentConfig.openFlag}
                    </if>
                    <if test="tAgentConfig.target != null">
                        AND a.TARGET = #{tAgentConfig.target}
                    </if>
                    <if test="tAgentConfig.province != null and tAgentConfig.province.trim() != ''">
                        AND a.PROVINCE = #{tAgentConfig.province}
                    </if>
                    <if test="tAgentConfig.city != null and tAgentConfig.city.trim() != ''">
                        AND a.CITY = #{tAgentConfig.city}
                    </if>
                    <if test="tAgentConfig.medical != null and tAgentConfig.medical.trim() != ''">
                        AND a.MEDICAL = #{tAgentConfig.medical}
                    </if>
                    <if test="tAgentConfig.injury != null and tAgentConfig.injury.trim() != ''">
                        AND a.INJURY = #{tAgentConfig.injury}
                    </if>
                    <if test="tAgentConfig.bear != null and tAgentConfig.bear.trim() != ''">
                        AND a.BEAR = #{tAgentConfig.bear}
                    </if>
                    <if test="tAgentConfig.pension != null and tAgentConfig.pension.trim() != ''">
                        AND a.PENSION = #{tAgentConfig.pension}
                    </if>
                    <if test="tAgentConfig.unemployed != null and tAgentConfig.unemployed.trim() != ''">
                        AND a.UNEMPLOYED = #{tAgentConfig.unemployed}
                    </if>
                    <if test="tAgentConfig.year != null and tAgentConfig.year.trim() != ''">
                        AND a.YEAR = #{tAgentConfig.year}
                    </if>
                    <if test="tAgentConfig.startMonth != null and tAgentConfig.startMonth.trim() != ''">
                        AND a.START_MONTH = #{tAgentConfig.startMonth}
                    </if>
                    <if test="tAgentConfig.endMonth != null and tAgentConfig.endMonth.trim() != ''">
                        AND a.END_MONTH = #{tAgentConfig.endMonth}
                    </if>
					<if test="tAgentConfig.createBy != null and tAgentConfig.createBy.trim() != ''">
						AND a.CREATE_BY = #{tAgentConfig.createBy}
					</if>
					<if test="tAgentConfig.updateBy != null and tAgentConfig.updateBy.trim() != ''">
						AND a.UPDATE_BY = #{tAgentConfig.updateBy}
					</if>
					<if test="tAgentConfig.createName != null and tAgentConfig.createName.trim() != ''">
						AND a.CREATE_NAME = #{tAgentConfig.createName}
					</if>
					<if test="tAgentConfig.createTime != null">
						AND a.CREATE_TIME = #{tAgentConfig.createTime}
					</if>
					<if test="tAgentConfig.updateTime != null">
						AND a.UPDATE_TIME = #{tAgentConfig.updateTime}
					</if>
        </if>
    </sql>
    <!--tAgentConfig简单分页查询-->
    <select id="getTAgentConfigPage" resultMap="tAgentConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_agent_config a
        <where>
            1=1
            <include refid="tAgentConfig_where"/>
        </where>
		ORDER BY a.CREATE_TIME desc
    </select>
</mapper>
