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

	<resultMap id="sysOutEmpCategorizeFormInfoMap"
			   type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysOutEmpCategorizeFormInfo">
		<id property="id" column="id"/>
		<result property="fieldName" column="field_name"/>
		<result property="name" column="name"/>
		<result property="sort" column="sort"/>
		<result property="groupType" column="group_type"/>
		<result property="isLookToc" column="is_look_toc"/>
		<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.field_name,
                a.name,
                a.sort,
                a.group_type,
                a.is_look_toc,
                a.del_flag,
                a.create_time,
                a.create_by,
                a.create_name,
                a.update_by,
                a.update_time
    </sql>
	<sql id="sysOutEmpCategorizeFormInfo_where">
		<if test="sysOutEmpCategorizeFormInfo != null">
			<if test="sysOutEmpCategorizeFormInfo.id != null and sysOutEmpCategorizeFormInfo.id.trim() != ''">
				AND a.id = #{sysOutEmpCategorizeFormInfo.id}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.name != null and sysOutEmpCategorizeFormInfo.name.trim() != ''">
				AND a.name = #{sysOutEmpCategorizeFormInfo.name}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.sort != null">
				AND a.sort = #{sysOutEmpCategorizeFormInfo.sort}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.groupType != null and sysOutEmpCategorizeFormInfo.groupType.trim() != ''">
				AND a.group_type = #{sysOutEmpCategorizeFormInfo.groupType}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.isLookToc != null and sysOutEmpCategorizeFormInfo.isLookToc.trim() != ''">
				AND a.is_look_toc = #{sysOutEmpCategorizeFormInfo.isLookToc}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.delFlag != null and sysOutEmpCategorizeFormInfo.delFlag.trim() != ''">
				AND a.del_flag = #{sysOutEmpCategorizeFormInfo.delFlag}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.createTime != null">
				AND a.create_time = #{sysOutEmpCategorizeFormInfo.createTime}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.createBy != null and sysOutEmpCategorizeFormInfo.createBy.trim() != ''">
				AND a.create_by = #{sysOutEmpCategorizeFormInfo.createBy}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.createName != null and sysOutEmpCategorizeFormInfo.createName.trim() != ''">
				AND a.create_name = #{sysOutEmpCategorizeFormInfo.createName}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.updateBy != null and sysOutEmpCategorizeFormInfo.updateBy.trim() != ''">
				AND a.update_by = #{sysOutEmpCategorizeFormInfo.updateBy}
			</if>
			<if test="sysOutEmpCategorizeFormInfo.updateTime != null">
				AND a.update_time = #{sysOutEmpCategorizeFormInfo.updateTime}
			</if>
		</if>
	</sql>
	<!--sysOutEmpCategorizeFormInfo简单分页查询-->
	<select id="getSysOutEmpCategorizeFormInfoPage" resultMap="sysOutEmpCategorizeFormInfoMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM sys_out_emp_categorize_form_info a
		<where>
			1=1
			<include refid="sysOutEmpCategorizeFormInfo_where"/>
		</where>
	</select>

	<select id="getCategorizeVoList" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysOutEmpCategorizeFormInfoVo">
		SELECT
		<include refid="Base_Column_List"/>
		FROM sys_out_emp_categorize_form_info a
		<where>
			a.del_flag = '0'
			<if test="isLookToc != null and isLookToc.trim() != ''">
				AND a.is_look_toc = #{isLookToc}
			</if>
		</where>
		order by a.sort,a.id desc
	</select>
</mapper>
