商户下拉,每日菜谱接口修改
This commit is contained in:
1 parent
a37cf364c8
commit
5d2d7b07be
10 files changed
+113
-8
No files matched your search
+1
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.canteen.dto;
|
||||
|
||||
import com.bsd.pjcloud.canteen.vo.DailyMenuVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.bsd.pjcloud.canteen.dto;
|
||||
package com.bsd.pjcloud.canteen.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.canteen.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MerchantInfoVO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@Schema(description="编号")
|
||||
private Long id;
|
||||
/**
|
||||
* 商户名
|
||||
*/
|
||||
@Schema(description="商户名")
|
||||
private String name;
|
||||
}
|
||||
+29
@@ -2,11 +2,13 @@ package com.bsd.pjcloud.canteen.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.canteen.vo.MerchantInfoVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.canteen.entity.MerchantInfoEntity;
|
||||
@@ -86,6 +88,21 @@ public class MerchantInfoController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_merchantInfo_add')" )
|
||||
public R save(@RequestBody MerchantInfoEntity merchantInfo) {
|
||||
|
||||
LambdaQueryWrapper<MerchantInfoEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(MerchantInfoEntity::getName, merchantInfo.getName());
|
||||
boolean isMerchantNameExists = merchantInfoService.exists(wrapper);
|
||||
|
||||
wrapper.clear();
|
||||
wrapper.eq(MerchantInfoEntity::getDeptId, merchantInfo.getDeptId());
|
||||
boolean isDepartmentAlreadyBound = merchantInfoService.exists(wrapper);
|
||||
|
||||
if (isMerchantNameExists) {
|
||||
return R.failed("商户名称已存在");
|
||||
}
|
||||
if (isDepartmentAlreadyBound) {
|
||||
return R.failed("部门已被绑定");
|
||||
}
|
||||
return R.ok(merchantInfoService.save(merchantInfo));
|
||||
}
|
||||
|
||||
@@ -128,4 +145,16 @@ public class MerchantInfoController {
|
||||
public List<MerchantInfoEntity> export(MerchantInfoEntity merchantInfo,Long[] ids) {
|
||||
return merchantInfoService.list(Wrappers.lambdaQuery(merchantInfo).in(ArrayUtil.isNotEmpty(ids), MerchantInfoEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得商户下拉框
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectMerchantList")
|
||||
@Operation(summary = "获得商户下拉框")
|
||||
public R<List<MerchantInfoVO>> selectMerchantList(@RequestParam(value = "type",required = false)String type) {
|
||||
List<MerchantInfoVO> list=merchantInfoService.selectMerchantList(type);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuVO;
|
||||
import com.bsd.pjcloud.canteen.vo.DailyMenuVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
|
||||
+10
@@ -2,7 +2,17 @@ package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.entity.MerchantInfoEntity;
|
||||
import com.bsd.pjcloud.canteen.vo.MerchantInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MerchantInfoService extends IService<MerchantInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户类型,获取商户下拉列表
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<MerchantInfoVO> selectMerchantList(String type);
|
||||
}
|
||||
+1
-4
@@ -1,15 +1,12 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuVO;
|
||||
import com.bsd.pjcloud.canteen.vo.DailyMenuVO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
|
||||
+26
@@ -1,10 +1,18 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.entity.MerchantInfoEntity;
|
||||
import com.bsd.pjcloud.canteen.mapper.MerchantInfoMapper;
|
||||
import com.bsd.pjcloud.canteen.service.MerchantInfoService;
|
||||
import com.bsd.pjcloud.canteen.vo.MerchantInfoVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 商户管理
|
||||
*
|
||||
@@ -13,4 +21,22 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class MerchantInfoServiceImpl extends ServiceImpl<MerchantInfoMapper, MerchantInfoEntity> implements MerchantInfoService {
|
||||
@Override
|
||||
public List<MerchantInfoVO> selectMerchantList(String type) {
|
||||
LambdaQueryWrapper<MerchantInfoEntity> merchantInfoEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
merchantInfoEntityLambdaQueryWrapper.eq(StrUtil.isNotBlank(type), MerchantInfoEntity::getMerchantType, type);
|
||||
List<MerchantInfoEntity> result = baseMapper.selectListByScope(merchantInfoEntityLambdaQueryWrapper, new DataScope());
|
||||
|
||||
List<MerchantInfoVO> voList = result.stream()
|
||||
.map(entity -> {
|
||||
MerchantInfoVO vo = new MerchantInfoVO();
|
||||
vo.setId(entity.getId());
|
||||
vo.setName(entity.getName());
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
return voList;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<select id="selectTimeFood" resultType="com.bsd.pjcloud.canteen.dto.DailyMenuVO">
|
||||
<select id="selectTimeFood" resultType="com.bsd.pjcloud.canteen.vo.DailyMenuVO">
|
||||
SELECT
|
||||
sp.id,
|
||||
t.id as tid,
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.bsd.pjcloud.common.core.constant.enums;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum MerchantTypeEnum {
|
||||
CANTEEN("1", "食堂"),
|
||||
SUPERMARKET("2", "超市"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String name;
|
||||
}
|
||||
Reference in new issue
Block a user