mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-12 11:19:52 +08:00
update 校验固件名是否唯一
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.PileFirmwareInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,14 @@ public interface PileFirmwareInfoMapper {
|
||||
*/
|
||||
public List<PileFirmwareInfo> selectPileFirmwareInfoList(PileFirmwareInfo pileFirmwareInfo);
|
||||
|
||||
/**
|
||||
* 根据固件名称查询充电桩固件信息
|
||||
*
|
||||
* @param name 固件名称
|
||||
* @return 充电桩固件信息
|
||||
*/
|
||||
public PileFirmwareInfo checkNameUnique(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* 新增充电桩固件信息
|
||||
*
|
||||
|
||||
@@ -30,6 +30,14 @@ public interface PileFirmwareInfoService {
|
||||
*/
|
||||
public List<PileFirmwareInfo> selectPileFirmwareInfoList(PileFirmwareInfo pileFirmwareInfo);
|
||||
|
||||
/**
|
||||
* 校验固件名称是否唯一
|
||||
*
|
||||
* @param pileFirmwareInfo 充电桩固件信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkNameUnique(PileFirmwareInfo pileFirmwareInfo);
|
||||
|
||||
/**
|
||||
* 新增充电桩固件信息
|
||||
*
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.jsowell.pile.service.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.UserConstants;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||
import com.jsowell.pile.domain.PileFirmwareInfo;
|
||||
import com.jsowell.pile.domain.PileReservationInfo;
|
||||
@@ -50,6 +52,22 @@ public class PileFirmwareInfoServiceImpl implements PileFirmwareInfoService {
|
||||
return pileFirmwareInfoMapper.selectPileFirmwareInfoList(pileFirmwareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验固件名称是否唯一
|
||||
*
|
||||
* @param pileFirmwareInfo 充电桩固件信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkNameUnique(PileFirmwareInfo pileFirmwareInfo) {
|
||||
Long id = StringUtils.isNull(pileFirmwareInfo.getId()) ? -1L : pileFirmwareInfo.getId();
|
||||
PileFirmwareInfo info = pileFirmwareInfoMapper.checkNameUnique(pileFirmwareInfo.getName());
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != id.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充电桩固件信息
|
||||
*
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkNameUnique" resultMap="PileFirmwareInfoResult">
|
||||
<include refid="selectPileFirmwareInfoVo"/>
|
||||
where name = #{name}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertPileFirmwareInfo" parameterType="com.jsowell.pile.domain.PileFirmwareInfo">
|
||||
insert into pile_firmware_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -96,4 +102,4 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user