You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.8 KiB
77 lines
1.8 KiB
package com.kms.system.service;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.kms.common.utils.UserUtils;
|
|
import com.kms.system.domain.SysXzqh;
|
|
import com.kms.system.mapper.SysXzqhMapper;
|
|
import com.shuili.common.core.domain.entity.SysDept;
|
|
import com.shuili.common.core.domain.entity.SysUser;
|
|
import com.shuili.common.core.service.BaseService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
/**
|
|
* 行政区划Service接口
|
|
*
|
|
* @author kms
|
|
* @date 2023-12-04
|
|
*/
|
|
@Service
|
|
public class SysXzqhService extends BaseService<SysXzqhMapper, SysXzqh> {
|
|
|
|
@Autowired
|
|
private SysXzqhMapper sysXzqhMapper;
|
|
|
|
@Autowired
|
|
private SysDeptService sysDeptService;
|
|
|
|
|
|
public String getSubString(String adcd) {
|
|
SysXzqh sysXzqh = sysXzqhMapper.selectOne(Wrappers.lambdaQuery(SysXzqh.class)
|
|
.eq(SysXzqh::getXzqhdm, adcd));
|
|
|
|
if (sysXzqh == null) {
|
|
return null;
|
|
}
|
|
|
|
|
|
if (sysXzqh.getLayer() == 1) {
|
|
return sysXzqh.getXzqhdm().substring(0, 2);
|
|
} else if (sysXzqh.getLayer() == 2) {
|
|
return sysXzqh.getXzqhdm().substring(0, 4);
|
|
}else {
|
|
return sysXzqh.getXzqhdm();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public Integer getLayer() {
|
|
SysUser user = UserUtils.getUser();
|
|
String deptId = user.getDeptId();
|
|
|
|
SysDept sysDept = sysDeptService.getById(deptId);
|
|
|
|
SysXzqh sysXzqh = sysXzqhMapper.selectById(sysDept.getXzqhId());
|
|
|
|
return sysXzqh.getLayer();
|
|
|
|
}
|
|
|
|
public String getXzqh() {
|
|
SysUser user = UserUtils.getUser();
|
|
String deptId = user.getDeptId();
|
|
|
|
SysDept sysDept = sysDeptService.getById(deptId);
|
|
|
|
SysXzqh sysXzqh = sysXzqhMapper.selectById(sysDept.getXzqhId());
|
|
|
|
return sysXzqh.getXzqhdm();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|