去除外键之供应商客户信息表jsh_supplier、经手人表jsh_person相关修改
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Person;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
@@ -133,9 +134,20 @@ public class PersonController {
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/batchDeletePersonByIds")
|
||||
public Object batchDeletePersonByIds(@RequestParam("ids") String ids) throws Exception {
|
||||
public Object batchDeletePersonByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
|
||||
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
int i= personService.batchDeletePersonByIds(ids);
|
||||
int i=0;
|
||||
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
|
||||
i= personService.batchDeletePersonByIdsNormal(ids);
|
||||
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
|
||||
i= personService.batchDeletePersonByIds(ids);
|
||||
}else{
|
||||
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
|
||||
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
|
||||
ExceptionConstants.DELETE_REFUSED_MSG);
|
||||
}
|
||||
if(i<1){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
|
||||
ExceptionConstants.PERSON_DELETE_FAILED_CODE,ExceptionConstants.PERSON_DELETE_FAILED_MSG,ids);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Supplier;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
@@ -452,9 +453,20 @@ public class SupplierController {
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/batchDeleteSupplierByIds")
|
||||
public Object batchDeleteSupplierByIds(@RequestParam("ids") String ids) throws Exception {
|
||||
public Object batchDeleteSupplierByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
|
||||
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
int i= supplierService.batchDeleteSupplierByIds(ids);
|
||||
int i=0;
|
||||
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
|
||||
i= supplierService.batchDeleteSupplierByIdsNormal(ids);
|
||||
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
|
||||
i= supplierService.batchDeleteSupplierByIds(ids);
|
||||
}else{
|
||||
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
|
||||
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
|
||||
ExceptionConstants.DELETE_REFUSED_MSG);
|
||||
}
|
||||
if(i<1){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
|
||||
ExceptionConstants.SUPPLIER_DELETE_FAILED_CODE,ExceptionConstants.SUPPLIER_DELETE_FAILED_MSG,ids);
|
||||
|
||||
@@ -39,4 +39,8 @@ public interface AccountHeadMapperEx {
|
||||
int batchDeleteAccountHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
|
||||
|
||||
List<AccountHead> getAccountHeadListByAccountIds(@Param("accountIds") String[] accountIds);
|
||||
|
||||
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
|
||||
|
||||
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
||||
}
|
||||
@@ -117,4 +117,8 @@ public interface DepotHeadMapperEx {
|
||||
int batchDeleteDepotHeadByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
|
||||
|
||||
List<DepotHead> getDepotHeadListByAccountIds(@Param("accountIds") String[] accountIds);
|
||||
|
||||
List<DepotHead> getDepotHeadListByOrganIds(@Param("organIds") String[] organIds);
|
||||
|
||||
List<DepotHead> getDepotHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.jsh.erp.service.person;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.Person;
|
||||
import com.jsh.erp.datasource.entities.PersonExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.PersonMapper;
|
||||
import com.jsh.erp.datasource.mappers.PersonMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -35,6 +38,10 @@ public class PersonService {
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private AccountHeadMapperEx accountHeadMapperEx;
|
||||
@Resource
|
||||
private DepotHeadMapperEx depotHeadMapperEx;
|
||||
|
||||
public Person getPerson(long id) {
|
||||
return personMapper.selectByPrimaryKey(id);
|
||||
@@ -117,4 +124,52 @@ public class PersonService {
|
||||
String [] idArray=ids.split(",");
|
||||
return personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 正常删除,要考虑数据完整性,进行完整性校验
|
||||
* create time: 2019/4/10 15:14
|
||||
* @Param: ids
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeletePersonByIdsNormal(String ids) {
|
||||
/**
|
||||
* 校验
|
||||
* 1、财务主表 jsh_accounthead
|
||||
* 2、单据主表 jsh_depothead
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
if(StringUtils.isEmpty(ids)){
|
||||
return deleteTotal;
|
||||
}
|
||||
String [] idArray=ids.split(",");
|
||||
/**
|
||||
* 校验财务主表 jsh_accounthead
|
||||
* */
|
||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray);
|
||||
if(accountHeadList!=null&&accountHeadList.size()>0){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* */
|
||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
|
||||
if(depotHeadList!=null&&depotHeadList.size()>0){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验通过执行删除操作
|
||||
* */
|
||||
deleteTotal= batchDeletePersonByIds(ids);
|
||||
return deleteTotal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.jsh.erp.service.supplier;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.datasource.entities.Supplier;
|
||||
import com.jsh.erp.datasource.entities.SupplierExample;
|
||||
import com.jsh.erp.datasource.entities.User;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.*;
|
||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.SupplierMapper;
|
||||
import com.jsh.erp.datasource.mappers.SupplierMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
@@ -39,6 +42,10 @@ public class SupplierService {
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private AccountHeadMapperEx accountHeadMapperEx;
|
||||
@Resource
|
||||
private DepotHeadMapperEx depotHeadMapperEx;
|
||||
|
||||
public Supplier getSupplier(long id) {
|
||||
return supplierMapper.selectByPrimaryKey(id);
|
||||
@@ -187,4 +194,53 @@ public class SupplierService {
|
||||
String [] idArray=ids.split(",");
|
||||
return supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
*正常删除,要考虑数据完整性,进行完整性校验
|
||||
* create time: 2019/4/10 14:48
|
||||
* @Param: ids
|
||||
* @return int
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeleteSupplierByIdsNormal(String ids) throws Exception {
|
||||
/**
|
||||
* 校验
|
||||
* 1、财务主表 jsh_accounthead
|
||||
* 2、单据主表 jsh_depothead
|
||||
* 是否有相关数据
|
||||
* */
|
||||
int deleteTotal=0;
|
||||
if(StringUtils.isEmpty(ids)){
|
||||
return deleteTotal;
|
||||
}
|
||||
String [] idArray=ids.split(",");
|
||||
/**
|
||||
* 校验财务主表 jsh_accounthead
|
||||
* */
|
||||
List<AccountHead> accountHeadList=accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
|
||||
if(accountHeadList!=null&&accountHeadList.size()>0){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验单据主表 jsh_depothead
|
||||
* */
|
||||
List<DepotHead> depotHeadList=depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
|
||||
if(depotHeadList!=null&&depotHeadList.size()>0){
|
||||
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
|
||||
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||
}
|
||||
/**
|
||||
* 校验通过执行删除操作
|
||||
* */
|
||||
deleteTotal= batchDeleteSupplierByIds(ids);
|
||||
return deleteTotal;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,14 +88,26 @@
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<select id="getAccountHeadListByAccountIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
<select id="getAccountHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
|
||||
from jsh_accounthead
|
||||
where 1=1
|
||||
and accountId in (
|
||||
<foreach collection="accountIds" item="accountId" separator=",">
|
||||
#{accountId}
|
||||
and organId in (
|
||||
<foreach collection="organIds" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
<select id="getAccountHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
|
||||
from jsh_accounthead
|
||||
where 1=1
|
||||
and handsPersonId in (
|
||||
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
|
||||
#{handsPersonId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
|
||||
@@ -450,5 +450,29 @@
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
<select id="getDepotHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
|
||||
from jsh_depothead
|
||||
where 1=1
|
||||
and organId in (
|
||||
<foreach collection="organIds" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
<select id="getDepotHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List" />
|
||||
from jsh_depothead
|
||||
where 1=1
|
||||
and handsPersonId in (
|
||||
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
|
||||
#{handsPersonId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user