Commit 16befbdb by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents cc32e844 85a0d7c6
......@@ -149,4 +149,16 @@ public interface StoreRegionApiService {
* @throws
*/
ServiceResponse<String> relationErp(Integer enterpriseId, Integer storeRegionId);
/**
* delRegion
* @Title: delRegion
* @Description: 删除门店域
* @author taogs
* @param enterpriseId
* @param regionId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse<Integer> delRegion(Integer enterpriseId, Integer regionId);
}
\ No newline at end of file
......@@ -119,4 +119,16 @@ public interface TabStoreRegionRelMapper {
* @throws
*/
void updateStatusByOther(@Param("enterpriseId") Integer enterpriseId, @Param("regionId") Integer regionId, @Param("deleteFlag") int deleteFlag);
/**
* deleteRegionRel
* @Title: deleteRegionRel
* @Description: 删除域
* @author taogs
* @param enterpriseId
* @param regionId
* @return void
* @throws
*/
void deleteRegionRel(@Param("enterpriseId") Integer enterpriseId, @Param("regionId") Integer regionId);
}
\ No newline at end of file
......@@ -160,4 +160,16 @@ public interface StoreRegionService {
* @throws
*/
String relationErp(Integer enterpriseId, Integer regionId);
/**
* delRegion
* @Title: delRegion
* @Description: 删除门店域
* @author taogs
* @param enterpriseId
* @param regionId
* @return java.lang.Integer
* @throws
*/
Integer delRegion(Integer enterpriseId, Integer regionId);
}
......@@ -2,8 +2,10 @@ package com.gic.store.service.impl;
import com.gic.store.constant.StoreOwnTypeEnum;
import com.gic.store.dao.mapper.TabStoreRegionMapper;
import com.gic.store.dao.mapper.TabStoreRegionRelMapper;
import com.gic.store.dto.StoreRegionDTO;
import com.gic.store.entity.TabStoreRegion;
import com.gic.store.entity.TabStoreRegionRel;
import com.gic.store.service.StoreRegionService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
......@@ -26,6 +28,8 @@ public class StoreRegionServiceImpl implements StoreRegionService {
@Autowired
private TabStoreRegionMapper storeRegionMapper;
@Autowired
private TabStoreRegionRelMapper tabStoreRegionRelMapper;
@Override
public int countByRegionCode(Integer enterpriseId, String regionCode) {
......@@ -115,4 +119,14 @@ public class StoreRegionServiceImpl implements StoreRegionService {
}
return null;
}
@Override
public Integer delRegion(Integer enterpriseId, Integer regionId) {
TabStoreRegion storeRegion = new TabStoreRegion();
storeRegion.setRegionId(regionId);
storeRegion.setDeleteFlag(1);
int i = storeRegionMapper.updateByPrimaryKeySelective(storeRegion);
tabStoreRegionRelMapper.deleteRegionRel(enterpriseId, regionId);
return i;
}
}
......@@ -190,4 +190,10 @@ public class StoreRegionApiServiceImpl implements StoreRegionApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Integer> delRegion(Integer enterpriseId, Integer regionId) {
Integer integer = this.storeRegionService.delRegion(enterpriseId, regionId);
return ServiceResponse.success(integer);
}
}
......@@ -155,7 +155,7 @@
</include>
from tab_store_region re, tab_store_region_rel rr
where re.region_id = rr.region_id
and rr.`delete_flag` = 0
and re.`delete_flag` = 0
and rr.enterprise_id = #{enterpriseId}
<if test="search != null and search != '' ">
and ( re.region_code like concat('%', #{search}, '%') or re.region_name like concat('%', #{search}, '%') )
......@@ -170,7 +170,7 @@
count(1)
from tab_store_region re, tab_store_region_rel rr
where re.region_id = rr.region_id
and rr.`delete_flag` = 0
and re.`delete_flag` = 0
and rr.enterprise_id = #{enterpriseId}
<if test="regionCode != null and regionCode != '' ">
and re.region_code = #{regionCode}
......
......@@ -176,4 +176,10 @@
where enterprise_id = #{enterpriseId}
and region_id = #{regionId}
</update>
<update id="deleteRegionRel">
update tab_store_region_rel set delete_flag = 1
where enterprise_id = #{enterpriseId}
and region_id = #{regionId}
</update>
</mapper>
\ No newline at end of file
......@@ -4,9 +4,13 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.log.LogUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.store.constant.StoreOwnTypeEnum;
import com.gic.store.dto.StoreDTO;
import com.gic.store.dto.StoreRegionDTO;
import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreRegionApiService;
import com.gic.store.web.qo.PageQO;
import com.gic.store.web.qo.region.StoreRegionQO;
......@@ -26,6 +30,8 @@ public class StoreRegionController {
@Autowired
private StoreRegionApiService storeRegionApiService;
@Autowired
private StoreApiService storeApiService;
@RequestMapping("/save-store-region")
public RestResponse saveStoreRegion(@Validated({StoreRegionQO.SaveValidView.class}) StoreRegionQO storeRegionQO) {
......@@ -61,6 +67,20 @@ public class StoreRegionController {
}
}
@RequestMapping("/del-region")
public RestResponse delRegion(Integer regionId){
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setRegionId(regionId);
Page<StoreDTO> result = this.storeApiService.listStore(storeSearchDTO, 1, 1).getResult();
if(result != null && result.getTotalCount() > 0){
return RestResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "门店域下存在门店,请先转移再删除");
}
ServiceResponse<Integer> response = this.storeRegionApiService.delRegion(enterpriseId, regionId);
return RestResponse.success(response.getResult());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment