|
@ -33,8 +33,11 @@ import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
|
|
import com.yxt.supplier.biz.supplierinfo.SupplierInfoVo; |
|
|
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.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -53,13 +56,45 @@ import java.util.List; |
|
|
@Service |
|
|
@Service |
|
|
public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper, SupplierType> { |
|
|
public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper, SupplierType> { |
|
|
|
|
|
|
|
|
public PagerVo<SupplierTypeVo> listPageVo(PagerQuery<SupplierTypeQuery> pq) { |
|
|
public ResultBean<PagerVo<SupplierTypeVo>> listPageVo(PagerQuery<SupplierTypeQuery> pq) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
SupplierTypeQuery query = pq.getParams(); |
|
|
SupplierTypeQuery query = pq.getParams(); |
|
|
QueryWrapper<SupplierType> qw = new QueryWrapper<>(); |
|
|
QueryWrapper<SupplierType> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (com.yxt.common.base.utils.StringUtils.isNotBlank(query.getOrgLevelKey())) { |
|
|
|
|
|
//数据权限ID(1全部、2本部门及子部门、3本部门、4个人)
|
|
|
|
|
|
String orgLevelKey=query.getOrgLevelKey(); |
|
|
|
|
|
String orgSidPath=query.getOrgPath(); |
|
|
|
|
|
int index=query.getIndex(); |
|
|
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, index); |
|
|
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, index); |
|
|
|
|
|
qw.like("s.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, index); |
|
|
|
|
|
qw.apply("s.orgSidPath like('"+orgSidPath+"')"); |
|
|
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
|
|
qw.eq("a.createBySid", query.getUserSid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<SupplierInfoVo> p = new PagerVo<>(); |
|
|
|
|
|
return rb.success().setData(p); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<SupplierInfoVo> p = new PagerVo<>(); |
|
|
|
|
|
return rb.success().setData(p); |
|
|
|
|
|
} |
|
|
|
|
|
if(StringUtils.isNotBlank(query.getSupplierTypeName())){ |
|
|
|
|
|
qw.like("a.supplierTypeName",query.getSupplierTypeName()); |
|
|
|
|
|
} |
|
|
|
|
|
if(StringUtils.isNotBlank(query.getSupplierTypeCode())){ |
|
|
|
|
|
qw.like("a.supplierTypeCode",query.getSupplierTypeCode()); |
|
|
|
|
|
} |
|
|
IPage<SupplierType> page = PagerUtil.queryToPage(pq); |
|
|
IPage<SupplierType> page = PagerUtil.queryToPage(pq); |
|
|
IPage<SupplierTypeVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
IPage<SupplierTypeVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
PagerVo<SupplierTypeVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
PagerVo<SupplierTypeVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
return p; |
|
|
return rb.success().setData(p); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void saveOrUpdateDto(SupplierTypeDto dto){ |
|
|
public void saveOrUpdateDto(SupplierTypeDto dto){ |
|
@ -74,6 +109,9 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper, |
|
|
public void insertByDto(SupplierTypeDto dto){ |
|
|
public void insertByDto(SupplierTypeDto dto){ |
|
|
SupplierType entity = new SupplierType(); |
|
|
SupplierType entity = new SupplierType(); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
|
|
entity.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
entity.setCreateOrgSid(dto.getOrgPath()); |
|
|
|
|
|
entity.setUseOrgSid(dto.getOrgPath()); |
|
|
baseMapper.insert(entity); |
|
|
baseMapper.insert(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -84,6 +122,7 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper, |
|
|
} |
|
|
} |
|
|
SupplierType entity = fetchBySid(dtoSid); |
|
|
SupplierType entity = fetchBySid(dtoSid); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
|
|
entity.setModifyTime(new Date()); |
|
|
baseMapper.updateById(entity); |
|
|
baseMapper.updateById(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -91,6 +130,7 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper, |
|
|
SupplierType entity = fetchBySid(sid); |
|
|
SupplierType entity = fetchBySid(sid); |
|
|
SupplierTypeDetailsVo vo = new SupplierTypeDetailsVo(); |
|
|
SupplierTypeDetailsVo vo = new SupplierTypeDetailsVo(); |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
|
|
vo.setOrgPath(vo.getOrgPath()); |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
public ResultBean<Integer> checkSaveCode(String supplierTypeCode, String orgSid){ |
|
|
public ResultBean<Integer> checkSaveCode(String supplierTypeCode, String orgSid){ |
|
|