<?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.SysOutEmpFormInfoMapper">

	<resultMap id="sysOutEmpFormInfoMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysOutEmpFormInfo">
		<id property="id" column="id"/>
		<result property="categorizeId" column="categorize_id"/>
		<result property="fieldName" column="field_name"/>
		<result property="fieldZhName" column="field_zh_name"/>
		<result property="sort" column="sort"/>
		<result property="isLookToc" column="is_look_toc"/>
		<result property="empFillType" column="emp_fill_type"/>
		<result property="fieldStatus" column="field_status"/>
		<result property="fieldType" column="field_type"/>
		<result property="dictType" column="dict_type"/>
		<result property="isRequired" column="is_required"/>
		<result property="relField" column="rel_field"/>
		<result property="relFieldValue" column="rel_field_value"/>
		<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"/>
		<result property="haveWanxinMapping" column="have_wanxin_mapping"/>
		<result property="wanxinMappingType" column="wanxin_mapping_type"/>
		<result property="wanxinFieldName" column="wanxin_field_name"/>
		<result property="wanxinFieldZhName" column="wanxin_field_zh_name"/>
		<result property="wanxinFieldType" column="wanxin_field_type"/>
		<result property="isCheck" column="is_check"/>
		<result property="checkValue" column="check_value"/>
	</resultMap>
	<sql id="Base_Column_List">
                a.id,
                a.categorize_id,
                a.field_name,
                a.field_zh_name,
                a.sort,
                a.is_look_toc,
                a.emp_fill_type,
                a.field_status,
                a.field_type,
                a.dict_type,
                a.is_required,
                a.rel_field,
                a.rel_field_value,
                a.del_flag,
                a.create_time,
                a.create_by,
                a.create_name,
                a.update_by,
                a.update_time,
                a.have_wanxin_mapping,
                a.wanxin_mapping_type,
                a.wanxin_field_name,
                a.wanxin_field_zh_name,
                a.wanxin_field_type,
                a.is_check,
                a.check_value
    </sql>
	<sql id="sysOutEmpFormInfo_where">
		<if test="sysOutEmpFormInfo != null">
			<if test="sysOutEmpFormInfo.id != null and sysOutEmpFormInfo.id.trim() != ''">
				AND a.id = #{sysOutEmpFormInfo.id}
			</if>
			<if test="sysOutEmpFormInfo.categorizeId != null and sysOutEmpFormInfo.categorizeId.trim() != ''">
				AND a.categorize_id = #{sysOutEmpFormInfo.categorizeId}
			</if>
			<if test="sysOutEmpFormInfo.fieldName != null and sysOutEmpFormInfo.fieldName.trim() != ''">
				AND a.field_name = #{sysOutEmpFormInfo.fieldName}
			</if>
			<if test="sysOutEmpFormInfo.fieldZhName != null and sysOutEmpFormInfo.fieldZhName.trim() != ''">
				AND a.field_zh_name LIKE CONCAT('%',#{sysOutEmpFormInfo.fieldZhName},'%')
			</if>
			<if test="sysOutEmpFormInfo.sort != null">
				AND a.sort = #{sysOutEmpFormInfo.sort}
			</if>
			<if test="sysOutEmpFormInfo.isLookToc != null and sysOutEmpFormInfo.isLookToc.trim() != ''">
				AND a.is_look_toc = #{sysOutEmpFormInfo.isLookToc}
			</if>
			<if test="sysOutEmpFormInfo.empFillType != null and sysOutEmpFormInfo.empFillType.trim() != ''">
				AND a.emp_fill_type = #{sysOutEmpFormInfo.empFillType}
			</if>
			<if test="sysOutEmpFormInfo.fieldStatus != null and sysOutEmpFormInfo.fieldStatus.trim() != ''">
				AND a.field_status = #{sysOutEmpFormInfo.fieldStatus}
			</if>
			<if test="sysOutEmpFormInfo.fieldType != null and sysOutEmpFormInfo.fieldType.trim() != ''">
				AND a.field_type = #{sysOutEmpFormInfo.fieldType}
			</if>
			<if test="sysOutEmpFormInfo.dictType != null and sysOutEmpFormInfo.dictType.trim() != ''">
				AND a.dict_type = #{sysOutEmpFormInfo.dictType}
			</if>
			<if test="sysOutEmpFormInfo.isRequired != null and sysOutEmpFormInfo.isRequired.trim() != ''">
				AND a.is_required = #{sysOutEmpFormInfo.isRequired}
			</if>
			<if test="sysOutEmpFormInfo.relField != null and sysOutEmpFormInfo.relField.trim() != ''">
				AND a.rel_field = #{sysOutEmpFormInfo.relField}
			</if>
			<if test="sysOutEmpFormInfo.relFieldValue != null and sysOutEmpFormInfo.relFieldValue.trim() != ''">
				AND a.rel_field_value = #{sysOutEmpFormInfo.relFieldValue}
			</if>
			<if test="sysOutEmpFormInfo.delFlag != null and sysOutEmpFormInfo.delFlag.trim() != ''">
				AND a.del_flag = #{sysOutEmpFormInfo.delFlag}
			</if>
			<if test="sysOutEmpFormInfo.createTime != null">
				AND a.create_time = #{sysOutEmpFormInfo.createTime}
			</if>
			<if test="sysOutEmpFormInfo.createBy != null and sysOutEmpFormInfo.createBy.trim() != ''">
				AND a.create_by = #{sysOutEmpFormInfo.createBy}
			</if>
			<if test="sysOutEmpFormInfo.createName != null and sysOutEmpFormInfo.createName.trim() != ''">
				AND a.create_name = #{sysOutEmpFormInfo.createName}
			</if>
			<if test="sysOutEmpFormInfo.updateBy != null and sysOutEmpFormInfo.updateBy.trim() != ''">
				AND a.update_by = #{sysOutEmpFormInfo.updateBy}
			</if>
			<if test="sysOutEmpFormInfo.updateTime != null">
				AND a.update_time = #{sysOutEmpFormInfo.updateTime}
			</if>
			<if test="sysOutEmpFormInfo.haveWanxinMapping != null and sysOutEmpFormInfo.haveWanxinMapping.trim() != ''">
				AND a.have_wanxin_mapping = #{sysOutEmpFormInfo.haveWanxinMapping}
			</if>
			<if test="sysOutEmpFormInfo.wanxinMappingType != null and sysOutEmpFormInfo.wanxinMappingType.trim() != ''">
				AND a.wanxin_mapping_type = #{sysOutEmpFormInfo.wanxinMappingType}
			</if>
			<if test="sysOutEmpFormInfo.wanxinFieldName != null and sysOutEmpFormInfo.wanxinFieldName.trim() != ''">
				AND a.wanxin_field_name = #{sysOutEmpFormInfo.wanxinFieldName}
			</if>
			<if test="sysOutEmpFormInfo.wanxinFieldZhName != null and sysOutEmpFormInfo.wanxinFieldZhName.trim() != ''">
				AND a.wanxin_field_zh_name LIKE CONCAT('%',#{sysOutEmpFormInfo.wanxinFieldZhName},'%')
			</if>
			<if test="sysOutEmpFormInfo.wanxinFieldType != null and sysOutEmpFormInfo.wanxinFieldType.trim() != ''">
				AND a.wanxin_field_type = #{sysOutEmpFormInfo.wanxinFieldType}
			</if>
			<if test="sysOutEmpFormInfo.isCheck != null and sysOutEmpFormInfo.isCheck.trim() != ''">
				AND a.is_check = #{sysOutEmpFormInfo.isCheck}
			</if>
			<if test="sysOutEmpFormInfo.checkValue != null and sysOutEmpFormInfo.checkValue.trim() != ''">
				AND a.check_value = #{sysOutEmpFormInfo.checkValue}
			</if>
		</if>
	</sql>
	<!--sysOutEmpFormInfo简单分页查询-->
	<select id="getSysOutEmpFormInfoPage" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysOutEmpFormInfoVo">
		SELECT
		<include refid="Base_Column_List"/>
		FROM sys_out_emp_form_info a
		<where>
			a.del_flag = '0'
			<include refid="sysOutEmpFormInfo_where"/>
		</where>
		order by a.sort, CAST(a.id AS UNSIGNED)
	</select>

	<select id="getSysOutEmpFormInfoList" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysOutEmpFormInfoVo">
		SELECT
		<include refid="Base_Column_List"/>
		FROM sys_out_emp_form_info a
		<where>
			a.del_flag = '0'
			<include refid="sysOutEmpFormInfo_where"/>
		</where>
		order by a.sort, CAST(a.id AS UNSIGNED)
	</select>
</mapper>
