This commit is contained in:
linfso 2024-12-20 11:16:45 +08:00
parent 93b61e18da
commit 59bbe6c66d
2 changed files with 14 additions and 17 deletions

View File

@ -121,6 +121,11 @@ public class EmisExchangeRateController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody EmisExchangeRate emisExchangeRate)
{
int cnt=emisExchangeRateService.checkUnique(emisExchangeRate);
if(cnt>0){
return AjaxResult.error("配置重复,请检查时间范围");
}
return toAjax(emisExchangeRateService.insertEmisExchangeRate(emisExchangeRate));
}

View File

@ -42,23 +42,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="checkUnique" parameterType="EmisExchangeRate" resultType="int">
select count(1) from emis_exchange_rate
where del_flag='0'
and id = #{id}
and currency = #{currency}
and dest_currency = #{destCurrency}
and rate = #{rate}
and start_date = #{startDate}
and end_date = #{endDate}
and bl_valid = #{blValid}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and remark = #{remark}
and create_site = #{createSite}
and update_site = #{updateSite}
select count(1) from emis_exchange_rate
where del_flag='0'
and currency = #{currency}
and dest_currency = #{destCurrency}
and (
(start_date <![CDATA[ <= ]]> #{startDate} and #{startDate} <![CDATA[ <= ]]> end_date )
or
(start_date <![CDATA[ <= ]]> #{endDate} and #{endDate} <![CDATA[ <= ]]> end_date )
)
limit 1
</select>