localizer
parent
f78746f7d2
commit
6065418124
|
|
@ -14,4 +14,11 @@ import org.apache.ibatis.annotations.Param;
|
|||
@Mapper
|
||||
public interface BizCompanyMapper extends BaseMapper<BizCompanyEntity> {
|
||||
IPage<BizCompanyEntity> paging(Page<Object> page, @Param("ew") QueryWrapper<Object> ew);
|
||||
|
||||
/**
|
||||
* 根据ID获取企业详情,包含用户的bizObj
|
||||
* @param id 企业ID
|
||||
* @return 企业实体,包含bizObj
|
||||
*/
|
||||
BizCompanyEntity selectDetailWithBizObj(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.njzscloud.supervisory.biz.pojo.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
|
@ -167,4 +168,10 @@ public class BizCompanyEntity {
|
|||
@TableLogic
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 业务对象
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BizObj bizObj;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.njzscloud.supervisory.biz.pojo.result;
|
||||
|
||||
import com.njzscloud.supervisory.biz.constant.AuditStatus;
|
||||
import com.njzscloud.supervisory.biz.constant.BizObj;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -130,4 +131,7 @@ public class SearchCompanyResult {
|
|||
* 审核备注
|
||||
*/
|
||||
private String auditMemo;
|
||||
|
||||
private BizObj bizObj;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Strings;
|
||||
import com.njzscloud.common.core.ex.Exceptions;
|
||||
|
|
@ -36,7 +35,7 @@ import java.util.List;
|
|||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyEntity> implements IService<BizCompanyEntity> {
|
||||
public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyEntity> {
|
||||
|
||||
private final AppProperties appProperties;
|
||||
|
||||
|
|
@ -89,10 +88,6 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
|||
BizCompanyEntity bizCompanyEntity = BeanUtil.copyProperties(modifyBizCompanyParam, BizCompanyEntity.class)
|
||||
.setAuditStatus(AuditStatus.DaiShenHe);
|
||||
this.updateById(bizCompanyEntity);
|
||||
BizObj bizObj = modifyBizCompanyParam.getBizObj();
|
||||
|
||||
Long userId = oldData.getUserId();
|
||||
Long companyId = oldData.getId();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -104,21 +99,18 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
|||
/* if (oldData.getAuditStatus() != AuditStatus.DaiShenHe) {
|
||||
throw Exceptions.exception("当前状态不能撤销");
|
||||
} */
|
||||
boolean updated = update(Wrappers.<BizCompanyEntity>lambdaUpdate()
|
||||
update(Wrappers.<BizCompanyEntity>lambdaUpdate()
|
||||
.set(BizCompanyEntity::getAuditStatus, AuditStatus.YiCheXiao)
|
||||
.eq(BizCompanyEntity::getId, id)
|
||||
// .eq(BizCompanyEntity::getAuditStatus, AuditStatus.DaiShenHe)
|
||||
);
|
||||
/* if (!updated) {
|
||||
throw Exceptions.exception("数据状态已改变,无法撤销");
|
||||
} */
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param id Id
|
||||
* @return BizCompanyEntity 结果
|
||||
* @return SearchCompanyResult 结果
|
||||
*/
|
||||
public SearchCompanyResult detail(Long id) {
|
||||
UserDetail userDetail = SecurityUtil.loginUser();
|
||||
|
|
@ -126,7 +118,11 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
|||
String bizObjValue = userDetail.getBizObj();
|
||||
BizCompanyEntity bizCompanyEntity;
|
||||
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);
|
||||
}
|
||||
BizObj bizObj = BizObj.valueOf(bizObjValue);
|
||||
|
|
@ -134,14 +130,22 @@ public class BizCompanyService extends ServiceImpl<BizCompanyMapper, BizCompanyE
|
|||
case ShiGongDanWei:
|
||||
case QingYunGongSi:
|
||||
bizCompanyEntity = this.getOne(Wrappers.<BizCompanyEntity>lambdaQuery().eq(BizCompanyEntity::getUserId, userId));
|
||||
if (bizCompanyEntity == null) {
|
||||
throw Exceptions.exception("企业信息不存在");
|
||||
}
|
||||
id = bizCompanyEntity.getId();
|
||||
// 使用联表查询获取企业信息和用户的bizObj
|
||||
bizCompanyEntity = baseMapper.selectDetailWithBizObj(id);
|
||||
break;
|
||||
// case ZhengFuBuMen:
|
||||
// bizCompanyEntity = this.getById(id);
|
||||
// bizCompanyEntity = baseMapper.selectDetailWithBizObj(id);
|
||||
// break;
|
||||
default:
|
||||
throw Exceptions.exception("不允许查询");
|
||||
}
|
||||
if (bizCompanyEntity == null) {
|
||||
throw Exceptions.exception("企业信息不存在");
|
||||
}
|
||||
return BeanUtil.copyProperties(bizCompanyEntity, SearchCompanyResult.class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,17 @@
|
|||
|
||||
<mapper namespace="com.njzscloud.supervisory.biz.mapper.BizCompanyMapper">
|
||||
<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
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue