fix bug 6234
This commit is contained in:
parent
aa035e3208
commit
c870cd87bc
|
|
@ -28,6 +28,8 @@ public interface SupermarketInfoMapper {
|
|||
*/
|
||||
public List<SupermarketInfo> selectSupermarketInfoList(SupermarketInfo supermarketInfo);
|
||||
|
||||
public SupermarketInfo selectSupermarketInfoBySupermarketName(SupermarketInfo supermarketInfo);
|
||||
|
||||
/**
|
||||
* 新增超市
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.bonus.canteen.core.supermarket.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper;
|
||||
|
|
@ -51,11 +53,22 @@ public class SupermarketInfoServiceImpl implements ISupermarketInfoService {
|
|||
@Override
|
||||
public int insertSupermarketInfo(SupermarketInfo supermarketInfo) {
|
||||
supermarketInfo.setCreateTime(DateUtils.getNowDate());
|
||||
supermarketInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
try {
|
||||
SupermarketInfo checkResult = supermarketInfoMapper.selectSupermarketInfoBySupermarketName(supermarketInfo);
|
||||
if (Objects.nonNull(checkResult)) {
|
||||
throw new ServiceException("该区域超市名称已存在");
|
||||
}
|
||||
return supermarketInfoMapper.insertSupermarketInfo(supermarketInfo);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -82,6 +82,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectSupermarketInfoBySupermarketName" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketInfo" resultMap="SupermarketInfoResult">
|
||||
<include refid="selectSupermarketInfoVo"/>
|
||||
where si.supermarket_name = #{supermarketName} and si.area_id = #{areaId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSupermarketInfo" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketInfo" useGeneratedKeys="true" keyProperty="supermarketId">
|
||||
insert into supermarket_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
|||
Loading…
Reference in New Issue