Merge branch 'ah-simple-test' of http://14.103.246.124:16000/bonus/Bonus-Cloud-Material-Mall into ah-simple-test
This commit is contained in:
commit
fce6571a8b
|
|
@ -426,11 +426,17 @@ public class BackChangeServiceImpl implements BackChangeService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// dto.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
dto.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
dto.setCompanyId(deptId);
|
dto.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapper.getList(dto);
|
return mapper.getList(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,4 +126,6 @@ public class CsDeviceChangeVo {
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
private String useTime;
|
private String useTime;
|
||||||
|
|
||||||
|
private Long companyId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -502,9 +502,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// dto.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
dto.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
dto.setCompanyId(deptId);
|
dto.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return mapper.getList(dto);
|
return mapper.getList(dto);
|
||||||
|
|
@ -857,9 +862,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// dto.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
dto.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
dto.setCompanyId(deptId);
|
dto.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return mapper.getOutboundList(dto);
|
return mapper.getOutboundList(dto);
|
||||||
|
|
@ -1137,7 +1147,13 @@ public class DevChangeServiceImpl implements DevChangeService {
|
||||||
vo.setEndTime(endTimeAfterAddOneDay.format(dateFormatter));
|
vo.setEndTime(endTimeAfterAddOneDay.format(dateFormatter));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
vo.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
|
vo.setCompanyId(deptId);
|
||||||
|
}
|
||||||
return mapper.getDevChangeList(vo);
|
return mapper.getDevChangeList(vo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,14 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// o.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
o.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
o.setCompanyId(deptId);
|
o.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
List<MaDevInfo> list = mapper.list(o);
|
List<MaDevInfo> list = mapper.list(o);
|
||||||
|
|
@ -248,12 +253,15 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
|
||||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && companyId != null
|
// if (userId != null && companyId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !companyId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !companyId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
// companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
} else {
|
// } else {
|
||||||
companyId = null;
|
// companyId = null;
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
companyId = 1L;
|
||||||
}
|
}
|
||||||
Integer totalCount = mapper.selectTotalDeviceCount(companyId);
|
Integer totalCount = mapper.selectTotalDeviceCount(companyId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,14 @@ public class MaDevRetireWarningServiceImpl implements MaDevRetireWarningService{
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// o.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
o.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
o.setCompanyId(deptId);
|
o.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return mapper.list(o);
|
return mapper.list(o);
|
||||||
|
|
|
||||||
|
|
@ -100,5 +100,7 @@ public class MaDevQc extends BaseEntity implements Serializable {
|
||||||
private String phonenumber;
|
private String phonenumber;
|
||||||
|
|
||||||
private String alert;
|
private String alert;
|
||||||
|
|
||||||
|
private Long companyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,8 +243,10 @@ public class DevMergeServiceImpl implements DevMergeService {
|
||||||
public AjaxResult interDevice(MaDevInfo maDevInfo) {
|
public AjaxResult interDevice(MaDevInfo maDevInfo) {
|
||||||
try {
|
try {
|
||||||
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
|
String province = SecurityUtils.getLoginUser().getSysUser().getDept().getProvince();
|
||||||
maDevInfo.setPropertyUnitId(Math.toIntExact(thisLoginUserDeptId));
|
maDevInfo.setPropertyUnitId(Math.toIntExact(thisLoginUserDeptId));
|
||||||
maDevInfo.setCode(getString());
|
maDevInfo.setCode(getString());
|
||||||
|
maDevInfo.setProvince(province);
|
||||||
Integer i = devMergeMapper.interDevice(maDevInfo);
|
Integer i = devMergeMapper.interDevice(maDevInfo);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
devInfoMapper.deleteDevInfoProperties(Long.valueOf(maDevInfo.getMaId()));
|
devInfoMapper.deleteDevInfoProperties(Long.valueOf(maDevInfo.getMaId()));
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.bonus.common.biz.constant.MaterialConstants.ADMIN_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ma_sh
|
* @Author ma_sh
|
||||||
* @create 2024/12/5 15:53
|
* @create 2024/12/5 15:53
|
||||||
|
|
@ -47,6 +49,13 @@ public class MaDevQcServiceImpl implements MaDevQcService {
|
||||||
@Override
|
@Override
|
||||||
public List<MaDevQc> selectDevQcList(MaDevQc maDevQc) {
|
public List<MaDevQc> selectDevQcList(MaDevQc maDevQc) {
|
||||||
maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
|
maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
|
||||||
|
Long userId = SecurityUtils.getLoginUser().getSysUser().getUserId();
|
||||||
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
maDevQc.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
|
maDevQc.setCompanyId(deptId);
|
||||||
|
}
|
||||||
return maDevQcMapper.selectDevQcList(maDevQc);
|
return maDevQcMapper.selectDevQcList(maDevQc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,14 @@ public class RepairServiceImpl implements RepairService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// bean.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
bean.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
bean.setCompanyId(deptId);
|
bean.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
List<ToBeRepair> list = mapper.getRepairList(bean);
|
List<ToBeRepair> list = mapper.getRepairList(bean);
|
||||||
|
|
|
||||||
|
|
@ -276,9 +276,14 @@ public class ToBeScrapServiceImpl implements ToBeScrapService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// bean.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
bean.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
bean.setCompanyId(deptId);
|
bean.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return scrapMapper.getScrapApplyList(bean);
|
return scrapMapper.getScrapApplyList(bean);
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,14 @@ public class ToolLedgerServiceImpl implements ToolLedgerService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// entity.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
entity.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return mapper.list(entity);
|
return mapper.list(entity);
|
||||||
|
|
@ -60,9 +65,14 @@ public class ToolLedgerServiceImpl implements ToolLedgerService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// entity.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
entity.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
List<ToolLedgerEntity> toolLedgerEntities = mapper.listCode(entity);
|
List<ToolLedgerEntity> toolLedgerEntities = mapper.listCode(entity);
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ public class UpOrDownEquipmentServiceImpl implements UpOrDownEquipmentService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
if(ADMIN_ID.equals(userId)){
|
||||||
&& !userId.equals(ADMIN_ID)
|
entity.setCompanyId(1L);
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
}else{
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,14 @@ public class UpOrDownToolServiceImpl implements UpOrDownToolService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// entity.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
entity.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
entity.setCompanyId(deptId);
|
entity.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
return upOrDownToolMapper.list(entity);
|
return upOrDownToolMapper.list(entity);
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,14 @@ public class WarehousingServiceImpl implements WarehousingService {
|
||||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||||
// 管理员和省公司可查看所有数据
|
// 管理员和省公司可查看所有数据
|
||||||
if (userId != null && deptId != null
|
// if (userId != null && deptId != null
|
||||||
&& !userId.equals(ADMIN_ID)
|
// && !userId.equals(ADMIN_ID)
|
||||||
&& !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
// && !deptId.equals(PROVINCE_COMPANY_DEPT_ID)) {
|
||||||
|
// warehousing.setCompanyId(deptId);
|
||||||
|
// }
|
||||||
|
if(ADMIN_ID.equals(userId)){
|
||||||
|
warehousing.setCompanyId(1L);
|
||||||
|
}else{
|
||||||
warehousing.setCompanyId(deptId);
|
warehousing.setCompanyId(deptId);
|
||||||
}
|
}
|
||||||
List<WarehousingEntity> warehousingEntities = mapper.selectList(warehousing);
|
List<WarehousingEntity> warehousingEntities = mapper.selectList(warehousing);
|
||||||
|
|
|
||||||
|
|
@ -547,8 +547,15 @@
|
||||||
<if test="useUnit != null and useUnit != ''">
|
<if test="useUnit != null and useUnit != ''">
|
||||||
and cd.use_unit = #{useUnit}
|
and cd.use_unit = #{useUnit}
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and companyId != 1 ">
|
||||||
and cd.company_id = #{companyId}
|
and cd.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
cd.id
|
cd.id
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select bca.id, bca.company_id, bca.province_code, bca.city_code, bca.area_code, bca.address, bca.create_time, bca.update_time,
|
select bca.id, bca.company_id, bca.province_code, bca.city_code, bca.area_code, bca.address, bca.create_time, bca.update_time,
|
||||||
b.name as area_name, b1.name as province_name, b2.name as city_name
|
b.name as area_name, b1.name as province_name, b2.name as city_name
|
||||||
from bm_company_address bca
|
from bm_company_address bca
|
||||||
LEFT JOIN base_address b ON b.code = bca.area_code
|
LEFT JOIN sys_cnarea b ON b.area_code = bca.area_code
|
||||||
LEFT JOIN base_address b1 on bca.province_code = b1.code
|
LEFT JOIN sys_cnarea b1 on bca.province_code = b1.area_code
|
||||||
LEFT JOIN base_address b2 on bca.city_code = b2.code
|
LEFT JOIN sys_cnarea b2 on bca.city_code = b2.area_code
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBmCompanyAddressList" parameterType="com.bonus.material.basic.domain.BmCompanyAddress" resultMap="BmCompanyAddressResult">
|
<select id="selectBmCompanyAddressList" parameterType="com.bonus.material.basic.domain.BmCompanyAddress" resultMap="BmCompanyAddressResult">
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,16 @@
|
||||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||||
and cds.create_time between #{startTime} and #{endTime}
|
and cds.create_time between #{startTime} and #{endTime}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="companyId !=null and companyId !=1" >
|
||||||
|
and cds.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
cds.id,
|
cds.id,
|
||||||
cds.change_status,
|
cds.change_status,
|
||||||
|
|
@ -567,8 +577,15 @@
|
||||||
<if test="proCode != null and proCode != ''">
|
<if test="proCode != null and proCode != ''">
|
||||||
and cd.pro_code = #{proCode}
|
and cd.pro_code = #{proCode}
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and companyId != 1 ">
|
||||||
and cd.company_id = #{companyId}
|
and cd.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
cd.id
|
cd.id
|
||||||
|
|
@ -719,8 +736,18 @@
|
||||||
<if test="taskStatus != null and taskStatus != ''">
|
<if test="taskStatus != null and taskStatus != ''">
|
||||||
AND temp.taskStatus = #{taskStatus}
|
AND temp.taskStatus = #{taskStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null and taskStatus != ''">
|
<!-- <if test="companyId != null and taskStatus != ''">-->
|
||||||
AND temp.companyId = #{companyId}
|
<!-- AND temp.companyId = #{companyId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<if test="companyId != null and companyId != 1 ">
|
||||||
|
AND temp.companyId
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -360,8 +360,15 @@
|
||||||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||||
<where>
|
<where>
|
||||||
mdi.is_active = '1' and mdi.entry_status = '1'
|
mdi.is_active = '1' and mdi.entry_status = '1'
|
||||||
<if test="companyId != null">
|
<if test="companyId !=null and companyId != 1">
|
||||||
AND mdi.on_company = #{companyId}
|
AND mdi.on_company
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="typeId != null and typeId != 0 ">
|
<if test="typeId != null and typeId != 0 ">
|
||||||
and (
|
and (
|
||||||
|
|
@ -527,8 +534,15 @@
|
||||||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||||
<where>
|
<where>
|
||||||
mdi.is_active = '1' and mdi.entry_status = '1'
|
mdi.is_active = '1' and mdi.entry_status = '1'
|
||||||
<if test="companyId != null">
|
<if test="companyId != nul and companyId != 1">
|
||||||
AND mdi.on_company = #{companyId}
|
AND mdi.on_company
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,15 @@
|
||||||
<if test="manufacturerId != null and manufacturerId != ''">
|
<if test="manufacturerId != null and manufacturerId != ''">
|
||||||
AND mdi.supplier_id like concat('%',#{manufacturerId},'%')
|
AND mdi.supplier_id like concat('%',#{manufacturerId},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId !=1 and companyId != null">
|
||||||
AND mdi.on_company = #{companyId}
|
AND mdi.on_company
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
) a
|
) a
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
|
|
@ -624,11 +624,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBaseAddress" resultType="com.bonus.common.biz.domain.BaseAddress">
|
<select id="getBaseAddress" resultType="com.bonus.common.biz.domain.BaseAddress">
|
||||||
select id,name,code from base_address
|
select id,name,area_code from sys_cnarea
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getBaseAddressById" resultType="String">
|
<select id="getBaseAddressById" resultType="String">
|
||||||
select name from base_address where id = #{id}
|
select name from sys_cnarea where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||||
|
|
@ -1772,7 +1772,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
0.0 AS valueC
|
0.0 AS valueC
|
||||||
FROM sys_dept sd
|
FROM sys_dept sd
|
||||||
-- 左连接设备表(过滤有效数据)
|
-- 左连接设备表(过滤有效数据)
|
||||||
LEFT JOIN base_address ba ON ba.code = sd.city
|
LEFT JOIN sys_cnarea ba ON ba.area_code = sd.city
|
||||||
LEFT JOIN ma_dev_info mdi
|
LEFT JOIN ma_dev_info mdi
|
||||||
ON mdi.on_company = sd.dept_id
|
ON mdi.on_company = sd.dept_id
|
||||||
AND mdi.change_status != '4'
|
AND mdi.change_status != '4'
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
#{manageType},
|
#{manageType},
|
||||||
#{code},
|
#{code},
|
||||||
'0',
|
'0',
|
||||||
'340000000000',
|
#{province},
|
||||||
#{propertyUnitId},
|
#{propertyUnitId},
|
||||||
<!-- 非必填字段对应值 -->
|
<!-- 非必填字段对应值 -->
|
||||||
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
|
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
#{manageType},
|
#{manageType},
|
||||||
#{code},
|
#{code},
|
||||||
'0',
|
'0',
|
||||||
'340000000000',
|
#{province},
|
||||||
#{propertyUnitId},
|
#{propertyUnitId},
|
||||||
<!-- 非必填字段对应值 -->
|
<!-- 非必填字段对应值 -->
|
||||||
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
|
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
|
||||||
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="qcCom != null and qcCom != ''">
|
<if test="companyId != null and companyId != 1 ">
|
||||||
and m2.on_company = #{qcCom}
|
and m2.on_company
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="alert != null and alert != ''">
|
<if test="alert != null and alert != ''">
|
||||||
<choose>
|
<choose>
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@
|
||||||
|
|
||||||
<select id="getCityName" resultType="java.lang.String">
|
<select id="getCityName" resultType="java.lang.String">
|
||||||
select name
|
select name
|
||||||
from base_address where code = #{city}
|
from sys_cnarea where area_code = #{city}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="getArea" resultType="com.bonus.common.biz.domain.vo.AreaVo">
|
<select id="getArea" resultType="com.bonus.common.biz.domain.vo.AreaVo">
|
||||||
select
|
select
|
||||||
id as areaId,
|
id as areaId,
|
||||||
`code` as areaCode,
|
area_code as areaCode,
|
||||||
parent_code as areaParentCode,
|
parent_code as areaParentCode,
|
||||||
name as areaName
|
name as areaName
|
||||||
from base_address
|
from sys_cnarea
|
||||||
where 1 = 1
|
where 1 = 1
|
||||||
<if test="areaCode == 0">
|
<if test="areaCode == 0">
|
||||||
and parent_code = 0
|
and parent_code = 0
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
IFNULL(totalSum,0) AS totalSum,
|
IFNULL(totalSum,0) AS totalSum,
|
||||||
IFNULL(ROUND((toolNum / totalSum) * 100, 2),0) AS toolPercent,
|
IFNULL(ROUND((toolNum / totalSum) * 100, 2),0) AS toolPercent,
|
||||||
IFNULL(ROUND((maNum / totalSum) * 100, 2),0) AS maPercent
|
IFNULL(ROUND((maNum / totalSum) * 100, 2),0) AS maPercent
|
||||||
FROM (SELECT ROUND(t1.toolNum) AS toolNum,
|
FROM (SELECT ROUND(IFNULL(t1.toolNum,0)) AS toolNum,
|
||||||
ROUND(t2.maNum) AS maNum,
|
ROUND(IFNULL(t2.maNum,0)) AS maNum,
|
||||||
ROUND(t1.toolNum) + ROUND(t2.maNum) AS totalSum
|
ROUND(IFNULL(t1.toolNum,0)) + ROUND(IFNULL(t2.maNum,0)) AS totalSum
|
||||||
FROM (SELECT SUM(total_num - scrap_num) AS toolNum FROM tool_ledger
|
FROM (SELECT SUM(total_num - scrap_num) AS toolNum FROM tool_ledger
|
||||||
<where>
|
<where>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null">
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
and mdi.on_company = #{companyId}
|
and mdi.on_company = #{companyId}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
) t2) AS temp;
|
) t2) AS temp
|
||||||
</select>
|
</select>
|
||||||
<select id="getUseDeviceNum" resultType="java.util.Map">
|
<select id="getUseDeviceNum" resultType="java.util.Map">
|
||||||
SELECT ROUND(IFNULL(t1.available_num, 0) + IFNULL(t2.available_num, 0)) AS availableNum,
|
SELECT ROUND(IFNULL(t1.available_num, 0) + IFNULL(t2.available_num, 0)) AS availableNum,
|
||||||
|
|
@ -249,46 +249,69 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="getDeviceNumByMonth" resultType="java.util.Map">
|
<select id="getDeviceNumByMonth" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
-- 退库申请数量(类型1:原始退库申请)
|
-- 自用相关统计
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '1' THEN cdcd.num ELSE 0 END),0) AS returnApplyNum,
|
IFNULL(SUM(CASE WHEN cdc.type = '2' AND cdc.review_status = 2 THEN cdcd.real_num ELSE 0 END), 0) AS selfUseApplyNum, -- 自用申请数量
|
||||||
-- 自用申请数量(类型2:自用申请)
|
IFNULL(SUM(CASE WHEN cdc.type = '2' AND cdc.review_status = 2 AND cdcd.dev_type = '1' THEN cdcd.real_num ELSE 0 END), 0) AS selfUseOutNum, -- 自用出库数量
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '2' THEN cdcd.num ELSE 0 END),0) AS selfUseApplyNum,
|
IFNULL(SUM(CASE WHEN cdc.type = '2' AND cdc.review_status = 2 AND cdcd.dev_type = '2' THEN cdcd.real_num ELSE 0 END), 0) AS selfUseAuditNum, -- 自用审核数量
|
||||||
-- 自用出库数量(类型2的实际出库数)
|
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '2' AND cdcd.dev_type ='1' THEN cdcd.real_num ELSE 0 END),0) AS selfUseOutNum,
|
-- 退库相关统计
|
||||||
-- 自用审核数量(类型2+审核通过状态2的申请数)
|
IFNULL(SUM(CASE WHEN cdc.type = '1' AND cdc.review_status = 2 THEN cdcd.num ELSE 0 END), 0) AS returnApplyNum, -- 退库申请数量
|
||||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '2' AND cdcd.dev_type ='2' THEN cdcd.real_num ELSE 0
|
IFNULL(SUM(CASE WHEN cdc.type = '1' AND cdc.review_status = 2 AND cdcd.dev_type = '1' THEN cdcd.num ELSE 0 END), 0) AS returnAuditApplyNum, -- 退库审核数量
|
||||||
END),0) AS selfUseAuditNum,
|
IFNULL(SUM(CASE WHEN cdc.type = '1' AND cdc.review_status = 2 AND cdcd.dev_type = '2' THEN cdcd.num ELSE 0 END), 0) AS returnAuditRepairNum, -- 退库维修数量
|
||||||
-- 退库审核数量(类型1+审核通过状态2的申请数)
|
IFNULL(SUM(CASE WHEN cdc.type = '1' AND cdc.review_status = 2 THEN (cdcd.num - cdcd.real_num) ELSE 0 END), 0) AS returnAuditStoreNum, -- 退库入库数量
|
||||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '1' THEN cdcd.num ELSE 0 END),0) AS
|
|
||||||
returnAuditApplyNum,
|
-- 维修相关统计
|
||||||
-- 退库维修数量(类型1+审核通过状态2的实际维修数)
|
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status != 2 THEN cdcd.num ELSE 0 END), 0) AS repairPendingNum, -- 待维修数量
|
||||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '1' THEN cdcd.real_num ELSE 0 END),0) AS
|
-- 维修退役数量(类型4退役+类型3审核通过)
|
||||||
returnAuditRepairNum,
|
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status = 2 AND cdcd.is_scrap = '1' THEN cdcd.real_num ELSE 0 END), 0)
|
||||||
-- 退库入库数量(类型1+审核通过状态2的申请数-实际维修数,即可入库数量)
|
+ IFNULL(SUM(CASE WHEN cdc.type = '3' AND cdc.review_status = 2 THEN cdcd.real_num ELSE 0 END), 0) AS repairRetireNum,
|
||||||
IFNULL(SUM(CASE WHEN cdc.review_status = 2 AND cdc.type = '1' THEN (cdcd.num - cdcd.real_num) ELSE 0 END),0) AS
|
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status = 2 AND cdcd.is_scrap = '0' THEN cdcd.real_num ELSE 0 END), 0) AS repairQualifiedNum, -- 维修合格数量
|
||||||
returnAuditStoreNum,
|
|
||||||
-- 类型4:待维修数量(未审核通过/审核中 + 申请数)
|
-- 入库数量(原独立子查询改为LEFT JOIN,避免多行返回错误)
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdc.review_status != 2 THEN cdcd.num ELSE 0 END),0) AS repairPendingNum,
|
IFNULL(warehouse_stats.total_num, 0) AS warehousingNum
|
||||||
-- 类型4:维修退役数量(审核通过 + 实际退役数)
|
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdcd.is_scrap = '1' THEN cdcd.real_num ELSE 0 END),0) AS
|
|
||||||
repairRetireNum,
|
|
||||||
-- 类型4:维修合格数量(审核通过 + 申请数-实际退役数,即可入库/复用数量)
|
|
||||||
IFNULL(SUM(CASE WHEN cdc.type = '4' AND cdcd.is_scrap = '0' THEN (cdcd.real_num) ELSE 0 END),0) AS
|
|
||||||
repairQualifiedNum
|
|
||||||
FROM
|
FROM
|
||||||
cs_device_change cdc
|
cs_device_change cdc
|
||||||
-- 原LEFT JOIN + cdcd.id IS NOT NULL 等价于INNER JOIN,性能更优
|
|
||||||
INNER JOIN cs_device_change_details cdcd
|
INNER JOIN cs_device_change_details cdcd
|
||||||
ON cdcd.change_id = cdc.id
|
ON cdcd.change_id = cdc.id
|
||||||
AND cdcd.del_flag = '0' -- 子表未删除
|
AND cdcd.del_flag = '0' -- 子表未删除
|
||||||
<where>
|
-- 关联入库统计子查询(改为JOIN,确保单行返回)
|
||||||
cdc.del_flag = '0' -- 主表未删除
|
LEFT JOIN (
|
||||||
-- 筛选本月数据(年、月与当前日期一致)
|
SELECT
|
||||||
AND DATE_FORMAT(cdc.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
-- 若需按company_id分组,需添加GROUP BY su.dept_id
|
||||||
<if test="companyId != null">
|
COALESCE(SUM(ma_detail.maNum), 0) + COALESCE(SUM(tool_detail.toolNum), 0) AS total_num
|
||||||
and cdc.company_id = #{companyId}
|
-- , su.dept_id -- 如需按公司筛选,保留该字段
|
||||||
</if>
|
FROM
|
||||||
</where>
|
bm_warehousing bw
|
||||||
|
LEFT JOIN sys_user su
|
||||||
|
ON su.user_id = bw.user_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT cs_id, COUNT(1) AS maNum
|
||||||
|
FROM ma_apply_details
|
||||||
|
GROUP BY cs_id
|
||||||
|
) ma_detail
|
||||||
|
ON ma_detail.cs_id = bw.order_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT apply_id, SUM(apply_num) AS toolNum
|
||||||
|
FROM tool_apply_details
|
||||||
|
WHERE del_flag = '0'
|
||||||
|
GROUP BY apply_id
|
||||||
|
) tool_detail
|
||||||
|
ON tool_detail.apply_id = bw.apply_id
|
||||||
|
WHERE
|
||||||
|
bw.`status` = 2
|
||||||
|
AND DATE_FORMAT(bw.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
||||||
|
<if test="companyId != null">
|
||||||
|
AND su.dept_id = #{companyId}
|
||||||
|
</if>
|
||||||
|
) warehouse_stats ON 1=1
|
||||||
|
WHERE
|
||||||
|
cdc.del_flag = '0'
|
||||||
|
|
||||||
|
AND DATE_FORMAT(cdc.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
||||||
|
|
||||||
|
<if test="companyId != null">
|
||||||
|
AND cdc.company_id = #{companyId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<!-- MySQL版本:使用MyBatis的foreach循环拼接OR条件 -->
|
<!-- MySQL版本:使用MyBatis的foreach循环拼接OR条件 -->
|
||||||
<select id="getApprover" resultType="java.util.Map">
|
<select id="getApprover" resultType="java.util.Map">
|
||||||
|
|
@ -330,42 +353,56 @@
|
||||||
</choose>
|
</choose>
|
||||||
</select>
|
</select>
|
||||||
<select id="getShare" resultType="java.util.Map">
|
<select id="getShare" resultType="java.util.Map">
|
||||||
SELECT COUNT(1) AS buyerNum,
|
|
||||||
SUM(IF(devType = '0', real_num, 0)) AS sellerNum,
|
|
||||||
SUM(IF(devType = '1', real_num, 0)) AS toolNum
|
|
||||||
FROM(
|
|
||||||
SELECT
|
SELECT
|
||||||
CASE
|
-- 1. 出售方订单数:companyId为空时统计所有,否则统计指定公司
|
||||||
WHEN hh.devType = '0' THEN up.dept_id
|
IFNULL(SUM(CASE
|
||||||
WHEN hh.devType = '1' THEN up1.dept_id
|
WHEN #{companyId} IS NULL OR #{companyId} = '' THEN 1
|
||||||
ELSE NULL
|
WHEN a.sellerDeptId = #{companyId} THEN 1
|
||||||
END AS dept_id,
|
ELSE 0
|
||||||
hh.real_num,
|
END), 0) AS sellerNum,
|
||||||
hh.devType
|
-- 2. 购买方订单数:companyId为空时统计所有,否则统计指定公司
|
||||||
FROM
|
IFNULL(SUM(CASE
|
||||||
ma_order_details hh
|
WHEN #{companyId} IS NULL OR #{companyId} = '' THEN 1
|
||||||
-- 左连接mdi(仅devType=0时生效)
|
WHEN a.buyerCompanyName = #{companyId} THEN 1
|
||||||
LEFT JOIN ma_dev_info mdi
|
ELSE 0
|
||||||
ON hh.ma_id = mdi.ma_id
|
END), 0) AS buyerNum,
|
||||||
AND hh.devType = '0'
|
-- 3. 出售设备总数:companyId为空时统计所有,否则统计指定公司的设备数
|
||||||
-- 左连接tl(仅devType=1时生效)
|
IFNULL(SUM(CASE
|
||||||
LEFT JOIN tool_ledger tl
|
WHEN (#{companyId} IS NULL OR #{companyId} = '') AND a.devType = '0' THEN a.equipmentTotalNum
|
||||||
ON tl.id = hh.ma_id
|
WHEN a.sellerDeptId = #{companyId} and a.devType = '0' THEN a.equipmentTotalNum
|
||||||
AND hh.devType = '1'
|
ELSE 0
|
||||||
-- 关联mdi对应的部门表
|
END), 0) AS sellerMaNum,
|
||||||
LEFT JOIN sys_dept up
|
IFNULL(SUM(CASE
|
||||||
ON up.dept_id = mdi.on_company
|
WHEN (#{companyId} IS NULL OR #{companyId} = '') AND a.devType = '1' THEN a.equipmentTotalNum
|
||||||
-- 关联tl对应的部门表
|
WHEN a.sellerDeptId = #{companyId} and a.devType = '1' THEN a.equipmentTotalNum
|
||||||
LEFT JOIN sys_dept up1
|
ELSE 0
|
||||||
ON up1.dept_id = tl.company_id
|
END), 0) AS sellerToolNum,
|
||||||
-- 可选:过滤无效devType(如果需要)
|
IFNULL(SUM(CASE
|
||||||
WHERE hh.devType IN ('0', '1')
|
WHEN (#{companyId} IS NULL OR #{companyId} = '') AND a.devType = '0' THEN a.equipmentTotalNum
|
||||||
) a
|
WHEN a.buyerCompanyName = #{companyId} and a.devType = '0' THEN a.equipmentTotalNum
|
||||||
<where>
|
ELSE 0
|
||||||
<if test="companyId != null">
|
END), 0) AS buyerMaNum,
|
||||||
and dept_id = #{companyId}
|
IFNULL(SUM(CASE
|
||||||
</if>
|
WHEN (#{companyId} IS NULL OR #{companyId} = '') AND a.devType = '1' THEN a.equipmentTotalNum
|
||||||
</where>
|
WHEN a.buyerCompanyName = #{companyId} and a.devType = '1' THEN a.equipmentTotalNum
|
||||||
|
ELSE 0
|
||||||
|
END), 0) AS buyerToolNum
|
||||||
|
FROM (
|
||||||
|
-- 内层查询:按订单维度统计出售方、购买方、设备总数(原逻辑不变)
|
||||||
|
SELECT up.dept_id AS sellerDeptId,
|
||||||
|
moi.buyer_company AS buyerCompanyName,
|
||||||
|
SUM(hh.num) AS equipmentTotalNum,
|
||||||
|
hh.devType AS devType
|
||||||
|
FROM ma_order_details hh
|
||||||
|
LEFT JOIN ma_order_info moi ON moi.order_id = hh.order_id
|
||||||
|
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||||
|
LEFT JOIN sys_dept up ON up.dept_id = mdi.on_company
|
||||||
|
WHERE DATE_FORMAT(moi.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
|
||||||
|
GROUP BY hh.order_id,
|
||||||
|
up.dept_id,
|
||||||
|
hh.devType,
|
||||||
|
moi.buyer_company) a
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getDeviceByDeptEX" resultType="com.bonus.material.index.domain.CompanyDevToolStatisticsExport">
|
<select id="getDeviceByDeptEX" resultType="com.bonus.material.index.domain.CompanyDevToolStatisticsExport">
|
||||||
SELECT sd.dept_abbreviation AS companyName, -- 公司名称
|
SELECT sd.dept_abbreviation AS companyName, -- 公司名称
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||||
LEFT JOIN base_address b ON b.id = m.area_id
|
LEFT JOIN sys_cnarea b ON b.id = m.area_id
|
||||||
LEFT JOIN ma_hot_search h ON h.lease_id = m.id
|
LEFT JOIN ma_hot_search h ON h.lease_id = m.id
|
||||||
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
||||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
||||||
|
|
@ -344,7 +344,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||||
LEFT JOIN base_address b ON b.id = m.area_id
|
LEFT JOIN sys_cnarea b ON b.id = m.area_id
|
||||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||||
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
LEFT JOIN ma_type mt4 ON mt4.type_id = m.type_id and mt4.del_flag = '0'
|
||||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0'
|
||||||
|
|
@ -438,7 +438,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
|
||||||
LEFT JOIN base_address b ON b.id = m.area_id
|
LEFT JOIN sys_cnarea b ON b.id = m.area_id
|
||||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||||
WHERE 1 = 1 and m.order_user = #{orderUser} and m.lease_status = '1'
|
WHERE 1 = 1 and m.order_user = #{orderUser} and m.lease_status = '1'
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,9 @@
|
||||||
END AS leaseDay
|
END AS leaseDay
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN base_address b ON b.code = m.area_code
|
LEFT JOIN sys_cnarea b ON b.area_code = m.area_code
|
||||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
LEFT JOIN sys_cnarea b1 on m.province_code = b1.area_code
|
||||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
LEFT JOIN sys_cnarea b2 on m.city_code = b2.area_code
|
||||||
LEFT JOIN ma_hot_search h ON h.lease_id = m.id
|
LEFT JOIN ma_hot_search h ON h.lease_id = m.id
|
||||||
LEFT JOIN sys_dept sd on m.publish_company = sd.dept_id
|
LEFT JOIN sys_dept sd on m.publish_company = sd.dept_id
|
||||||
LEFT JOIN sys_dept sd2 on m.order_company = sd2.dept_id
|
LEFT JOIN sys_dept sd2 on m.order_company = sd2.dept_id
|
||||||
|
|
@ -237,9 +237,9 @@
|
||||||
m.publish_company as publishCompany
|
m.publish_company as publishCompany
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN base_address b ON b.code = m.area_code
|
LEFT JOIN sys_cnarea b ON b.area_code = m.area_code
|
||||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
LEFT JOIN sys_cnarea b1 on m.province_code = b1.area_code
|
||||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
LEFT JOIN sys_cnarea b2 on m.city_code = b2.area_code
|
||||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||||
WHERE 1 = 1 and m.publish_company = #{publishCompany}
|
WHERE 1 = 1 and m.publish_company = #{publishCompany}
|
||||||
|
|
@ -298,9 +298,9 @@
|
||||||
END AS leaseDay
|
END AS leaseDay
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN base_address b ON b.code = m.area_code
|
LEFT JOIN sys_cnarea b ON b.area_code = m.area_code
|
||||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
LEFT JOIN sys_cnarea b1 on m.province_code = b1.area_code
|
||||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
LEFT JOIN sys_cnarea b2 on m.city_code = b2.area_code
|
||||||
LEFT JOIN ma_lease_details m1 ON m.id = m1.lease_id
|
LEFT JOIN ma_lease_details m1 ON m.id = m1.lease_id
|
||||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||||
LEFT JOIN sys_dept sd ON m.publish_company = sd.dept_id
|
LEFT JOIN sys_dept sd ON m.publish_company = sd.dept_id
|
||||||
|
|
@ -378,9 +378,9 @@
|
||||||
AS leaseStatusName
|
AS leaseStatusName
|
||||||
FROM
|
FROM
|
||||||
ma_lease_info m
|
ma_lease_info m
|
||||||
LEFT JOIN base_address b ON b.code = m.area_code
|
LEFT JOIN sys_cnarea b ON b.area_code = m.area_code
|
||||||
LEFT JOIN base_address b1 on m.province_code = b1.code
|
LEFT JOIN sys_cnarea b1 on m.province_code = b1.area_code
|
||||||
LEFT JOIN base_address b2 on m.city_code = b2.code
|
LEFT JOIN sys_cnarea b2 on m.city_code = b2.area_code
|
||||||
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
LEFT JOIN sys_user su ON m.publish_user = su.user_id
|
||||||
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
LEFT JOIN sys_user su1 ON m.order_user = su1.user_id
|
||||||
WHERE 1 = 1 and m.order_company = #{orderCompany}
|
WHERE 1 = 1 and m.order_company = #{orderCompany}
|
||||||
|
|
@ -712,8 +712,8 @@
|
||||||
AND mdi.on_company = #{ownCo}
|
AND mdi.on_company = #{ownCo}
|
||||||
</select>
|
</select>
|
||||||
<select id="getAddress" resultType="java.util.Map">
|
<select id="getAddress" resultType="java.util.Map">
|
||||||
SELECT code, name
|
SELECT area_code, name
|
||||||
from base_address
|
from sys_cnarea
|
||||||
where level = 1
|
where level = 1
|
||||||
</select>
|
</select>
|
||||||
<select id="getDept" resultType="java.util.Map">
|
<select id="getDept" resultType="java.util.Map">
|
||||||
|
|
|
||||||
|
|
@ -287,8 +287,16 @@
|
||||||
<if test="status != null and status!=''">
|
<if test="status != null and status!=''">
|
||||||
AND cdc.review_status = #{status}
|
AND cdc.review_status = #{status}
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and changeId != 1">
|
||||||
and cdc.company_id = #{companyId}
|
and cdc.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
<if test="isAudit==1">
|
<if test="isAudit==1">
|
||||||
and cdc.review_status !='5'
|
and cdc.review_status !='5'
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,15 @@
|
||||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||||
AND cdc.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
AND cdc.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and changeId != 1">
|
||||||
and cdc.company_id = #{companyId}
|
and cdc.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY cdc.id
|
GROUP BY cdc.id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
-- 关联4级父节点
|
-- 关联4级父节点
|
||||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||||
WHERE
|
WHERE
|
||||||
tt.del_flag = '0'
|
tt.del_flag = '0' AND tl.type_id IS not null
|
||||||
AND tt1.del_flag = '0'
|
AND tt1.del_flag = '0'
|
||||||
AND tt2.del_flag = '0'
|
AND tt2.del_flag = '0'
|
||||||
AND tt3.del_flag = '0'
|
AND tt3.del_flag = '0'
|
||||||
|
|
@ -104,8 +104,14 @@
|
||||||
AND tt.manage_type = #{manageMode}
|
AND tt.manage_type = #{manageMode}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and companyId != 1 ">
|
||||||
AND tl.company_id = #{companyId}
|
AND tl.company_id in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="typeName != null and typeName != ''">
|
<if test="typeName != null and typeName != ''">
|
||||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||||
|
|
@ -228,8 +234,15 @@
|
||||||
<if test="toolCode != null and toolCode != ''">
|
<if test="toolCode != null and toolCode != ''">
|
||||||
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null">
|
<if test="companyId != null and companyId != 1">
|
||||||
AND (tl.company_id = #{companyId} OR tl.company_id IS NULL)
|
<!-- AND (tl.company_id = #{companyId} OR tl.company_id IS NULL)-->
|
||||||
|
and tl.company_id in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
tl.create_time DESC
|
tl.create_time DESC
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,16 @@
|
||||||
<if test="subProcess != null and subProcess != ''">
|
<if test="subProcess != null and subProcess != ''">
|
||||||
and mtv.childGx like concat('%', #{subProcess}, '%')
|
and mtv.childGx like concat('%', #{subProcess}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null and companyId != ''">
|
<if test="companyId != null and companyId != 1">
|
||||||
and mdi.on_company = #{companyId}
|
and mdi.on_company
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,14 @@
|
||||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null and companyId != ''">
|
<if test="companyId != null and companyId != ''">
|
||||||
AND tl.company_id = #{companyId}
|
AND tl.company_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
GROUP BY tl.id
|
GROUP BY tl.id
|
||||||
|
|
|
||||||
|
|
@ -153,8 +153,15 @@
|
||||||
<if test="isStatus != null and isStatus != ''">
|
<if test="isStatus != null and isStatus != ''">
|
||||||
AND bw.status != #{isStatus}
|
AND bw.status != #{isStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="companyId != null and companyId != ''">
|
<if test="companyId !=null and companyId != 1">
|
||||||
AND su.dept_id = #{companyId}
|
AND su.dept_id
|
||||||
|
in (
|
||||||
|
select dept_id from sys_dept where dept_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id= #{companyId}
|
||||||
|
union
|
||||||
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id= #{companyId})
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime != null and endTime != null ">
|
<if test="startTime != null and endTime != null ">
|
||||||
and bw.create_time >= #{startTime}
|
and bw.create_time >= #{startTime}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue