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

	<resultMap id="tSocialSoldierLogMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSocialSoldierLog">
		<id property="id" column="ID"/>
		<result property="addId" column="ADD_ID"/>
		<result property="socialId" column="SOCIAL_ID"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="dispatchItem" column="DISPATCH_ITEM"/>
		<result property="socialHuName" column="SOCIAL_HU_NAME"/>
		<result property="type" column="TYPE"/>
		<result property="remark" column="REMARK"/>
		<result property="createBy" column="CREATE_BY"/>
		<result property="updateBy" column="UPDATE_BY"/>
		<result property="createName" column="CREATE_NAME"/>
		<result property="updateTime" column="UPDATE_TIME"/>
		<result property="createTime" column="CREATE_TIME"/>
	</resultMap>
	<sql id="Base_Column_List">
		a.ID,
                a.ADD_ID,
                a.SOCIAL_ID,
                a.EMP_IDCARD,
                a.EMP_NAME,
                a.DISPATCH_ITEM,
                a.SOCIAL_HU_NAME,
                a.TYPE,
                a.REMARK,
                a.CREATE_BY,
                a.UPDATE_BY,
                a.CREATE_NAME,
                a.UPDATE_TIME,
                a.CREATE_TIME
	</sql>
	<sql id="tSocialSoldierLog_where">
		<if test="tSocialSoldierLog != null">
			<if test="tSocialSoldierLog.id != null and tSocialSoldierLog.id.trim() != ''">
				AND a.ID = #{tSocialSoldierLog.id}
			</if>
			<if test="tSocialSoldierLog.addId != null and tSocialSoldierLog.addId.trim() != ''">
				AND a.ADD_ID = #{tSocialSoldierLog.addId}
			</if>
			<if test="tSocialSoldierLog.socialId != null and tSocialSoldierLog.socialId.trim() != ''">
				AND a.SOCIAL_ID = #{tSocialSoldierLog.socialId}
			</if>
			<if test="tSocialSoldierLog.empIdcard != null and tSocialSoldierLog.empIdcard.trim() != ''">
				AND a.EMP_IDCARD = #{tSocialSoldierLog.empIdcard}
			</if>
			<if test="tSocialSoldierLog.empName != null and tSocialSoldierLog.empName.trim() != ''">
				AND a.EMP_NAME = #{tSocialSoldierLog.empName}
			</if>
			<if test="tSocialSoldierLog.dispatchItem != null and tSocialSoldierLog.dispatchItem.trim() != ''">
				AND a.DISPATCH_ITEM = #{tSocialSoldierLog.dispatchItem}
			</if>
			<if test="tSocialSoldierLog.socialHuName != null and tSocialSoldierLog.socialHuName.trim() != ''">
				AND a.SOCIAL_HU_NAME = #{tSocialSoldierLog.socialHuName}
			</if>
			<if test="tSocialSoldierLog.type != null and tSocialSoldierLog.type.trim() != ''">
				AND a.TYPE = #{tSocialSoldierLog.type}
			</if>
			<if test="tSocialSoldierLog.remark != null and tSocialSoldierLog.remark.trim() != ''">
				AND a.REMARK = #{tSocialSoldierLog.remark}
			</if>
			<if test="tSocialSoldierLog.createBy != null and tSocialSoldierLog.createBy.trim() != ''">
				AND a.CREATE_BY = #{tSocialSoldierLog.createBy}
			</if>
			<if test="tSocialSoldierLog.updateBy != null and tSocialSoldierLog.updateBy.trim() != ''">
				AND a.UPDATE_BY = #{tSocialSoldierLog.updateBy}
			</if>
			<if test="tSocialSoldierLog.createName != null and tSocialSoldierLog.createName.trim() != ''">
				AND a.CREATE_NAME = #{tSocialSoldierLog.createName}
			</if>
			<if test="tSocialSoldierLog.updateTime != null">
				AND a.UPDATE_TIME = #{tSocialSoldierLog.updateTime}
			</if>
			<if test="tSocialSoldierLog.createTimeStart != null">
				AND a.CREATE_TIME >= #{tSocialSoldierLog.createTimeStart}
			</if>
			<if test="tSocialSoldierLog.createTimeEnd != null">
				AND a.CREATE_TIME  <![CDATA[ <= ]]> #{tSocialSoldierLog.createTimeEnd}
			</if>
        </if>
    </sql>
    <!--tSocialSoldierLog简单分页查询-->
    <select id="getTSocialSoldierLogPage" resultMap="tSocialSoldierLogMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_social_soldier_log a
        <where>
            1=1
            <include refid="tSocialSoldierLog_where"/>
        </where>
		order by a.CREATE_TIME desc
    </select>

    <!--tSocialSoldierLog简单分页查询-->
    <select id="getTSocialSoldierLogList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierLogExportVo">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_social_soldier_log a
        <where>
            1=1
            <include refid="tSocialSoldierLog_where"/>
        </where>
		order by a.CREATE_TIME desc
		<if test="tSocialSoldierLog != null">
			<if test="tSocialSoldierLog.limitStart != null">
				limit #{tSocialSoldierLog.limitStart},#{tSocialSoldierLog.limitEnd}
			</if>
		</if>
    </select>
</mapper>