md
This commit is contained in:
parent
99728b9e93
commit
3b33641c75
@ -13,6 +13,8 @@ package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -91,7 +93,17 @@ public class EmisSpecialCalcWeightController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisSpecialCalcWeight emisSpecialCalcWeight)
|
||||
{
|
||||
return toAjax(emisSpecialCalcWeightService.insertEmisSpecialCalcWeight(emisSpecialCalcWeight));
|
||||
try{
|
||||
return toAjax(emisSpecialCalcWeightService.insertEmisSpecialCalcWeight(emisSpecialCalcWeight));
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -44,6 +44,9 @@ public interface EmisSpecialCalcWeightMapper extends BaseMapper<EmisSpecialCalcW
|
||||
*/
|
||||
public int insertEmisSpecialCalcWeight(EmisSpecialCalcWeight emisSpecialCalcWeight);
|
||||
|
||||
// 检查唯一性
|
||||
public int checkUnique(EmisSpecialCalcWeight emisSpecialCalcWeight);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
|
||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisSpecialCalcWeight;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisSpecialCalcWeightService
|
||||
* @Description 特殊取重
|
||||
* @author linfso
|
||||
@ -41,7 +42,7 @@ public interface IEmisSpecialCalcWeightService
|
||||
* @param emisSpecialCalcWeight 特殊取重
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisSpecialCalcWeight(EmisSpecialCalcWeight emisSpecialCalcWeight);
|
||||
public int insertEmisSpecialCalcWeight(EmisSpecialCalcWeight emisSpecialCalcWeight) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 修改特殊取重
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisSpecialCalcWeight;
|
||||
@ -60,11 +63,17 @@ public class EmisSpecialCalcWeightServiceImpl implements IEmisSpecialCalcWeightS
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisSpecialCalcWeight(EmisSpecialCalcWeight emisSpecialCalcWeight)
|
||||
{
|
||||
public int insertEmisSpecialCalcWeight(EmisSpecialCalcWeight emisSpecialCalcWeight) throws EmisBizError {
|
||||
int cnt=emisSpecialCalcWeightMapper.checkUnique(emisSpecialCalcWeight);
|
||||
if(cnt>0){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"区间重复");
|
||||
}
|
||||
return emisSpecialCalcWeightMapper.insertEmisSpecialCalcWeight(emisSpecialCalcWeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改特殊取重
|
||||
*
|
||||
|
||||
@ -134,13 +134,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="checkUnique" parameterType="EmisSpecialCalcWeight" resultType="int">
|
||||
select count(1) from emis_special_calc_weight
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and prod_code = #{prodCode}
|
||||
and begin_weight = #{beginWeight}
|
||||
and end_weight = #{endWeight}
|
||||
and begin_date = #{beginDate}
|
||||
and end_date = #{endDate}
|
||||
|
||||
and
|
||||
(
|
||||
( begin_weight <![CDATA[<= ]]> #{beginWeight} and #{beginWeight} <![CDATA[<= ]]> end_weight )
|
||||
or ( begin_weight <![CDATA[<= ]]> #{endWeight} and #{endWeight} <![CDATA[<= ]]> end_weight )
|
||||
)
|
||||
and
|
||||
(
|
||||
( begin_date <![CDATA[<= ]]> #{beginDate} and #{beginDate} <![CDATA[<= ]]> end_date )
|
||||
or ( begin_date <![CDATA[<= ]]> #{endDate} and #{endDate} <![CDATA[<= ]]> end_date )
|
||||
)
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
@ -518,7 +518,6 @@
|
||||
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
and send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user