设备管理
This commit is contained in:
parent
548577d50b
commit
008a477ea6
|
|
@ -1,7 +1,6 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.http.HttpException;
|
||||
|
|
@ -9,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.common.utils.HttpClient;
|
||||
import com.bonus.system.api.RemoteDictDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.domain.TreeSelect;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
|
|
|
|||
|
|
@ -1,117 +0,0 @@
|
|||
package com.bonus.material.basic.controller;
|
||||
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.material.basic.domain.BmUnitType;
|
||||
import com.bonus.material.basic.service.IBmUnitTypeService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/14 15:25
|
||||
*/
|
||||
@Api(tags = "往来单位类型管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/bm_unit_type")
|
||||
public class BmUnitTypeController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
private IBmUnitTypeService bmUnitTypeService;
|
||||
|
||||
/**
|
||||
* 查询往来单位类型管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询往来单位类型管理列表")
|
||||
@RequiresPermissions("basic:unitType:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BmUnitType bmUnitType)
|
||||
{
|
||||
if (bmUnitType.getIsAll() != null) {
|
||||
return AjaxResult.success(bmUnitTypeService.selectBmUnitList(bmUnitType));
|
||||
}
|
||||
startPage();
|
||||
List<BmUnitType> list = bmUnitTypeService.selectBmUnitList(bmUnitType);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取往来单位类型详细信息")
|
||||
@RequiresPermissions("basic:unitType:query")
|
||||
@GetMapping(value = "/{typeId}")
|
||||
public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
|
||||
{
|
||||
return AjaxResult.success(bmUnitTypeService.selectListByID(typeId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增往来单位类型管理")
|
||||
@RequiresPermissions("basic:unitType:add")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BmUnitType bmUnitType)
|
||||
{
|
||||
return bmUnitTypeService.insertBmUnitType(bmUnitType);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改往来单位类型管理")
|
||||
@RequiresPermissions("basic:unitType:edit")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BmUnitType bmUnitType)
|
||||
{
|
||||
return bmUnitTypeService.updateBmUnitType(bmUnitType);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除往来单位类型管理")
|
||||
@RequiresPermissions("basic:unitType:remove")
|
||||
@DeleteMapping("/{typeId}")
|
||||
public AjaxResult remove(@PathVariable Long typeId)
|
||||
{
|
||||
return bmUnitTypeService.deleteBmUnitTypeByUnitTypeIds(typeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入模版下载
|
||||
*/
|
||||
@PostMapping("/downLoad")
|
||||
public void downLoadExcelFile(){
|
||||
HttpServletResponse resp = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
||||
bmUnitTypeService.downLoadTemplate(resp);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入往来单位类型管理列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:unitType:importData")
|
||||
@SysLog(title = "往来单位类型管理导入", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导入往来单位类型管理列表")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file)
|
||||
{
|
||||
return bmUnitTypeService.importData(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出往来单位类型管理列表
|
||||
*/
|
||||
@ApiOperation(value = "导出往来单位类型管理列表")
|
||||
@PreventRepeatSubmit
|
||||
@RequiresPermissions("basic:unitType:export")
|
||||
@SysLog(title = "往来单位管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出往来单位类型管理")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BmUnitType bmUnitType)
|
||||
{
|
||||
List<BmUnitType> list = bmUnitTypeService.selectBmUnitList(bmUnitType);
|
||||
ExcelUtil<BmUnitType> util = new ExcelUtil<BmUnitType>(BmUnitType.class);
|
||||
util.exportExcel(response, list, "往来单位管理数据");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.BmUnitType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/14 15:27
|
||||
*/
|
||||
public interface BmUnitTypeMapper {
|
||||
/**
|
||||
* 查询单位类型列表
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
List<BmUnitType> selectBmUnitList(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 根据主键查询单位类型
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
BmUnitType selectListByID(Long typeId);
|
||||
|
||||
/**
|
||||
* 根据类型名称查询单位类型
|
||||
* @param typeName
|
||||
* @return
|
||||
*/
|
||||
BmUnitType selectBmUnitTypeByTypeName(String typeName);
|
||||
|
||||
/**
|
||||
* 新增单位类型
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
int insertBmUnitType(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 修改单位类型
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
int updateBmUnitType(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 删除单位类型
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
int deleteBmUnitTypeByUnitTypeIds(Long typeId);
|
||||
|
||||
/**
|
||||
* 根据主键查询单位类型
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
int select(Long typeId);
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.basic.domain.BmUnitType;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/14 15:26
|
||||
*/
|
||||
public interface IBmUnitTypeService {
|
||||
|
||||
/**
|
||||
* 查询单位类型列表
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
List<BmUnitType> selectBmUnitList(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 根据id查询单位类型
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
BmUnitType selectListByID(Long typeId);
|
||||
|
||||
/**
|
||||
* 新增单位类型
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
AjaxResult insertBmUnitType(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 修改单位类型
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateBmUnitType(BmUnitType bmUnitType);
|
||||
|
||||
/**
|
||||
* 删除单位类型
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult deleteBmUnitTypeByUnitTypeIds(Long typeId);
|
||||
|
||||
/**
|
||||
* 导入模板
|
||||
* @param resp
|
||||
*/
|
||||
void downLoadTemplate(HttpServletResponse resp);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
AjaxResult importData(MultipartFile file);
|
||||
}
|
||||
|
|
@ -1,262 +0,0 @@
|
|||
package com.bonus.material.basic.service.impl;
|
||||
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmUnitType;
|
||||
import com.bonus.material.basic.mapper.BmUnitTypeMapper;
|
||||
import com.bonus.material.basic.service.IBmUnitTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/10/14 15:26
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BmUnitTypeServiceImpl implements IBmUnitTypeService {
|
||||
|
||||
@Resource
|
||||
private BmUnitTypeMapper bmUnitTypeMapper;
|
||||
|
||||
/**
|
||||
* 查询单位类型关联单位列表
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BmUnitType> selectBmUnitList(BmUnitType bmUnitType) {
|
||||
return bmUnitTypeMapper.selectBmUnitList(bmUnitType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询单位类型关联单位
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BmUnitType selectListByID(Long typeId) {
|
||||
return bmUnitTypeMapper.selectListByID(typeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单位类型列表
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertBmUnitType(BmUnitType bmUnitType) {
|
||||
//根据单位类型名称查询,去重
|
||||
BmUnitType unitType = bmUnitTypeMapper.selectBmUnitTypeByTypeName(bmUnitType.getTypeName());
|
||||
if (unitType != null) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
bmUnitType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
bmUnitType.setCreateTime(DateUtils.getNowDate());
|
||||
bmUnitType.setDictType("bm_unit_type");
|
||||
int result = bmUnitTypeMapper.insertBmUnitType(bmUnitType);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改单位类型列表
|
||||
* @param bmUnitType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateBmUnitType(BmUnitType bmUnitType) {
|
||||
//根据单位类型名称查询,去重
|
||||
BmUnitType unitType = bmUnitTypeMapper.selectBmUnitTypeByTypeName(bmUnitType.getTypeName());
|
||||
if (unitType != null) {
|
||||
if (!Objects.equals(unitType.getTypeName(), bmUnitType.getTypeName())) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
}
|
||||
bmUnitType.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
bmUnitType.setUpdateTime(DateUtils.getNowDate());
|
||||
int result = bmUnitTypeMapper.updateBmUnitType(bmUnitType);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单位类型列表
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteBmUnitTypeByUnitTypeIds(Long typeId) {
|
||||
//首先根据单位类型查询是否关联单位
|
||||
int count = bmUnitTypeMapper.select(typeId);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该单位类型关联相关单位,无法删除");
|
||||
}
|
||||
int result = bmUnitTypeMapper.deleteBmUnitTypeByUnitTypeIds(typeId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downLoadTemplate(HttpServletResponse response) {
|
||||
//模板名称
|
||||
String templateName = "BmUnitTypeTemplate.xlsx";
|
||||
OutputStream out = null;
|
||||
InputStream input = null;
|
||||
try {
|
||||
input = this.getClass().getClassLoader().getResourceAsStream("template/BmUnitTypeTemplate.xlsx");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("content-Type", "application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;filename=" + new String((templateName).getBytes(), "iso-8859-1"));
|
||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
out = response.getOutputStream();
|
||||
// 缓冲区
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesToRead = -1;
|
||||
// 通过循环将读入内容输出到浏览器中
|
||||
while ((bytesToRead = input.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesToRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入单位类型列表
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult importData(MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName != null) {
|
||||
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
if (!MaterialConstants.XLSX.equalsIgnoreCase(fileExtension)) {
|
||||
// 文件后缀名不符合要求
|
||||
return AjaxResult.error("导入失败:文件后缀名不符合要求,必须为xlsx结尾");
|
||||
}
|
||||
}
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
Workbook workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
// 得到Excel的行数
|
||||
int totalRows = sheet.getPhysicalNumberOfRows();
|
||||
|
||||
// 检查是否有行数
|
||||
if (totalRows <= 1) {
|
||||
throw new IllegalArgumentException("导入失败:Excel文件中没有数据,请检查后重新导入");
|
||||
}
|
||||
// 读取第一行表头
|
||||
Row headerRow = sheet.getRow(0);
|
||||
|
||||
if (headerRow == null) {
|
||||
throw new IllegalArgumentException("导入失败:文件中没有表头");
|
||||
}
|
||||
// 获取表头的列数
|
||||
int totalCells = headerRow.getPhysicalNumberOfCells();
|
||||
// 假设预期的表头列数为2列,可以根据实际需求修改这个条件
|
||||
if (totalCells != 2) {
|
||||
throw new IllegalArgumentException("导入失败:表头列数与预期不符,请检查导入模板");
|
||||
}
|
||||
// 读取表头内容并验证每一列,看是否符合模版要求
|
||||
for (int cellNum = 0; cellNum < totalCells; cellNum++) {
|
||||
Cell cell = headerRow.getCell(cellNum);
|
||||
// 获取单元格内容并去除首尾空格
|
||||
String headerValue = cell.getStringCellValue().trim();
|
||||
// 根据列索引进行验证
|
||||
switch (cellNum) {
|
||||
case 0:
|
||||
if (!"单位类型".equals(headerValue)) {
|
||||
throw new IllegalArgumentException("第 " + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//读取Excel表格数据,做非空判断
|
||||
// 循环Excel行数
|
||||
DataFormatter dataFormatter = new DataFormatter();
|
||||
for (int r = 1; r < totalRows; r++) {
|
||||
Row row = sheet.getRow(r);
|
||||
// 循环Excel列数
|
||||
for (int c = 0; c < totalCells; c++) {
|
||||
String cellValue = dataFormatter.formatCellValue(row.getCell(c));
|
||||
switch (c) {
|
||||
case 0:
|
||||
checkCellNotEmpty(cellValue, r, c);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列超出范围,请检查后重新导入", r + 1, c + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
ExcelUtil<BmUnitType> util = new ExcelUtil<>(BmUnitType.class);
|
||||
List<BmUnitType> bmUnitTypeList = util.importExcel(file.getInputStream());
|
||||
int result = 0;
|
||||
for (BmUnitType bmUnitType : bmUnitTypeList) {
|
||||
//根据单位类型名称查询,去重
|
||||
BmUnitType unitType = bmUnitTypeMapper.selectBmUnitTypeByTypeName(bmUnitType.getTypeName());
|
||||
if (unitType != null) {
|
||||
//进行更新操作
|
||||
result += bmUnitTypeMapper.updateBmUnitType(unitType);
|
||||
} else {
|
||||
bmUnitType.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
bmUnitType.setCreateTime(DateUtils.getNowDate());
|
||||
bmUnitType.setDictType("bm_unit_type");
|
||||
result += bmUnitTypeMapper.insertBmUnitType(bmUnitType);
|
||||
}
|
||||
}
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取方法用于检查单元格内容是否为空,并抛出异常
|
||||
* @param cellValue
|
||||
* @param rowNum
|
||||
* @param colNum
|
||||
*/
|
||||
private void checkCellNotEmpty(String cellValue, int rowNum, int colNum) {
|
||||
if (StringUtils.isBlank(cellValue)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("第 %d 行,第 %d 列数据为空,请检查后重新导入", rowNum + 1, colNum + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,6 @@ import com.bonus.material.ma.service.IPartTypeService;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 配件类型管理Controller
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
<?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.bonus.material.basic.mapper.BmUnitTypeMapper">
|
||||
<insert id="insertBmUnitType">
|
||||
insert into sys_dict_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="typeName != null and typeName != ''">dict_label,</if>
|
||||
status,
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test=" dictType != null and dictType != ''">dict_type</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="typeName != null and typeName != ''">#{typeName},</if>
|
||||
0,
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test=" dictType != null and dictType != ''">#{dictType}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmUnitType">
|
||||
update sys_dict_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="typeName != null and typeName != ''">dict_label = #{typeName},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime !=null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where dict_code = #{typeId} and dict_type = 'bm_unit_type'
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmUnitTypeByUnitTypeIds">
|
||||
update sys_dict_data set status = 1 where dict_code = #{typeId} and dict_type = 'bm_unit_type'
|
||||
</delete>
|
||||
|
||||
<select id="selectBmUnitList" resultType="com.bonus.material.basic.domain.BmUnitType">
|
||||
select dict_code as typeId, dict_label as typeName, status as delFlag
|
||||
from sys_dict_data
|
||||
where
|
||||
status = '0' and dict_type = 'bm_unit_type'
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND dict_label like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectListByID" resultType="com.bonus.material.basic.domain.BmUnitType">
|
||||
select dict_code as typeId, dict_label as typeName, status as delFlag
|
||||
from sys_dict_data
|
||||
where status = '0' and dict_code = #{typeId} and dict_type = 'bm_unit_type'
|
||||
</select>
|
||||
|
||||
<select id="selectBmUnitTypeByTypeName" resultType="com.bonus.material.basic.domain.BmUnitType">
|
||||
select dict_code as typeId, dict_label as typeName, status as delFlag from sys_dict_data
|
||||
where status = '0' and dict_label = #{typeName} and dict_type = 'bm_unit_type'
|
||||
</select>
|
||||
|
||||
<select id="select" resultType="java.lang.Integer">
|
||||
select count(1) from bm_unit where type_id = #{typeId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue