|
@ -28,6 +28,7 @@ package com.yxt.anrui.as.biz.asservicetype; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.yxt.anrui.as.feign.portal.sysstafforg.SysStaffOrgFeign; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
@ -39,6 +40,7 @@ import com.yxt.anrui.as.api.asservicetype.AsServiceTypeVo; |
|
|
import com.yxt.anrui.as.api.asservicetype.AsServiceTypeDetailsVo; |
|
|
import com.yxt.anrui.as.api.asservicetype.AsServiceTypeDetailsVo; |
|
|
import com.yxt.anrui.as.api.asservicetype.AsServiceTypeDto; |
|
|
import com.yxt.anrui.as.api.asservicetype.AsServiceTypeDto; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -56,51 +58,54 @@ import org.springframework.stereotype.Service; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class AsServiceTypeService extends MybatisBaseService<AsServiceTypeMapper, AsServiceType> { |
|
|
public class AsServiceTypeService extends MybatisBaseService<AsServiceTypeMapper, AsServiceType> { |
|
|
private QueryWrapper<AsServiceType> createQueryWrapper(AsServiceTypeQuery query) { |
|
|
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@Autowired |
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
QueryWrapper<AsServiceType> qw = new QueryWrapper<>(); |
|
|
|
|
|
return qw; |
|
|
public PagerVo<AsServiceTypeVo> listPageVo(PagerQuery<AsServiceTypeQuery> pq) { |
|
|
} |
|
|
AsServiceTypeQuery query = pq.getParams(); |
|
|
|
|
|
QueryWrapper<AsServiceType> qw = new QueryWrapper<>(); |
|
|
public PagerVo<AsServiceTypeVo> listPageVo(PagerQuery<AsServiceTypeQuery> pq) { |
|
|
if (StringUtils.isNotBlank(query.getServiceTypeName())){ |
|
|
AsServiceTypeQuery query = pq.getParams(); |
|
|
qw.like("serviceTypeName", query.getServiceTypeName()); |
|
|
QueryWrapper<AsServiceType> qw = createQueryWrapper(query); |
|
|
} |
|
|
IPage<AsServiceType> page = PagerUtil.queryToPage(pq); |
|
|
IPage<AsServiceType> page = PagerUtil.queryToPage(pq); |
|
|
IPage<AsServiceTypeVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
IPage<AsServiceTypeVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
PagerVo<AsServiceTypeVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
PagerVo<AsServiceTypeVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
return p; |
|
|
return p; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void saveOrUpdateDto(AsServiceTypeDto dto){ |
|
|
public void saveOrUpdateDto(AsServiceTypeDto dto) { |
|
|
String dtoSid = dto.getSid(); |
|
|
String dtoSid = dto.getSid(); |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
|
|
String orgPath = dto.getOrgPath(); |
|
|
|
|
|
String createOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
|
|
dto.setCreateOrgSid(createOrgSid); |
|
|
this.insertByDto(dto); |
|
|
this.insertByDto(dto); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
this.updateByDto(dto); |
|
|
this.updateByDto(dto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void insertByDto(AsServiceTypeDto dto){ |
|
|
public void insertByDto(AsServiceTypeDto dto) { |
|
|
AsServiceType entity = new AsServiceType(); |
|
|
AsServiceType entity = new AsServiceType(); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
baseMapper.insert(entity); |
|
|
baseMapper.insert(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void updateByDto(AsServiceTypeDto dto){ |
|
|
public void updateByDto(AsServiceTypeDto dto) { |
|
|
String dtoSid = dto.getSid(); |
|
|
String dtoSid = dto.getSid(); |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
AsServiceType entity = fetchBySid(dtoSid); |
|
|
AsServiceType entity = fetchBySid(dtoSid); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
baseMapper.updateById(entity); |
|
|
baseMapper.updateById(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public AsServiceTypeDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
public AsServiceTypeDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
AsServiceType entity = fetchBySid(sid); |
|
|
AsServiceType entity = fetchBySid(sid); |
|
|
AsServiceTypeDetailsVo vo = new AsServiceTypeDetailsVo(); |
|
|
AsServiceTypeDetailsVo vo = new AsServiceTypeDetailsVo(); |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |