SELECT a.user_id,
a.top_organization_id,
a.organization_id,
a.role_id,
a.role_name,
a.user_phone,
a.user_name,
a.user_account,
COALESCE(CONCAT( a.user_name, ' ', a.user_phone, ' ', a.user_account)
,a.user_name, ' ', a.user_phone, ' ', a.user_account) AS userShowName,
a.user_member_code,
a.user_password,
a.user_salt,
a.organization_name,
a.user_pay_password,
a.user_idcard_number,
a.user_idcard_number_des,
a.user_idcard_date_from,
a.user_idcard_date_to,
a.user_idcard_long,
a.user_idcard_front_url,
a.user_idcard_back_url,
a.user_idcard_inhand_url,
a.avatar,
a.user_status,
a.user_email,
a.user_area_county_id AS userAreaCountyId,
a.user_area_name AS userAreaName,
a.user_area_address AS userAreaAddress,
a.user_wechat_account,
a.user_wechat_openid,
a.user_wechat_session_key,
a.password_wrong_times,
a.last_login_time,
a.last_login_ip,
a.app_openid,
a.user_client_id,
a.create_time,
a.create_by,
a.create_by_name,
a.update_time,
a.update_by,
a.update_by_name,
a.del_flag,
a.user_remark,
a.user_auth_status,
a.user_status_remark,
a.user_status_time,
a.user_account_type,
a.user_birthday,
a.sex,
a.is_driver_bidding,
a.certification_authority,
a.account_id,
a.promo_code,
a.user_template_seal_status,
a.emergency_contact_name,
a.emergency_contact_phone,
a.business_type,
a.user_template_seal,
a.data_sources,
a.role_code,
a.department_id,
a.ding_user_id,
a.ding_dept_id,
a.validity_period_management,a.salesperson_nc_code,a.document_preparer_nc_code,
a.legal_representative,
a.unified_code,
a.registered_phone,
a.registered_address,
a.fax,
a.payment_bank,
a.payment_account,
a.invoice_title,
a.tax_number,
b.SETTLEMENT_CURRENCY,
a.LINE_MANAGEMENT_ID,
a.ROUTE_CODE,
a.ROUTE_NAME,
a.DELIVERY_ORDER
FROM "USER" a left join USER_SHIPPER b on a.user_id = b.user_id
where a.del_flag = 1
and a.create_by = #{createBy} and a.user_account_type = #{userAccountType}
and a.user_account_type in
#{userAccountType}
and a.create_by = #{createBy}
AND a.organization_id in
#{id}
AND (a.organization_id in
#{id}
OR a.create_by = #{createBy})
and a.user_id in
#{id}
and a.user_id = #{userId}
and a.line_management_id = #{lineManagementId}
and a.route_code = #{routeCode}
and a.route_name = #{routeName}
and a.delivery_order = #{deliveryOrder}
and a.organization_id = #{organizationId}
and a.organization_name IS NOT NULL
and a.top_organization_id = #{topOrganizationId}
and a.organization_name IS NOT NULL
/*组织名称*/
and a.organization_name like concat('%' , #{organizationName} , '%')
/*姓名、手机号*/
and (a.user_name like concat('%' , #{userInfo} , '%')
or a.user_phone like concat('%' , #{userInfo} , '%'))
/*姓名*/
and a.user_name like concat('%' , #{userName} , '%')
/*登录账号*/
and a.user_account like concat('%' , #{userAccount} , '%')
/*手机号*/
and a.user_phone like concat('%' , #{userPhone} , '%')
/*身份证号*/
and a.user_idcard_number like concat('%' , #{userIdcardNumber} , '%')
/*角色*/
and a.role_code like concat('%' , #{roleCode} , '%')
/*角色*/
and a.role_name like concat('%' , #{roleName} , '%')
/*实名认证状态*/
and a.user_auth_status = #{userAuthStatus}
/*身份证有效期*/
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d') =]]>
DATE_FORMAT(#{userIdcardDateFrom},'%Y-%m-%d')
and DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
DATE_FORMAT(#{userIdcardDateTo},'%Y-%m-%d')
/*详细地址*/
and a.user_area_address like concat('%' , #{userAreaAddressInfo} , '%')
/*用户电子签章状态 0-无状态,1-已创建,2-未创建*/
and a.user_template_seal is not null
and a.user_template_seal != ''
/*用户电子签章状态 0-无状态,1-已创建,2-未创建*/
and (a.user_template_seal is null or a.user_template_seal = '')
/*用户三方支付账号状态 0-无状态,1-已创建,2-未创建*/
and a.user_pay_account is not null
and a.user_pay_account != ''
/*用户三方支付账号状态 0-无状态,1-已创建,2-未创建*/
and ( a.user_pay_account is null or a.user_pay_account ='')
/*用户三方支付账号*/
and a.user_pay_account like concat('%' , #{userPayAccount} , '%')
/*用户绑卡账号*/
and a.user_bankcard_account like concat('%' , #{userBankCardAccount} , '%')
/*用户绑卡状态:0-无状态,1-已绑卡,2-未绑卡*/
and a.user_bankcard_account is not null
and a.user_bankcard_account != ''
/*用户绑卡状态:0-无状态,1-已绑卡,2-未绑卡*/
and ( a.user_bankcard_account is null or a.user_bankcard_account= '')
/*用户状态:0-无状态,1-正常,2-锁定*/
and a.user_status = #{userStatus}
/*最近一次登录时间*/
and DATE_FORMAT(a.last_login_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{lastLoginTimeFrom},'%Y-%m-%d')
and DATE_FORMAT(a.last_login_time,'%Y-%m-%d')
DATE_FORMAT(#{lastLoginTimeTo},'%Y-%m-%d')
/*添加人员*/
and a.create_by_name like concat('%' , #{createByName} , '%')
/*审核人员*/
and a.user_auth_by like concat('%' , #{userAuthByUsername} , '%')
/*审核人员*/
and a.user_auth_by_username like concat('%' , #{userAuthByUsername} , '%')
/*添加时间*/
and DATE_FORMAT(a.create_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{createTime},'%Y-%m-%d')
and DATE_FORMAT(a.create_time,'%Y-%m-%d')
DATE_FORMAT(#{createTime},'%Y-%m-%d')
/*添加时间*/
and DATE_FORMAT(a.create_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{createTimeFrom},'%Y-%m-%d')
and DATE_FORMAT(a.create_time,'%Y-%m-%d')
DATE_FORMAT(#{createTimeTo},'%Y-%m-%d')
/*审核时间*/
and DATE_FORMAT(a.user_auth_time,'%Y-%m-%d') =]]>
DATE_FORMAT(#{userAuthTimeFrom},'%Y-%m-%d')
and DATE_FORMAT(a.user_auth_time,'%Y-%m-%d')
DATE_FORMAT(#{userAuthTimeTo},'%Y-%m-%d')
/* 身份证状态:用户身份证到期状态:0-无状态,1-正常,2-临期一个月,3-临期三个月,4-过期,5-长期 */
/* 正常: 直接赋值,查询当前时间小于过期时间的 */
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
/* 临期一个月:当前时间加一个月,查询该时间大于过期时间的 临期三个月:当前时间加三个月,查询该时间大于过期时间的*/
and DATE_FORMAT(#{userIdcardTimeAdd},'%Y-%m-%d') =]]> a.user_idcard_date_to
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') a.user_idcard_date_to
/* 过期:查询当前时间大于过期时间的*/
and DATE_FORMAT(#{userIdcardTime},'%Y-%m-%d') ]]> DATE_FORMAT(a.user_idcard_date_to,'%Y-%m-%d')
/* 长期:查询 user_idcard_long字段为1的*/
and a.user_idcard_long = 1
/*用户编码*/
and a.user_member_code = #{userMemberCode}
/*详细地址*/
and a.user_area_address like concat('%' , #{userAreaAddress} , '%')
/*紧急联系人*/
and a.emergency_contact_name like concat('%' , #{emergencyContactName} , '%')
/*紧急联系人手机号*/
and a.emergency_contact_phone like concat('%' , #{emergencyContactPhone} , '%')
and a.user_area_county_id = #{userAreaCountyId}
and (a.user_phone = #{userDO.userPhone} or a.user_account = #{userDO.userPhone})
and a.top_organization_id = #{userDO.topOrganizationId}