bug 5801
This commit is contained in:
parent
75c74bedcb
commit
be09234259
|
|
@ -18,7 +18,7 @@ public interface AllocCanteenMapper {
|
||||||
*/
|
*/
|
||||||
public AllocCanteen selectAllocCanteenByCanteenId(Long canteenId);
|
public AllocCanteen selectAllocCanteenByCanteenId(Long canteenId);
|
||||||
|
|
||||||
public AllocCanteen selectAllocCanteenByCanteenName(String canteenName);
|
public AllocCanteen selectAllocCanteenByCanteenName(AllocCanteen allocCanteen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询食堂信息列表
|
* 查询食堂信息列表
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService {
|
||||||
allocCanteen.setCreateTime(DateUtils.getNowDate());
|
allocCanteen.setCreateTime(DateUtils.getNowDate());
|
||||||
allocCanteen.setIfReserve(BnsConstants.COMMON_YES); //默认开启预订餐
|
allocCanteen.setIfReserve(BnsConstants.COMMON_YES); //默认开启预订餐
|
||||||
try {
|
try {
|
||||||
AllocCanteen checkResult = allocCanteenMapper.selectAllocCanteenByCanteenName(allocCanteen.getCanteenName());
|
AllocCanteen checkResult = allocCanteenMapper.selectAllocCanteenByCanteenName(allocCanteen);
|
||||||
if (Objects.nonNull(checkResult)) {
|
if (Objects.nonNull(checkResult)) {
|
||||||
throw new ServiceException("食堂名称已存在");
|
throw new ServiceException("食堂名称已存在");
|
||||||
}
|
}
|
||||||
|
|
@ -84,6 +84,7 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService {
|
||||||
try {
|
try {
|
||||||
List<AllocCanteen> allCanteenList = allocCanteenMapper.selectAllocCanteenList(new AllocCanteen());
|
List<AllocCanteen> allCanteenList = allocCanteenMapper.selectAllocCanteenList(new AllocCanteen());
|
||||||
List<String> otherCanteenNameList = allCanteenList.stream().filter(item -> !item.getCanteenId().equals(allocCanteen.getCanteenId()))
|
List<String> otherCanteenNameList = allCanteenList.stream().filter(item -> !item.getCanteenId().equals(allocCanteen.getCanteenId()))
|
||||||
|
.filter(item -> item.getAreaId().equals(allocCanteen.getAreaId()))
|
||||||
.map(AllocCanteen::getCanteenName).collect(Collectors.toList());
|
.map(AllocCanteen::getCanteenName).collect(Collectors.toList());
|
||||||
if (otherCanteenNameList.contains(allocCanteen.getCanteenName())) {
|
if (otherCanteenNameList.contains(allocCanteen.getCanteenName())) {
|
||||||
throw new ServiceException("食堂名称已存在");
|
throw new ServiceException("食堂名称已存在");
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where ac.canteen_id = #{canteenId}
|
where ac.canteen_id = #{canteenId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllocCanteenByCanteenName" parameterType="String" resultMap="AllocCanteenResult">
|
<select id="selectAllocCanteenByCanteenName" parameterType="com.bonus.canteen.core.alloc.domain.AllocCanteen" resultMap="AllocCanteenResult">
|
||||||
<include refid="selectAllocCanteenVo"/>
|
<include refid="selectAllocCanteenVo"/>
|
||||||
where ac.canteen_name = #{canteenName}
|
where ac.canteen_name = #{canteenName} and ac.area_id = #{areaId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertAllocCanteen" parameterType="com.bonus.canteen.core.alloc.domain.AllocCanteen" useGeneratedKeys="true" keyProperty="canteenId">
|
<insert id="insertAllocCanteen" parameterType="com.bonus.canteen.core.alloc.domain.AllocCanteen" useGeneratedKeys="true" keyProperty="canteenId">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue