企业管理变更
This commit is contained in:
+5
@@ -22,6 +22,7 @@ import com.jero.company.common.PayCompanyManagementCommon;
|
||||
import com.jero.company.common.PayContactsManagementCommon;
|
||||
import com.jero.company.entity.PayCompanyManagement;
|
||||
import com.jero.company.service.IPayCompanyManagementService;
|
||||
import com.jero.company.service.ProjectCountService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -56,6 +57,8 @@ public class PayCompanyManagementController extends JeroController<PayCompanyMan
|
||||
private IPayCompanyManagementService payCompanyManagementService;
|
||||
@Autowired
|
||||
private Environment env;
|
||||
@Autowired
|
||||
private ProjectCountService projectCountService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@@ -233,6 +236,7 @@ public class PayCompanyManagementController extends JeroController<PayCompanyMan
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
projectCountService.getProjectCount(id,null);
|
||||
payCompanyManagementService.removePayCompanyManagementById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
@@ -254,6 +258,7 @@ public class PayCompanyManagementController extends JeroController<PayCompanyMan
|
||||
if(StringUtils.isBlank(s1)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
projectCountService.getProjectCount(s1,null);
|
||||
}
|
||||
this.payCompanyManagementService.removePayCompanyManagementByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
|
||||
+5
@@ -24,6 +24,7 @@ import com.jero.company.entity.PayCompanyManagement;
|
||||
import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.service.IPayCompanyManagementService;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
import com.jero.company.service.ProjectCountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -59,6 +60,8 @@ public class PayContactsManagementController extends JeroController<PayContactsM
|
||||
private IPayCompanyManagementService payCompanyManagementService;
|
||||
@Autowired
|
||||
private Environment env;
|
||||
@Autowired
|
||||
private ProjectCountService projectCountService;
|
||||
|
||||
// todo 缺少联系人加入到用户表,可以登录
|
||||
|
||||
@@ -238,6 +241,7 @@ public class PayContactsManagementController extends JeroController<PayContactsM
|
||||
if(StringUtils.isBlank(id)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
projectCountService.getProjectCount(null,id);
|
||||
payContactsManagementService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
@@ -259,6 +263,7 @@ public class PayContactsManagementController extends JeroController<PayContactsM
|
||||
if(StringUtils.isBlank(s1)){
|
||||
return Result.error("id不能为空!");
|
||||
}
|
||||
projectCountService.getProjectCount(null,s1);
|
||||
}
|
||||
this.payContactsManagementService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.jero.company.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ProjectCountMapper {
|
||||
/**
|
||||
* @Description 获取关联企业或者联系人的项目个数
|
||||
* @Author lqt
|
||||
* @Date 2021/9/15
|
||||
* @Param
|
||||
* @Return
|
||||
* @Exception
|
||||
*/
|
||||
Integer getProjectCount(@Param("companyId") String companyId,@Param("contactsId") String contactsId);
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.company.mapper.ProjectCountMapper">
|
||||
|
||||
<select id="getProjectCount" resultType="java.lang.Integer">
|
||||
select count(*) from
|
||||
(
|
||||
<!-- 普通项目-->
|
||||
select id from pay_common_project
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND charge_company_id = #{companyId}
|
||||
</if>
|
||||
<if test="contactsId != null and contactsId != ''">
|
||||
AND contacts_id = #{contactsId}
|
||||
</if>
|
||||
</where>
|
||||
<!--工作组项目-->
|
||||
UNION ALL
|
||||
select id from pay_working_group_subitem
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND charge_company_id = #{companyId}
|
||||
</if>
|
||||
<if test="contactsId != null and contactsId != ''">
|
||||
AND contacts_id_one = #{contactsId}
|
||||
</if>
|
||||
</where>
|
||||
<!-- 会议项目-->
|
||||
UNION ALL
|
||||
select id from pay_meeting_situation
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND company_id = #{companyId}
|
||||
</if>
|
||||
<if test="contactsId != null and contactsId != ''">
|
||||
AND company_contact_id = #{contactsId}
|
||||
</if>
|
||||
</where>
|
||||
<!-- 会员项目-->
|
||||
UNION ALL
|
||||
select id from pay_member_project_subitem
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND company_id = #{companyId}
|
||||
</if>
|
||||
<if test="contactsId != null and contactsId != ''">
|
||||
AND company_contact_id = #{contactsId}
|
||||
</if>
|
||||
</where>
|
||||
<!-- 标协会员项目-->
|
||||
UNION ALL
|
||||
select id from tb_member_project_subitem
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
AND company_id = #{companyId}
|
||||
</if>
|
||||
<!-- <if test="contactsId != null and contactsId != ''">-->
|
||||
<!-- AND company_contact_id = #{contactsId}-->
|
||||
<!-- </if>-->
|
||||
</where>
|
||||
) project
|
||||
</select>
|
||||
</mapper>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.jero.company.service;
|
||||
|
||||
public interface ProjectCountService {
|
||||
/**
|
||||
* @Description 获取关联企业或者联系人的项目个数
|
||||
* @Author lqt
|
||||
* @Date 2021/9/15
|
||||
* @Param companyId 企业id
|
||||
* @Param contactsId 联系人id
|
||||
* @Return
|
||||
* @Exception
|
||||
*/
|
||||
// todo 缺少标协会员的联系人id
|
||||
void getProjectCount(String companyId,String contactsId);
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.jero.company.service.impl;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.company.mapper.ProjectCountMapper;
|
||||
import com.jero.company.service.ProjectCountService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class ProjectCountServiceImpl implements ProjectCountService {
|
||||
|
||||
@Resource
|
||||
private ProjectCountMapper projectCountMapper;
|
||||
|
||||
@Override
|
||||
public void getProjectCount(String companyId, String contactsId) {
|
||||
int count = projectCountMapper.getProjectCount(companyId, contactsId);
|
||||
if(count > 0){
|
||||
throw new JeroBootException("已关联项目,不可删除!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user