This commit is contained in:
2024-07-18 08:45:15 +08:00
parent 36da05117f
commit 22d709fdc4
17 changed files with 150 additions and 14 deletions

View File

@@ -61,8 +61,7 @@ public class SupplierInfoRest {
@PostMapping("/listPage")
public ResultBean<PagerVo<SupplierInfoVo>> listPage(@RequestBody PagerQuery<SupplierInfoQuery> pq){
ResultBean rb = ResultBean.fireFail();
PagerVo<SupplierInfoVo> pv = SupplierInfoService.listPageVo(pq);
return rb.success().setData(pv);
return SupplierInfoService.listPageVo(pq);
}
@ApiOperation("新增或修改或")

View File

@@ -61,8 +61,7 @@ public class SupplierTypeRest {
@PostMapping("/listPage")
public ResultBean<PagerVo<SupplierTypeVo>> listPage(@RequestBody PagerQuery<SupplierTypeQuery> pq){
ResultBean rb = ResultBean.fireFail();
PagerVo<SupplierTypeVo> pv = supplierTypeService.listPageVo(pq);
return rb.success().setData(pv);
return supplierTypeService.listPageVo(pq);
}
@ApiOperation("新增或修改")

View File

@@ -113,4 +113,6 @@ public class SupplierInfoDetailsVo implements Vo {
private String createOrgSid; // 创建组织sid
@ApiModelProperty("供应商开户行")
private List<SupplierBankDetailsVo> baseSupplierBankList;
private String userSid;
private String orgPath;
}

View File

@@ -113,4 +113,6 @@ public class SupplierInfoDto implements Dto {
private String createOrgSid; // 创建组织sid
@ApiModelProperty("开户行信息")
private List<SupplierBankDto> baseSupplierBankList;
private String userSid;
private String orgPath;
}

View File

@@ -53,7 +53,7 @@ import java.util.List;
public interface SupplierInfoMapper extends BaseMapper<SupplierInfo> {
IPage<SupplierInfoVo> selectPageVo(IPage<SupplierInfo> page, @Param(Constants.WRAPPER) Wrapper<SupplierInfo> qw);
List<SupplierInfoVo> listAll(@Param("orgPath")String orgPath);
List<SupplierInfoVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SupplierInfo> qw);
@Select("select * from supplier_info")

View File

@@ -4,9 +4,19 @@
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.yxt.supplier.biz.supplierinfo.SupplierInfoVo">
SELECT * FROM supplier_info <where> ${ew.sqlSegment} </where>
SELECT * FROM supplier_info a
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
<where> ${ew.sqlSegment} </where>
</select>
<select id="listAll" resultType="com.yxt.supplier.biz.supplierinfo.SupplierInfoVo">
select
*
from supplier_info a
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
<where>
s.orgSidPath like #{orgPath} and a.isDelete !='1'
</where>
</select>
<select id="selectListAllVo" resultType="com.yxt.supplier.biz.supplierinfo.SupplierInfoVo">
SELECT * FROM supplier_info <where> ${ew.sqlSegment} </where>
</select>

View File

@@ -59,4 +59,12 @@ public class SupplierInfoQuery implements Query {
@ApiModelProperty("其他查询条件")
private String otherQuery;
private String orgLevelKey;//
private int index;//下标
@ApiModelProperty("菜单路由")
private String menuUrl;
@ApiModelProperty("组织全路径sid")
private String orgPath;
@ApiModelProperty("用户sid")
private String userSid;
}

View File

@@ -41,6 +41,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -62,9 +63,35 @@ public class SupplierInfoService extends MybatisBaseService<SupplierInfoMapper,
@Autowired
private SupplierBankService supplierBankService;
public PagerVo<SupplierInfoVo> listPageVo(PagerQuery<SupplierInfoQuery> pq) {
public ResultBean<PagerVo<SupplierInfoVo>> listPageVo(PagerQuery<SupplierInfoQuery> pq) {
ResultBean rb = ResultBean.fireFail();
SupplierInfoQuery query = pq.getParams();
QueryWrapper<SupplierInfo> qw = new QueryWrapper<SupplierInfo>();
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.getSupplierName())){
qw.like("supplierName",query.getSupplierName());
}
@@ -84,7 +111,7 @@ public class SupplierInfoService extends MybatisBaseService<SupplierInfoMapper,
IPage<SupplierInfo> page = PagerUtil.queryToPage(pq);
IPage<SupplierInfoVo> pagging = baseMapper.selectPageVo(page, qw);
PagerVo<SupplierInfoVo> p = PagerUtil.pageToVo(pagging, null);
return p;
return rb.success().setData(p);
}
public ResultBean saveOrUpdateDto(SupplierInfoDto dto){
@@ -123,6 +150,9 @@ public class SupplierInfoService extends MybatisBaseService<SupplierInfoMapper,
public String insertByDto(SupplierInfoDto dto){
SupplierInfo entity = new SupplierInfo();
BeanUtil.copyProperties(dto, entity, "id", "sid");
entity.setCreateBySid(dto.getUserSid());
entity.setCreateOrgSid(dto.getOrgPath());
entity.setUseOrgSid(dto.getOrgPath());
baseMapper.insert(entity);
return entity.getSid();
}
@@ -134,6 +164,7 @@ public class SupplierInfoService extends MybatisBaseService<SupplierInfoMapper,
}
SupplierInfo entity = fetchBySid(dtoSid);
BeanUtil.copyProperties(dto, entity, "id", "sid");
entity.setModifyTime(new Date());
baseMapper.updateById(entity);
}
@@ -143,6 +174,7 @@ public class SupplierInfoService extends MybatisBaseService<SupplierInfoMapper,
BeanUtil.copyProperties(entity, vo);
List<SupplierBankDetailsVo> supplierBankDetailsVos = supplierBankService.selectBySupplierSid(sid);
vo.setBaseSupplierBankList(supplierBankDetailsVos);
vo.setOrgPath(vo.getUseOrgSid());
return vo;
}

View File

@@ -62,4 +62,8 @@ public class SupplierInfoVo implements Vo {
private String contactName;
@ApiModelProperty("手机")
private String contactMobile;
private String useOrgSid;
private String createOrgSid;//创建组织sid
private String userSid;
private String orgPath;
}

View File

@@ -59,5 +59,7 @@ public class SupplierTypeDetailsVo implements Vo {
private String createOrgName; // 创建组织名称
@ApiModelProperty("创建组织sid")
private String createOrgSid; // 创建组织sid
private String userSid;
private String orgPath;
}

View File

@@ -60,5 +60,7 @@ public class SupplierTypeDto implements Dto {
private String createOrgName; // 创建组织名称
@ApiModelProperty("创建组织sid")
private String createOrgSid; // 创建组织sid
private String userSid;
private String orgPath;
}

View File

@@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yxt.supplier.biz.supplierinfo.SupplierInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@@ -52,7 +53,7 @@ import java.util.List;
public interface SupplierTypeMapper extends BaseMapper<SupplierType> {
IPage<SupplierTypeVo> selectPageVo(IPage<SupplierType> page, @Param(Constants.WRAPPER) Wrapper<SupplierType> qw);
List<SupplierTypeVo> listAll(@Param("orgPath")String orgPath);
List<SupplierTypeVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SupplierType> qw);
@Select("select * from supplier_type")

View File

@@ -4,7 +4,18 @@
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.yxt.supplier.biz.suppliertype.SupplierTypeVo">
SELECT * FROM supplier_type <where> ${ew.sqlSegment} </where>
SELECT * FROM supplier_type a
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
<where> ${ew.sqlSegment} </where>
</select>
<select id="listAll" resultType="com.yxt.supplier.biz.suppliertype.SupplierTypeVo">
select
*
from supplier_type a
LEFT JOIN ss_user.sys_organization as s ON a.useOrgSid = s.sid
<where>
s.orgSidPath like #{orgPath} and a.isDelete !='1'
</where>
</select>
<select id="selectListAllVo" resultType="com.yxt.supplier.biz.suppliertype.SupplierTypeVo">

View File

@@ -58,5 +58,14 @@ public class SupplierTypeQuery implements Query {
private String createOrgName; // 创建组织名称
@ApiModelProperty("创建组织sid")
private String createOrgSid; // 创建组织sid
private String orgLevelKey;//
private int index;//下标
@ApiModelProperty("菜单路由")
private String menuUrl;
@ApiModelProperty("组织全路径sid")
private String orgPath;
@ApiModelProperty("用户sid")
private String userSid;
}

View File

@@ -33,8 +33,11 @@ import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.supplier.biz.supplierinfo.SupplierInfoVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@@ -53,13 +56,45 @@ import java.util.List;
@Service
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();
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<SupplierTypeVo> pagging = baseMapper.selectPageVo(page, qw);
PagerVo<SupplierTypeVo> p = PagerUtil.pageToVo(pagging, null);
return p;
return rb.success().setData(p);
}
public void saveOrUpdateDto(SupplierTypeDto dto){
@@ -74,6 +109,9 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper,
public void insertByDto(SupplierTypeDto dto){
SupplierType entity = new SupplierType();
BeanUtil.copyProperties(dto, entity, "id", "sid");
entity.setCreateBySid(dto.getUserSid());
entity.setCreateOrgSid(dto.getOrgPath());
entity.setUseOrgSid(dto.getOrgPath());
baseMapper.insert(entity);
}
@@ -84,6 +122,7 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper,
}
SupplierType entity = fetchBySid(dtoSid);
BeanUtil.copyProperties(dto, entity, "id", "sid");
entity.setModifyTime(new Date());
baseMapper.updateById(entity);
}
@@ -91,6 +130,7 @@ public class SupplierTypeService extends MybatisBaseService<SupplierTypeMapper,
SupplierType entity = fetchBySid(sid);
SupplierTypeDetailsVo vo = new SupplierTypeDetailsVo();
BeanUtil.copyProperties(entity, vo);
vo.setOrgPath(vo.getOrgPath());
return vo;
}
public ResultBean<Integer> checkSaveCode(String supplierTypeCode, String orgSid){

View File

@@ -60,5 +60,6 @@ public class SupplierTypeVo implements Vo {
private String createOrgName; // 创建组织名称
@ApiModelProperty("创建组织sid")
private String createOrgSid; // 创建组织sid
private String userSid;
private String orgPath;
}

View File

@@ -0,0 +1,14 @@
package com.yxt.supplier.utils;
import lombok.Data;
/**
* @author Fan
* @description
* @date 2024/5/17 14:15
*/
@Data
public class OrgPathQuery {
private String orgPath;
private String userOrgSid;
}