<?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.salary.mapper.TSalaryStandardOriginalDetailMapper">

	<resultMap id="TSalaryStandardOriginalDetailMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginalDetail">
		<id property="id" column="ID"/>
		<result property="originalId" column="ORIGINAL_ID"/>
		<result property="columnNo" column="COLUMN_NO"/>
		<result property="excelName" column="EXCEL_NAME"/>
		<result property="modelName" column="MODEL_NAME"/>
		<result property="flag" column="FLAG"/>
		<result property="formulaNo" column="FORMULA_NO"/>
		<result property="excelRule" column="EXCEL_RULE"/>
		<result property="excelKey" column="EXCEL_KEY"/>
	</resultMap>
	<sql id="Base_Column_List">
		a.ID,
		a.ORIGINAL_ID,
		a.COLUMN_NO,
		a.EXCEL_NAME,
		a.MODEL_NAME,
		a.FLAG,
		a.FORMULA_NO,
		a.EXCEL_RULE,
		a.EXCEL_KEY
	</sql>
	<sql id="TSalaryStandardOriginalDetail_where">
		<if test="tSalaryStandardOriginalDetail != null">
			<if test="tSalaryStandardOriginalDetail.id != null and tSalaryStandardOriginalDetail.id.trim() != ''">
				AND a.ID = #{tSalaryStandardOriginalDetail.id}
			</if>
			<if test="tSalaryStandardOriginalDetail.originalId != null and tSalaryStandardOriginalDetail.originalId.trim() != ''">
				AND a.ORIGINAL_ID = #{tSalaryStandardOriginalDetail.originalId}
			</if>
			<if test="tSalaryStandardOriginalDetail.columnNo != null and tSalaryStandardOriginalDetail.columnNo.trim() != ''">
				AND a.COLUMN_NO = #{tSalaryStandardOriginalDetail.columnNo}
			</if>
			<if test="tSalaryStandardOriginalDetail.excelName != null and tSalaryStandardOriginalDetail.excelName.trim() != ''">
				AND a.EXCEL_NAME = #{tSalaryStandardOriginalDetail.excelName}
			</if>
			<if test="tSalaryStandardOriginalDetail.modelName != null and tSalaryStandardOriginalDetail.modelName.trim() != ''">
				AND a.MODEL_NAME = #{tSalaryStandardOriginalDetail.modelName}
			</if>
		</if>
	</sql>
	<!--TSalaryStandardOriginalDetail简单分页查询-->
	<select id="getTSalaryStandardOriginalDetailPage" resultMap="TSalaryStandardOriginalDetailMap">
		SELECT
			<include refid="Base_Column_List"/>
		FROM
			t_salary_standard_original_detail a
		<where> 1=1
			<include refid="TSalaryStandardOriginalDetail_where"/>
		</where>
		ORDER BY a.COLUMN_NO asc
	</select>
	<!--获取详情-->
	<select id="getTSalaryStandardOriginalDetailByOrgId" resultMap="TSalaryStandardOriginalDetailMap">
		SELECT
			<include refid="Base_Column_List"/>
		FROM
			t_salary_standard_original_detail a
		where a.ORIGINAL_ID = #{originalId}
		ORDER BY a.COLUMN_NO asc
	</select>
	<!--删除关系-->
	<delete id="deleteByOrgId" >
		DELETE FROM t_salary_standard_original_detail WHERE ORIGINAL_ID = #{originalId}
	</delete>


</mapper>
