优化租户配置;优化小程序首页接口
This commit is contained in:
parent
fea2186856
commit
b9da0c7d40
|
@ -140,6 +140,14 @@ tenant:
|
|||
- sys_user_role
|
||||
- sys_client
|
||||
- sys_oss_config
|
||||
- sys_oss
|
||||
- m_counselor
|
||||
- m_counselor_experience
|
||||
- m_counselor_qualification
|
||||
- m_reservation_day
|
||||
- m_reservation_order
|
||||
- m_reservation_time
|
||||
- m_score_record
|
||||
|
||||
# MyBatisPlus配置
|
||||
# https://baomidou.com/config/
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package org.dromara.scale.controller.wx;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
|
@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
|
@ -38,6 +40,7 @@ public class WxScaleController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo<SysScaleVo> pageList(SysScaleBo bo, PageQuery pageQuery) {
|
||||
bo.setOrderBy("num");
|
||||
return sysScaleService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
@ -45,8 +48,11 @@ public class WxScaleController extends BaseController {
|
|||
* 查询心理测评量列表,默认展示两条数据
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<SysScaleVo>> list(@NotBlank(message = "类型不能为空") String scaleType) {
|
||||
return R.ok(sysScaleService.queryWxList(scaleType));
|
||||
public R<Map<String, List<SysScaleVo>>> list(String[] scaleType) {
|
||||
if (ObjectUtil.isEmpty(scaleType)) {
|
||||
throw new ServiceException("类型不能为空");
|
||||
}
|
||||
return R.ok(sysScaleService.queryWxMapList(scaleType));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,4 +122,6 @@ public class SysScaleBo extends BaseEntity {
|
|||
private Integer freeFlag;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private String orderBy;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.dromara.scale.domain.vo.SysScaleVo;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 心理测评量Service接口
|
||||
|
@ -46,5 +47,5 @@ public interface ISysScaleService {
|
|||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<SysScaleVo> queryWxList(String scaleType);
|
||||
Map<String,List<SysScaleVo>> queryWxMapList(String[] scaleType);
|
||||
}
|
||||
|
|
|
@ -24,9 +24,7 @@ import org.dromara.system.mapper.SysOssMapper;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +67,11 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
@Override
|
||||
public TableDataInfo<SysScaleVo> queryPageList(SysScaleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysScale> lqw = buildQueryWrapper(bo);
|
||||
lqw.orderByDesc(SysScale::getUpdateTime);
|
||||
if ("num".equals(bo.getOrderBy())) {
|
||||
lqw.orderByDesc(SysScale::getPublishNums);
|
||||
} else {
|
||||
lqw.orderByDesc(SysScale::getUpdateTime);
|
||||
}
|
||||
Page<SysScaleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
for (SysScaleVo record : result.getRecords()) {
|
||||
List<SysDictDataVo> scaleTypeList = sysDictDataMapper.selectDictDataByTypeAndDictValue("scale_type", StrUtil.join(StrUtil.COMMA, record.getScaleType()));
|
||||
|
@ -148,11 +150,16 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysScaleVo> queryWxList(String scaleType) {
|
||||
LambdaQueryWrapper<SysScale> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(SysScale::getScaleType, scaleType);
|
||||
lqw.orderByDesc(SysScale::getPublishNums);
|
||||
lqw.last("limit 2");
|
||||
return baseMapper.selectVoList(lqw);
|
||||
public Map<String,List<SysScaleVo>> queryWxMapList(String[] scaleType) {
|
||||
Map<String, List<SysScaleVo>> map = new HashMap<>(scaleType.length);
|
||||
for (String s : scaleType) {
|
||||
LambdaQueryWrapper<SysScale> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.like(SysScale::getScaleType, s);
|
||||
lqw.orderByDesc(SysScale::getPublishNums);
|
||||
lqw.last("limit 2");
|
||||
List<SysScaleVo> list = baseMapper.selectVoList(lqw);
|
||||
map.put(s, list);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue