<?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.admin.mapper.SysGuaziBankBranchMapper">

	<resultMap id="sysGuaziBankBranchMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysGuaziBankBranch">
		<id property="id" column="id"/>
		<result property="bankCd" column="bank_cd"/>
		<result property="cnapsId" column="cnaps_id"/>
		<result property="cnapsNum" column="cnaps_num"/>
		<result property="bankDescr" column="bank_descr"/>
		<result property="stateId" column="state_id"/>
		<result property="cityId" column="city_id"/>
		<result property="effStatus" column="eff_status"/>
		<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.bank_cd,
                a.cnaps_id,
                a.cnaps_num,
                a.bank_descr,
                a.state_id,
                a.city_id,
                a.eff_status,
                a.create_time,
                a.create_by,
                a.create_name,
                a.update_by,
                a.update_time
    </sql>
	<sql id="sysGuaziBankBranch_where">
		<if test="sysGuaziBankBranch != null">
			<if test="sysGuaziBankBranch.id != null">
				AND a.id = #{sysGuaziBankBranch.id}
			</if>
			<if test="sysGuaziBankBranch.bankCd != null and sysGuaziBankBranch.bankCd.trim() != ''">
				AND a.bank_cd = #{sysGuaziBankBranch.bankCd}
			</if>
			<if test="sysGuaziBankBranch.cnapsId != null">
				AND a.cnaps_id = #{sysGuaziBankBranch.cnapsId}
			</if>
			<if test="sysGuaziBankBranch.cnapsNum != null and sysGuaziBankBranch.cnapsNum.trim() != ''">
				AND a.cnaps_num = #{sysGuaziBankBranch.cnapsNum}
			</if>
			<if test="sysGuaziBankBranch.bankDescr != null and sysGuaziBankBranch.bankDescr.trim() != ''">
				AND a.bank_descr LIKE CONCAT('%',#{sysGuaziBankBranch.bankDescr},'%')
			</if>
			<if test="sysGuaziBankBranch.stateId != null and sysGuaziBankBranch.stateId.trim() != ''">
				AND a.state_id = #{sysGuaziBankBranch.stateId}
			</if>
			<if test="sysGuaziBankBranch.cityId != null and sysGuaziBankBranch.cityId.trim() != ''">
				AND a.city_id = #{sysGuaziBankBranch.cityId}
			</if>
			<if test="sysGuaziBankBranch.createTime != null">
				AND a.create_time = #{sysGuaziBankBranch.createTime}
			</if>
			<if test="sysGuaziBankBranch.createBy != null and sysGuaziBankBranch.createBy.trim() != ''">
				AND a.create_by = #{sysGuaziBankBranch.createBy}
			</if>
			<if test="sysGuaziBankBranch.createName != null and sysGuaziBankBranch.createName.trim() != ''">
				AND a.create_name = #{sysGuaziBankBranch.createName}
			</if>
			<if test="sysGuaziBankBranch.updateBy != null and sysGuaziBankBranch.updateBy.trim() != ''">
				AND a.update_by = #{sysGuaziBankBranch.updateBy}
			</if>
			<if test="sysGuaziBankBranch.updateTime != null">
				AND a.update_time = #{sysGuaziBankBranch.updateTime}
			</if>
		</if>
	</sql>
	<!--sysGuaziBankBranch简单分页查询-->
	<select id="getSysGuaziBankBranchPage" resultMap="sysGuaziBankBranchMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM sys_guazi_bank_branch a
		<where>
			a.eff_status = 'A'
			<include refid="sysGuaziBankBranch_where"/>
		</where>
		order by a.id
	</select>
</mapper>
