localizer
ljw 2025-09-20 17:24:37 +08:00
parent f78746f7d2
commit 6065418124
5 changed files with 43 additions and 14 deletions

View File

@ -14,4 +14,11 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface BizCompanyMapper extends BaseMapper<BizCompanyEntity> { public interface BizCompanyMapper extends BaseMapper<BizCompanyEntity> {
IPage<BizCompanyEntity> paging(Page<Object> page, @Param("ew") QueryWrapper<Object> ew); IPage<BizCompanyEntity> paging(Page<Object> page, @Param("ew") QueryWrapper<Object> ew);
/**
* IDbizObj
* @param id ID
* @return bizObj
*/
BizCompanyEntity selectDetailWithBizObj(@Param("id") Long id);
} }

View File

@ -2,6 +2,7 @@ package com.njzscloud.supervisory.biz.pojo.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.supervisory.biz.constant.AuditStatus; import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.biz.constant.BizObj;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -167,4 +168,10 @@ public class BizCompanyEntity {
@TableLogic @TableLogic
private Boolean deleted; private Boolean deleted;
/**
*
*/
@TableField(exist = false)
private BizObj bizObj;
} }

View File

@ -1,6 +1,7 @@
package com.njzscloud.supervisory.biz.pojo.result; package com.njzscloud.supervisory.biz.pojo.result;
import com.njzscloud.supervisory.biz.constant.AuditStatus; import com.njzscloud.supervisory.biz.constant.AuditStatus;
import com.njzscloud.supervisory.biz.constant.BizObj;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
@ -130,4 +131,7 @@ public class SearchCompanyResult {
* *
*/ */
private String auditMemo; private String auditMemo;
private BizObj bizObj;
} }

View File

@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.njzscloud.common.core.ex.Exceptions; import com.njzscloud.common.core.ex.Exceptions;
@ -36,7 +35,7 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyEntity> implements IService<BizCompanyEntity> { public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyEntity> {
private final AppProperties appProperties; private final AppProperties appProperties;
@ -89,10 +88,6 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
BizCompanyEntity bizCompanyEntity = BeanUtil.copyProperties(modifyBizCompanyParam, BizCompanyEntity.class) BizCompanyEntity bizCompanyEntity = BeanUtil.copyProperties(modifyBizCompanyParam, BizCompanyEntity.class)
.setAuditStatus(AuditStatus.DaiShenHe); .setAuditStatus(AuditStatus.DaiShenHe);
this.updateById(bizCompanyEntity); this.updateById(bizCompanyEntity);
BizObj bizObj = modifyBizCompanyParam.getBizObj();
Long userId = oldData.getUserId();
Long companyId = oldData.getId();
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -104,21 +99,18 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
/* if (oldData.getAuditStatus() != AuditStatus.DaiShenHe) { /* if (oldData.getAuditStatus() != AuditStatus.DaiShenHe) {
throw Exceptions.exception("当前状态不能撤销"); throw Exceptions.exception("当前状态不能撤销");
} */ } */
boolean updated = update(Wrappers.<BizCompanyEntity>lambdaUpdate() update(Wrappers.<BizCompanyEntity>lambdaUpdate()
.set(BizCompanyEntity::getAuditStatus, AuditStatus.YiCheXiao) .set(BizCompanyEntity::getAuditStatus, AuditStatus.YiCheXiao)
.eq(BizCompanyEntity::getId, id) .eq(BizCompanyEntity::getId, id)
// .eq(BizCompanyEntity::getAuditStatus, AuditStatus.DaiShenHe) // .eq(BizCompanyEntity::getAuditStatus, AuditStatus.DaiShenHe)
); );
/* if (!updated) {
throw Exceptions.exception("数据状态已改变,无法撤销");
} */
} }
/** /**
* *
* *
* @param id Id * @param id Id
* @return BizCompanyEntity * @return SearchCompanyResult
*/ */
public SearchCompanyResult detail(Long id) { public SearchCompanyResult detail(Long id) {
UserDetail userDetail = SecurityUtil.loginUser(); UserDetail userDetail = SecurityUtil.loginUser();
@ -126,7 +118,11 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
String bizObjValue = userDetail.getBizObj(); String bizObjValue = userDetail.getBizObj();
BizCompanyEntity bizCompanyEntity; BizCompanyEntity bizCompanyEntity;
if (Strings.isNullOrEmpty(bizObjValue)) { if (Strings.isNullOrEmpty(bizObjValue)) {
bizCompanyEntity = this.getById(id); // 使用联表查询获取企业信息和用户的bizObj
bizCompanyEntity = baseMapper.selectDetailWithBizObj(id);
if (bizCompanyEntity == null) {
throw Exceptions.exception("企业信息不存在");
}
return BeanUtil.copyProperties(bizCompanyEntity, SearchCompanyResult.class); return BeanUtil.copyProperties(bizCompanyEntity, SearchCompanyResult.class);
} }
BizObj bizObj = BizObj.valueOf(bizObjValue); BizObj bizObj = BizObj.valueOf(bizObjValue);
@ -134,14 +130,22 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
case ShiGongDanWei: case ShiGongDanWei:
case QingYunGongSi: case QingYunGongSi:
bizCompanyEntity = this.getOne(Wrappers.<BizCompanyEntity>lambdaQuery().eq(BizCompanyEntity::getUserId, userId)); bizCompanyEntity = this.getOne(Wrappers.<BizCompanyEntity>lambdaQuery().eq(BizCompanyEntity::getUserId, userId));
if (bizCompanyEntity == null) {
throw Exceptions.exception("企业信息不存在");
}
id = bizCompanyEntity.getId(); id = bizCompanyEntity.getId();
// 使用联表查询获取企业信息和用户的bizObj
bizCompanyEntity = baseMapper.selectDetailWithBizObj(id);
break; break;
// case ZhengFuBuMen: // case ZhengFuBuMen:
// bizCompanyEntity = this.getById(id); // bizCompanyEntity = baseMapper.selectDetailWithBizObj(id);
// break; // break;
default: default:
throw Exceptions.exception("不允许查询"); throw Exceptions.exception("不允许查询");
} }
if (bizCompanyEntity == null) {
throw Exceptions.exception("企业信息不存在");
}
return BeanUtil.copyProperties(bizCompanyEntity, SearchCompanyResult.class); return BeanUtil.copyProperties(bizCompanyEntity, SearchCompanyResult.class);
} }

View File

@ -3,10 +3,17 @@
<mapper namespace="com.njzscloud.supervisory.biz.mapper.BizCompanyMapper"> <mapper namespace="com.njzscloud.supervisory.biz.mapper.BizCompanyMapper">
<select id="paging" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity"> <select id="paging" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
select a.* from biz_company a select a.*, b.biz_obj from biz_company a
left join sys_user b on b.id = a.user_id left join sys_user b on b.id = a.user_id
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment} ${ew.customSqlSegment}
</if> </if>
</select> </select>
<select id="selectDetailWithBizObj" resultType="com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity">
select a.*, b.biz_obj
from biz_company a
left join sys_user b on b.id = a.user_id
where a.id = #{id} and a.deleted = 0
</select>
</mapper> </mapper>