demand: TMS系统:运单录入报关清关相关功能优化
committer: heyu
This commit is contained in:
parent
0fd4e2f54f
commit
e682fd0d24
@ -0,0 +1,137 @@
|
|||||||
|
/**
|
||||||
|
* @Project: emis
|
||||||
|
* @Title: EmisCustomsLevelController.java
|
||||||
|
* @author heyu
|
||||||
|
* @date 2025-10-09 10:00:00
|
||||||
|
* @version v1.0
|
||||||
|
* @Description: <p> 报关清关级别维护 控制器 </p>
|
||||||
|
*/
|
||||||
|
package com.xdadan.erp.web.emis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.xdadan.erp.common.annotation.Log;
|
||||||
|
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||||
|
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||||
|
import com.xdadan.erp.common.enums.BusinessType;
|
||||||
|
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.EmisCustomsLevel;
|
||||||
|
import com.xdadan.erp.emis.service.IEmisCustomsLevelService;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/emis/emisCustomsLevel")
|
||||||
|
public class EmisCustomsLevelController extends EmisBaseController {
|
||||||
|
@Autowired
|
||||||
|
private IEmisCustomsLevelService emisCustomsLevelService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报关清关级别维护列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
startPage();
|
||||||
|
List<EmisCustomsLevel> list = emisCustomsLevelService.selectEmisCustomsLevelList(emisCustomsLevel);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否重复
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:list')")
|
||||||
|
@GetMapping("/checkUnique")
|
||||||
|
public AjaxResult checkUnique(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
int cnt = emisCustomsLevelService.checkUnique(emisCustomsLevel);
|
||||||
|
return AjaxResult.success("检查成功", cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报关清关级别维护列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:export')")
|
||||||
|
@Log(title = "报关清关级别维护", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
List<EmisCustomsLevel> list = emisCustomsLevelService.selectEmisCustomsLevelList(emisCustomsLevel);
|
||||||
|
ExcelUtil<EmisCustomsLevel> util = new ExcelUtil<EmisCustomsLevel>(EmisCustomsLevel.class);
|
||||||
|
util.exportExcel(response, list, "报关清关级别维护数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(emisCustomsLevelService.selectEmisCustomsLevelById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:add')")
|
||||||
|
@Log(title = "报关清关级别维护", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
return toAjax(emisCustomsLevelService.insertEmisCustomsLevel(emisCustomsLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel草稿方式新增
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:draftSubmitLevel')")
|
||||||
|
@PostMapping(value = "/draftSubmitLevel")
|
||||||
|
public AjaxResult draftSubmitLevel(@RequestBody EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
JSONObject jObjOut = new JSONObject();
|
||||||
|
String result = "success";
|
||||||
|
String msg = "提交成功";
|
||||||
|
try {
|
||||||
|
emisCustomsLevelService.draftSubmitLevel(emisCustomsLevel);
|
||||||
|
jObjOut.put("levelDetail", emisCustomsLevel);
|
||||||
|
} catch (DuplicateKeyException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result = "fail";
|
||||||
|
msg = "数据重复";
|
||||||
|
} catch (Exception ex) {
|
||||||
|
result = "fail";
|
||||||
|
ex.printStackTrace();
|
||||||
|
msg = "系统异常:" + ex.getMessage();
|
||||||
|
// 兼容业务异常格式
|
||||||
|
if (ex instanceof EmisBizError) {
|
||||||
|
msg = ((EmisBizError) ex).getErrorCode() + ":" + ex.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jObjOut.put("result", result);
|
||||||
|
jObjOut.put("msg", msg);
|
||||||
|
return AjaxResult.success("成功", jObjOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:edit')")
|
||||||
|
@Log(title = "报关清关级别维护", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
return toAjax(emisCustomsLevelService.updateEmisCustomsLevel(emisCustomsLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:remove')")
|
||||||
|
@Log(title = "报关清关级别维护", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(emisCustomsLevelService.deleteEmisCustomsLevelByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @Project: emis
|
||||||
|
* @Title: EmisCustomsLevel.java
|
||||||
|
* @author heyu
|
||||||
|
* @date 2025-10-09 10:00:00
|
||||||
|
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||||
|
* @version v1.0
|
||||||
|
* @Description: <p> 报关清关级别维护 实体类 </p>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.xdadan.erp.emis.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EmisCustomsLevel
|
||||||
|
* @Description 报关清关级别维护
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class EmisCustomsLevel extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/* 主键 id */
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/* 客户名称(不允许包含空格和特殊符号) */
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
/* 类别(1:绿色、2:黄色、3:红色、4:黑色) */
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/* 报关/清关(1:报关、2:清关) */
|
||||||
|
private String bizType;
|
||||||
|
|
||||||
|
/* 开始时间(精确到日) */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/* 结束时间(精确到日) */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDate;
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* @Project: emis
|
||||||
|
* @Title: EmisCustomsLevelMapper.java
|
||||||
|
* @author heyu
|
||||||
|
* @date 2025-10-09 10:00:00
|
||||||
|
* @version v1.0
|
||||||
|
* @Description: <p> 报关清关级别维护 Mapper 接口 </p>
|
||||||
|
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
|
||||||
|
*/
|
||||||
|
package com.xdadan.erp.emis.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisCustomsLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName EmisCustomsLevelMapper
|
||||||
|
* @Description
|
||||||
|
* <p>
|
||||||
|
* 报关清关级别维护 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public interface EmisCustomsLevelMapper extends BaseMapper<EmisCustomsLevel> {
|
||||||
|
/** 主键查询 */
|
||||||
|
public EmisCustomsLevel selectEmisCustomsLevelById(Long id);
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
public List<EmisCustomsLevel> selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 新增 */
|
||||||
|
public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 修改 */
|
||||||
|
public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
public int deleteEmisCustomsLevelById(Long id);
|
||||||
|
|
||||||
|
/** 批量删除 */
|
||||||
|
public int deleteEmisCustomsLevelByIds(Long[] ids);
|
||||||
|
|
||||||
|
/** 重复校验(客户名称 + 业务类型区分 + 时间重叠) */
|
||||||
|
public int checkUnique(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* @Project: emis
|
||||||
|
* @Title: IEmisCustomsLevelService.java
|
||||||
|
* @author heyu
|
||||||
|
* @date 2025-10-09 10:00:00
|
||||||
|
* @version v1.0
|
||||||
|
* @Description: <p> 报关清关级别维护 服务类接口 </p>
|
||||||
|
*/
|
||||||
|
package com.xdadan.erp.emis.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisCustomsLevel;
|
||||||
|
|
||||||
|
public interface IEmisCustomsLevelService {
|
||||||
|
/** 主键查询 */
|
||||||
|
public EmisCustomsLevel selectEmisCustomsLevelById(Long id);
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
public List<EmisCustomsLevel> selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 重复校验 */
|
||||||
|
public int checkUnique(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 草稿新增 */
|
||||||
|
public void draftSubmitLevel(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 新增 */
|
||||||
|
public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 修改 */
|
||||||
|
public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
|
||||||
|
|
||||||
|
/** 批量删除 */
|
||||||
|
public int deleteEmisCustomsLevelByIds(Long[] ids);
|
||||||
|
|
||||||
|
/** 删除 */
|
||||||
|
public int deleteEmisCustomsLevelById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,183 @@
|
|||||||
|
/**
|
||||||
|
* @Project: emis
|
||||||
|
* @Title: EmisCustomsLevelServiceImpl.java
|
||||||
|
* @author heyu
|
||||||
|
* @date 2025-10-09 10:00:00
|
||||||
|
* @version v1.0
|
||||||
|
* @Description: <p> 报关清关级别维护 Service 实现 </p>
|
||||||
|
*/
|
||||||
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisCustomsLevel;
|
||||||
|
import com.xdadan.erp.emis.mapper.EmisCustomsLevelMapper;
|
||||||
|
import com.xdadan.erp.emis.service.IEmisCustomsLevelService;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EmisCustomsLevelServiceImpl implements IEmisCustomsLevelService {
|
||||||
|
@Autowired
|
||||||
|
private EmisCustomsLevelMapper emisCustomsLevelMapper;
|
||||||
|
|
||||||
|
private static final Pattern INVALID_NAME_PATTERN = Pattern
|
||||||
|
.compile("[\\s`~!@#$%^&*()+=|{}':;',\\[\\]\\.<>/?!¥…()—【】‘;:”“’。,、?]");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将前端传来的name转换为对应的code
|
||||||
|
*
|
||||||
|
* @param emisCustomsLevel 报关清关级别对象
|
||||||
|
*/
|
||||||
|
private void convertNameToCode(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
if (emisCustomsLevel == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换类别name为code
|
||||||
|
if (StringUtils.isNotBlank(emisCustomsLevel.getCategory())) {
|
||||||
|
String categoryCode = convertCategoryNameToCode(emisCustomsLevel.getCategory());
|
||||||
|
emisCustomsLevel.setCategory(categoryCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换业务类型name为code
|
||||||
|
if (StringUtils.isNotBlank(emisCustomsLevel.getBizType())) {
|
||||||
|
String bizTypeCode = convertBizTypeNameToCode(emisCustomsLevel.getBizType());
|
||||||
|
emisCustomsLevel.setBizType(bizTypeCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换类别名称到代码
|
||||||
|
*
|
||||||
|
* @param categoryName 类别名称
|
||||||
|
* @return 类别代码
|
||||||
|
*/
|
||||||
|
private String convertCategoryNameToCode(String categoryName) {
|
||||||
|
if (StringUtils.isBlank(categoryName)) {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (categoryName.trim()) {
|
||||||
|
case "绿色":
|
||||||
|
return "1";
|
||||||
|
case "黄色":
|
||||||
|
return "2";
|
||||||
|
case "红色":
|
||||||
|
return "3";
|
||||||
|
case "黑色":
|
||||||
|
return "4";
|
||||||
|
default:
|
||||||
|
// 如果已经是数字代码,直接返回
|
||||||
|
if ("1".equals(categoryName) || "2".equals(categoryName)
|
||||||
|
|| "3".equals(categoryName) || "4".equals(categoryName)) {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("不支持的类别名称: " + categoryName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换业务类型名称到代码
|
||||||
|
*
|
||||||
|
* @param bizTypeName 业务类型名称
|
||||||
|
* @return 业务类型代码
|
||||||
|
*/
|
||||||
|
private String convertBizTypeNameToCode(String bizTypeName) {
|
||||||
|
if (StringUtils.isBlank(bizTypeName)) {
|
||||||
|
return bizTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (bizTypeName.trim()) {
|
||||||
|
case "报关":
|
||||||
|
return "1";
|
||||||
|
case "清关":
|
||||||
|
return "2";
|
||||||
|
default:
|
||||||
|
// 如果已经是数字代码,直接返回
|
||||||
|
if ("1".equals(bizTypeName) || "2".equals(bizTypeName)) {
|
||||||
|
return bizTypeName;
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("不支持的业务类型名称: " + bizTypeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validate(EmisCustomsLevel po) {
|
||||||
|
if (po == null) {
|
||||||
|
throw new IllegalArgumentException("参数为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(po.getCustomerName())) {
|
||||||
|
throw new IllegalArgumentException("客户名称不能为空");
|
||||||
|
}
|
||||||
|
if (INVALID_NAME_PATTERN.matcher(po.getCustomerName()).find()) {
|
||||||
|
throw new IllegalArgumentException("客户名称不能包含空格或特殊符号");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(po.getCategory()) || !("1".equals(po.getCategory()) || "2".equals(po.getCategory())
|
||||||
|
|| "3".equals(po.getCategory()) || "4".equals(po.getCategory()))) {
|
||||||
|
throw new IllegalArgumentException("类别不合法");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(po.getBizType()) || !("1".equals(po.getBizType()) || "2".equals(po.getBizType()))) {
|
||||||
|
throw new IllegalArgumentException("业务类型不合法");
|
||||||
|
}
|
||||||
|
if (po.getStartDate() == null || po.getEndDate() == null) {
|
||||||
|
throw new IllegalArgumentException("开始时间和结束时间不能为空");
|
||||||
|
}
|
||||||
|
if (po.getEndDate().before(po.getStartDate())) {
|
||||||
|
throw new IllegalArgumentException("结束时间不能早于开始时间");
|
||||||
|
}
|
||||||
|
int cnt = emisCustomsLevelMapper.checkUnique(po);
|
||||||
|
if (cnt > 0) {
|
||||||
|
throw new IllegalArgumentException("已存在同客户同类型记录");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmisCustomsLevel selectEmisCustomsLevelById(Long id) {
|
||||||
|
return emisCustomsLevelMapper.selectEmisCustomsLevelById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmisCustomsLevel> selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
return emisCustomsLevelMapper.selectEmisCustomsLevelList(emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int checkUnique(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
return emisCustomsLevelMapper.checkUnique(emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
// 转换前端传来的name为code
|
||||||
|
convertNameToCode(emisCustomsLevel);
|
||||||
|
validate(emisCustomsLevel);
|
||||||
|
return emisCustomsLevelMapper.insertEmisCustomsLevel(emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draftSubmitLevel(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
// 转换前端传来的name为code
|
||||||
|
convertNameToCode(emisCustomsLevel);
|
||||||
|
validate(emisCustomsLevel);
|
||||||
|
emisCustomsLevelMapper.insertEmisCustomsLevel(emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel) {
|
||||||
|
// 转换前端传来的name为code
|
||||||
|
convertNameToCode(emisCustomsLevel);
|
||||||
|
validate(emisCustomsLevel);
|
||||||
|
return emisCustomsLevelMapper.updateEmisCustomsLevel(emisCustomsLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteEmisCustomsLevelByIds(Long[] ids) {
|
||||||
|
return emisCustomsLevelMapper.deleteEmisCustomsLevelByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteEmisCustomsLevelById(Long id) {
|
||||||
|
return emisCustomsLevelMapper.deleteEmisCustomsLevelById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
109
emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml
Normal file
109
emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?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.xdadan.erp.emis.mapper.EmisCustomsLevelMapper">
|
||||||
|
|
||||||
|
<resultMap type="EmisCustomsLevel" id="EmisCustomsLevelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="customerName" column="customer_name"/>
|
||||||
|
<result property="category" column="category"/>
|
||||||
|
<result property="bizType" column="biz_type"/>
|
||||||
|
<result property="startDate" column="start_date"/>
|
||||||
|
<result property="endDate" column="end_date"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEmisCustomsLevelVo">
|
||||||
|
select id, customer_name, category, biz_type, start_date, end_date,
|
||||||
|
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
|
from emis_customs_level
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEmisCustomsLevelList" parameterType="EmisCustomsLevel" resultMap="EmisCustomsLevelResult">
|
||||||
|
<include refid="selectEmisCustomsLevelVo"/>
|
||||||
|
<where>
|
||||||
|
del_flag = '0'
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
and customer_name like concat('%', #{customerName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="category != null">and category = #{category}</if>
|
||||||
|
<if test="bizType != null">and biz_type = #{bizType}</if>
|
||||||
|
<if test="startDate != null">and start_date >= DATE(#{startDate})</if>
|
||||||
|
<if test="endDate != null">and end_date <= DATE(#{endDate})</if>
|
||||||
|
<if test="params.customerName != null">and customer_name = #{params.customerName}</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEmisCustomsLevelById" parameterType="long" resultMap="EmisCustomsLevelResult">
|
||||||
|
<include refid="selectEmisCustomsLevelVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkUnique" parameterType="EmisCustomsLevel" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from emis_customs_level
|
||||||
|
where del_flag = '0'
|
||||||
|
and customer_name = #{customerName}
|
||||||
|
and biz_type = #{bizType}
|
||||||
|
<if test="id != null">and id != #{id}</if>
|
||||||
|
and (
|
||||||
|
(start_date <= DATE(#{endDate}) and end_date >= DATE(#{startDate}))
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEmisCustomsLevel" parameterType="EmisCustomsLevel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into emis_customs_level
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="customerName != null and customerName != ''">customer_name,</if>
|
||||||
|
<if test="category != null and category != ''">category,</if>
|
||||||
|
<if test="bizType != null and bizType != ''">biz_type,</if>
|
||||||
|
<if test="startDate != null">start_date,</if>
|
||||||
|
<if test="endDate != null">end_date,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
||||||
|
del_flag
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
||||||
|
<if test="category != null and category != ''">#{category},</if>
|
||||||
|
<if test="bizType != null and bizType != ''">#{bizType},</if>
|
||||||
|
<if test="startDate != null">#{startDate},</if>
|
||||||
|
<if test="endDate != null">#{endDate},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
||||||
|
'0'
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEmisCustomsLevel" parameterType="EmisCustomsLevel">
|
||||||
|
update emis_customs_level
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
||||||
|
<if test="category != null and category != ''">category = #{category},</if>
|
||||||
|
<if test="bizType != null and bizType != ''">biz_type = #{bizType},</if>
|
||||||
|
<if test="startDate != null">start_date = #{startDate},</if>
|
||||||
|
<if test="endDate != null">end_date = #{endDate},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteEmisCustomsLevelById" parameterType="long">
|
||||||
|
update emis_customs_level set del_flag='2', update_time=now() where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="deleteEmisCustomsLevelByIds" parameterType="long">
|
||||||
|
update emis_customs_level set del_flag='2', update_time=now() where id in
|
||||||
|
<foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user