Commit f2a77f6c authored by mengmeng's avatar mengmeng

修改服务大类展示接口service表数据

parent f7108ae9
...@@ -66,6 +66,39 @@ public class PensionServiceController { ...@@ -66,6 +66,39 @@ public class PensionServiceController {
} }
@GetMapping("getByServiceId/{serviceId}")
@ApiOperation("根据服务获取详情页面")
public Result<PensionServiceDTO> getByServiceId(@PathVariable("serviceId") Long serviceId){
PensionServiceDTO data = pensionServiceService.get(serviceId);
return new Result<PensionServiceDTO>().ok(data);
}
@GetMapping("getSecondListByServiceId")
@ApiOperation("根据服务id获取二级列表--可查询免费")
@ApiImplicitParams({
@ApiImplicitParam(name = "isFree", value = "是否免费:1 是, 2 否", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "pid", value = "服务大类ID", paramType = "query", dataType="int")
})
public Result<List<PensionServiceDTO>> getSecondListByServiceId(@ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceDTO> data = pensionServiceService.list(params);
return new Result<List<PensionServiceDTO>>().ok(data);
}
@GetMapping("getServiceList")
@ApiOperation("老人/子女服务大类--包含免费")
@ApiImplicitParams({
@ApiImplicitParam(name = "isFree", value = "是否免费:1 是, 2 否", paramType = "query", dataType="String")
})
public Result<List<PensionServiceDTO>> getServiceList(@ApiIgnore @RequestParam Map<String, Object> params){
List<PensionServiceDTO> data = pensionServiceService.getFirstServiceList(params);
return new Result<List<PensionServiceDTO>>().ok(data);
}
/*
//V1 根据serviceType 获取服务大类
@GetMapping("getByServiceTypeId/{serviceTypeId}") @GetMapping("getByServiceTypeId/{serviceTypeId}")
@ApiOperation("根据服务大类获取详情") @ApiOperation("根据服务大类获取详情")
public Result<PensionServiceDTO> getByServiceTypeId(@PathVariable("serviceTypeId") Long serviceTypeId){ public Result<PensionServiceDTO> getByServiceTypeId(@PathVariable("serviceTypeId") Long serviceTypeId){
...@@ -76,6 +109,7 @@ public class PensionServiceController { ...@@ -76,6 +109,7 @@ public class PensionServiceController {
return new Result<PensionServiceDTO>().ok(data.get(0)); return new Result<PensionServiceDTO>().ok(data.get(0));
} }
*/
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
public Result save(@RequestBody PensionServiceDTO dto){ public Result save(@RequestBody PensionServiceDTO dto){
......
...@@ -25,8 +25,8 @@ public class PensionServiceDTO implements Serializable { ...@@ -25,8 +25,8 @@ public class PensionServiceDTO implements Serializable {
@ApiModelProperty(value = "服务名称") @ApiModelProperty(value = "服务名称")
private String serviceName; private String serviceName;
@ApiModelProperty(value = "服务类型") @ApiModelProperty(value = "服务父类id")
private Long serviceTypeId; private Long pid;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort; private Integer sort;
...@@ -52,20 +52,4 @@ public class PensionServiceDTO implements Serializable { ...@@ -52,20 +52,4 @@ public class PensionServiceDTO implements Serializable {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "部门ID")
private Long deptId;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "更新者")
private Long updater;
@ApiModelProperty(value = "更新时间")
private Date updateDate;
} }
...@@ -27,9 +27,9 @@ public class PensionServiceEntity extends BaseEntity { ...@@ -27,9 +27,9 @@ public class PensionServiceEntity extends BaseEntity {
// @Property(value = "name") // @Property(value = "name")
private String serviceName; private String serviceName;
/** /**
* 服务类型 * 服务父类id
*/ */
private Long serviceTypeId; private Long pid;
/** /**
* 排序 * 排序
*/ */
......
...@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService; ...@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity; import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
import java.util.List;
import java.util.Map;
/** /**
* 服务表 * 服务表
* *
...@@ -12,4 +15,5 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceEntity; ...@@ -12,4 +15,5 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
*/ */
public interface PensionServiceService extends CrudService<PensionServiceEntity, PensionServiceDTO> { public interface PensionServiceService extends CrudService<PensionServiceEntity, PensionServiceDTO> {
List<PensionServiceDTO> getFirstServiceList(Map<String, Object> params);
} }
...@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.service.impl; ...@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionServiceDao; import io.hmit.modules.serviceOrder.dao.PensionServiceDao;
import io.hmit.modules.serviceOrder.dto.PensionServiceDTO; import io.hmit.modules.serviceOrder.dto.PensionServiceDTO;
import io.hmit.modules.serviceOrder.entity.PensionServiceEntity; import io.hmit.modules.serviceOrder.entity.PensionServiceEntity;
...@@ -9,6 +10,8 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService; ...@@ -9,6 +10,8 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,17 +27,38 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao ...@@ -24,17 +27,38 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
@Override @Override
public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<PensionServiceEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
String serviceTypeId = params.get("serviceTypeId") ==null?"":params.get("serviceTypeId").toString(); String pid = params.get("pid") ==null?"":params.get("pid").toString();
String isFree = (String)params.get("isFree"); String isFree = (String)params.get("isFree");
QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>(); QueryWrapper<PensionServiceEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(serviceTypeId), "service_type_id", serviceTypeId); wrapper.eq(StringUtils.isNotBlank(pid), "pid", pid);
wrapper.eq(StringUtils.isNotBlank(isFree), "is_free", isFree); wrapper.eq(StringUtils.isNotBlank(isFree), "is_free", isFree);
return wrapper; return wrapper;
} }
@Override
public List<PensionServiceDTO> getFirstServiceList(Map<String, Object> params) {
String isFree = (String)params.get("isFree");
List<PensionServiceEntity> pensionServiceLists = baseDao.selectList(
new QueryWrapper<PensionServiceEntity>().eq("pid",0));
if(!"".equals(isFree) && isFree != null){
List<PensionServiceEntity> entityList = new ArrayList<>();
pensionServiceLists.stream().forEach(item->{
Map<String, Object> pid = new HashMap<>();
pid.put("pid",item.getId());
pid.put("isFree",isFree);
if(list(pid).size()>0){
entityList.add(item);
}
});
return ConvertUtils.sourceToTarget(entityList,PensionServiceDTO.class) ;
}
return ConvertUtils.sourceToTarget(pensionServiceLists,PensionServiceDTO.class) ;
}
} }
...@@ -89,10 +89,12 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic ...@@ -89,10 +89,12 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic
// pensionServices.stream().collect(Collectors.groupingBy(PensionServiceEntity::getServiceTypeId)) // pensionServices.stream().collect(Collectors.groupingBy(PensionServiceEntity::getServiceTypeId))
List<PensionServiceTypeDTO> resultList = new ArrayList<>(); List<PensionServiceTypeDTO> resultList = new ArrayList<>();
/*
for (PensionServiceEntity pensionService:pensionServices) { for (PensionServiceEntity pensionService:pensionServices) {
PensionServiceTypeDTO pensionServiceTypeDTO = get(pensionService.getServiceTypeId()); PensionServiceTypeDTO pensionServiceTypeDTO = get(pensionService.getServiceTypeId());
resultList.add(pensionServiceTypeDTO); resultList.add(pensionServiceTypeDTO);
} }
*/
return resultList; return resultList;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment