OMS-GW-企业国别
This commit is contained in:
+35
-1
@@ -2,19 +2,23 @@ package com.mhd.oms.application.service.erpCountry;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.erpCountry.entity.ErpCountry;
|
||||
import com.mhd.oms.domain.erpCountry.repository.mapper.ErpCountryMapper;
|
||||
import com.mhd.oms.domain.erpCountry.repository.po.ErpCountryPO;
|
||||
import com.mhd.oms.interfaces.dto.erpCountry.ErpCountryDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ErpCountryApplicationService {
|
||||
public class ErpCountryApplicationService{
|
||||
|
||||
@Resource
|
||||
private ErpCountryMapper erpCountryMapper;
|
||||
@@ -30,4 +34,34 @@ public class ErpCountryApplicationService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int insert(ErpCountryDTO erpCountryDTO) {
|
||||
ErpCountry erpCountry = new ErpCountry();
|
||||
BeanUtils.copyProperties(erpCountryDTO, erpCountry);
|
||||
erpCountry.setPushStatus(1);
|
||||
erpCountry.setDelFlag(1);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
erpCountry.setCreateBy(loginUser.getUserid());
|
||||
erpCountry.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
erpCountry.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
erpCountry.setCreateTime(new Date());
|
||||
return erpCountryMapper.insert(erpCountry);
|
||||
}
|
||||
|
||||
public int update(ErpCountryDTO erpCountryDTO) {
|
||||
ErpCountry erpCountry = new ErpCountry();
|
||||
BeanUtils.copyProperties(erpCountryDTO, erpCountry);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
erpCountry.setUpdateBy(loginUser.getUserid());
|
||||
erpCountry.setUpdateTime(new Date());
|
||||
}
|
||||
return erpCountryMapper.updateById(erpCountry);
|
||||
}
|
||||
|
||||
public int deleteByIds(List<Long> idList) {
|
||||
return erpCountryMapper.deleteByIds(idList);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,6 +1,7 @@
|
||||
package com.mhd.oms.domain.erpCountry.repository.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.erpCountry.entity.ErpCountry;
|
||||
import com.mhd.oms.domain.erpCountry.repository.po.ErpCountryPO;
|
||||
import com.mhd.oms.interfaces.dto.erpCountry.ErpCountryDTO;
|
||||
@@ -10,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ErpCountryMapper {
|
||||
public interface ErpCountryMapper extends BaseMapper<ErpCountry> {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -18,4 +19,6 @@ public interface ErpCountryMapper {
|
||||
* @return
|
||||
*/
|
||||
List<ErpCountryPO> queryList(@Param("erpCountryDTO") ErpCountryDTO erpCountryDTO);
|
||||
|
||||
int deleteByIds(@Param("idList") List<Long> idList);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,17 @@ package com.mhd.oms.interfaces.facade.erpCountry;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.oms.application.service.erpCountry.ErpCountryApplicationService;
|
||||
import com.mhd.oms.interfaces.dto.erpCountry.ErpCountryDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Api(tags = "企业国别管理")
|
||||
@@ -27,5 +29,29 @@ public class ErpCountryApi extends BaseController{
|
||||
return erpCountryApplicationService.queryList(erpCountryDTO);
|
||||
}
|
||||
|
||||
@ApiOperation("编辑企业国别")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody ErpCountryDTO erpCountryDTO) {
|
||||
if (erpCountryDTO.getId() != null) {
|
||||
return toAjax(erpCountryApplicationService.update(erpCountryDTO));
|
||||
} else {
|
||||
return toAjax(erpCountryApplicationService.insert(erpCountryDTO));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除企业国别")
|
||||
@DeleteMapping("/deleteBatch")
|
||||
public AjaxResult deleteBatch(@RequestParam("ids") String ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return AjaxResult.error("没有选择要删除的数据");
|
||||
}
|
||||
List<Long> idList = new ArrayList<>();
|
||||
for (String id : ids.split(",")) {
|
||||
idList.add(Long.parseLong(id));
|
||||
}
|
||||
return toAjax(erpCountryApplicationService.deleteByIds(idList));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,4 +23,11 @@
|
||||
ORDER BY CREATE_TIME DESC
|
||||
</select>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE ERP_COUNTRY SET DEL_FLAG = 0 WHERE ID IN
|
||||
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user