Files
klp-oa/klp-wms/src/main/resources/mapper/klp/WmsCostStandardConfigMapper.xml
2025-12-03 10:32:06 +08:00

60 lines
2.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.klp.mapper.WmsCostStandardConfigMapper">
<resultMap type="com.klp.domain.WmsCostStandardConfig" id="CostStandardConfigResult">
<result property="configId" column="config_id"/>
<result property="unitCost" column="unit_cost"/>
<result property="effectiveDate" column="effective_date"/>
<result property="expireDate" column="expire_date"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
</resultMap>
<resultMap type="com.klp.domain.vo.WmsCostStandardConfigVo" id="CostStandardConfigVoResult">
<result property="configId" column="config_id"/>
<result property="unitCost" column="unit_cost"/>
<result property="effectiveDate" column="effective_date"/>
<result property="expireDate" column="expire_date"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
</resultMap>
<!-- 查询指定日期的有效成本标准 -->
<select id="selectEffectiveByDate" resultMap="CostStandardConfigVoResult">
SELECT *
FROM wms_cost_standard_config
WHERE del_flag = 0
AND status = 1
AND effective_date &lt;= #{date}
AND (expire_date IS NULL OR expire_date &gt;= #{date})
ORDER BY effective_date DESC
LIMIT 1
</select>
<!-- 查询当前有效的成本标准 -->
<select id="selectCurrentEffective" resultMap="CostStandardConfigVoResult">
SELECT *
FROM wms_cost_standard_config
WHERE del_flag = 0
AND status = 1
AND effective_date &lt;= CURDATE()
AND (expire_date IS NULL OR expire_date &gt;= CURDATE())
ORDER BY effective_date DESC
LIMIT 1
</select>
</mapper>