mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-19 05:27:59 +08:00
update 停车优惠配置接口
This commit is contained in:
@@ -9,6 +9,7 @@ import com.jsowell.pile.vo.web.ChargeParkingDiscountVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountService{
|
||||
@@ -81,12 +82,26 @@ public class ChargeParkingDiscountServiceImpl implements ChargeParkingDiscountSe
|
||||
|
||||
@Override
|
||||
public int insertOrUpdateSelective(ChargeParkingDiscount record) {
|
||||
if (record.getId() == null) {
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
} else {
|
||||
record.setUpdateBy(SecurityUtils.getUsername());
|
||||
if (record == null || StringUtils.isBlank(record.getStationId())) {
|
||||
return 0;
|
||||
}
|
||||
return chargeParkingDiscountMapper.insertOrUpdateSelective(record);
|
||||
String username = SecurityUtils.getUsername();
|
||||
Date now = new Date();
|
||||
record.setDelFlag("0");
|
||||
|
||||
ChargeParkingDiscount latestRecord = this.selectByStationId(record.getStationId());
|
||||
if (latestRecord == null) {
|
||||
record.setCreateBy(username);
|
||||
record.setCreateTime(now);
|
||||
return chargeParkingDiscountMapper.insertSelective(record);
|
||||
}
|
||||
|
||||
record.setId(latestRecord.getId());
|
||||
record.setUpdateBy(username);
|
||||
record.setUpdateTime(now);
|
||||
int result = chargeParkingDiscountMapper.updateByPrimaryKeySelective(record);
|
||||
chargeParkingDiscountMapper.logicDeleteByStationIdExcludeId(record.getStationId(), latestRecord.getId(), username, now);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user