Commit d9ba64a8 by yubin

inventory

parent 6d104f90
package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.service.IInventoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库存Controller
*
* @author ruoyi
* @date 2025-12-03
*/
@RestController
@RequestMapping("/inventory/inventory")
public class InventoryController extends BaseController
{
@Autowired
private IInventoryService inventoryService;
/**
* 查询库存列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:list')")
@GetMapping("/list")
public TableDataInfo list(Inventory inventory)
{
startPage();
List<Inventory> list = inventoryService.selectInventoryList(inventory);
return getDataTable(list);
}
/**
* 导出库存列表
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:export')")
@Log(title = "库存", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Inventory inventory)
{
List<Inventory> list = inventoryService.selectInventoryList(inventory);
ExcelUtil<Inventory> util = new ExcelUtil<Inventory>(Inventory.class);
util.exportExcel(response, list, "库存数据");
}
/**
* 获取库存详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(inventoryService.selectInventoryById(id));
}
/**
* 新增库存
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:add')")
@Log(title = "库存", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Inventory inventory)
{
return toAjax(inventoryService.insertInventory(inventory));
}
/**
* 修改库存
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:edit')")
@Log(title = "库存", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Inventory inventory)
{
return toAjax(inventoryService.updateInventory(inventory));
}
/**
* 删除库存
*/
@PreAuthorize("@ss.hasPermi('inventory:inventory:remove')")
@Log(title = "库存", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(inventoryService.deleteInventoryByIds(ids));
}
}
package com.ruoyi.inventory.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库存对象 inventory
*
* @author ruoyi
* @date 2025-12-03
*/
public class Inventory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 库存类别1普通2退库 */
@Excel(name = "库存类别1普通2退库")
private Long inventoryType;
/** 入库单号 */
@Excel(name = "入库单号")
private String orderId;
/** 物料ID 检索条件 */
@Excel(name = "物料ID 检索条件")
private String materialId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchId;
/** 库位ID 检索条件 */
@Excel(name = "库位ID 检索条件")
private String locationId;
/** 货主ID 检索条件 */
@Excel(name = "货主ID 检索条件")
private String ownerId;
/** 库存数量 */
@Excel(name = "库存数量")
private Long quantity;
/** 锁定数量 */
@Excel(name = "锁定数量")
private Long lockedQuantity;
/** 单位重量 */
@Excel(name = "单位重量")
private Long unitWeight;
/** 总重量 暂无用 */
@Excel(name = "总重量 暂无用")
private Long totalWeight;
/** 总体积 暂无用 */
@Excel(name = "总体积 暂无用")
private Long totalVolume;
/** 生产日期 暂无用 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期 暂无用", width = 30, dateFormat = "yyyy-MM-dd")
private Date productionDate;
/** 失效日期 暂无用 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "失效日期 暂无用", width = 30, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
/** 库存状态 0-已出库 1-正常 字典,检索条件 */
@Excel(name = "库存状态 0-已出库 1-正常 字典,检索条件")
private Long inventoryStatus;
/** 最后入库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastInboundTime;
/** 最后出库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastOutboundTime;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
@Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
@Excel(name = "排序号")
private String updateUserCode;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setInventoryType(Long inventoryType)
{
this.inventoryType = inventoryType;
}
public Long getInventoryType()
{
return inventoryType;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatchId(String batchId)
{
this.batchId = batchId;
}
public String getBatchId()
{
return batchId;
}
public void setLocationId(String locationId)
{
this.locationId = locationId;
}
public String getLocationId()
{
return locationId;
}
public void setOwnerId(String ownerId)
{
this.ownerId = ownerId;
}
public String getOwnerId()
{
return ownerId;
}
public void setQuantity(Long quantity)
{
this.quantity = quantity;
}
public Long getQuantity()
{
return quantity;
}
public void setLockedQuantity(Long lockedQuantity)
{
this.lockedQuantity = lockedQuantity;
}
public Long getLockedQuantity()
{
return lockedQuantity;
}
public void setUnitWeight(Long unitWeight)
{
this.unitWeight = unitWeight;
}
public Long getUnitWeight()
{
return unitWeight;
}
public void setTotalWeight(Long totalWeight)
{
this.totalWeight = totalWeight;
}
public Long getTotalWeight()
{
return totalWeight;
}
public void setTotalVolume(Long totalVolume)
{
this.totalVolume = totalVolume;
}
public Long getTotalVolume()
{
return totalVolume;
}
public void setProductionDate(Date productionDate)
{
this.productionDate = productionDate;
}
public Date getProductionDate()
{
return productionDate;
}
public void setExpirationDate(Date expirationDate)
{
this.expirationDate = expirationDate;
}
public Date getExpirationDate()
{
return expirationDate;
}
public void setInventoryStatus(Long inventoryStatus)
{
this.inventoryStatus = inventoryStatus;
}
public Long getInventoryStatus()
{
return inventoryStatus;
}
public void setLastInboundTime(Date lastInboundTime)
{
this.lastInboundTime = lastInboundTime;
}
public Date getLastInboundTime()
{
return lastInboundTime;
}
public void setLastOutboundTime(Date lastOutboundTime)
{
this.lastOutboundTime = lastOutboundTime;
}
public Date getLastOutboundTime()
{
return lastOutboundTime;
}
public void setIsUsed(Long isUsed)
{
this.isUsed = isUsed;
}
public Long getIsUsed()
{
return isUsed;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("inventoryType", getInventoryType())
.append("orderId", getOrderId())
.append("materialId", getMaterialId())
.append("batchId", getBatchId())
.append("locationId", getLocationId())
.append("ownerId", getOwnerId())
.append("quantity", getQuantity())
.append("lockedQuantity", getLockedQuantity())
.append("unitWeight", getUnitWeight())
.append("totalWeight", getTotalWeight())
.append("totalVolume", getTotalVolume())
.append("productionDate", getProductionDate())
.append("expirationDate", getExpirationDate())
.append("inventoryStatus", getInventoryStatus())
.append("lastInboundTime", getLastInboundTime())
.append("lastOutboundTime", getLastOutboundTime())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.Inventory;
/**
* 库存Mapper接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface InventoryMapper
{
/**
* 查询库存
*
* @param id 库存主键
* @return 库存
*/
public Inventory selectInventoryById(String id);
/**
* 查询库存
*
* @param id 库存主键
* @return 库存
*/
public Inventory selectInventory(Inventory inventory);
/**
* 查询库存列表
*
* @param inventory 库存
* @return 库存集合
*/
public List<Inventory> selectInventoryList(Inventory inventory);
/**
* 新增库存
*
* @param inventory 库存
* @return 结果
*/
public int insertInventory(Inventory inventory);
/**
* 修改库存
*
* @param inventory 库存
* @return 结果
*/
public int updateInventory(Inventory inventory);
/**
* 删除库存
*
* @param id 库存主键
* @return 结果
*/
public int deleteInventoryById(String id);
/**
* 批量删除库存
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInventoryByIds(String[] ids);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.Inventory;
/**
* 库存Service接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IInventoryService
{
/**
* 查询库存
*
* @param id 库存主键
* @return 库存
*/
public Inventory selectInventoryById(String id);
/**
* 查询库存列表
*
* @param inventory 库存
* @return 库存集合
*/
public List<Inventory> selectInventoryList(Inventory inventory);
Inventory selectInventory(Inventory inventory);
/**
* 新增库存
*
* @param inventory 库存
* @return 结果
*/
public int insertInventory(Inventory inventory);
/**
* 修改库存
*
* @param inventory 库存
* @return 结果
*/
public int updateInventory(Inventory inventory);
/**
* 批量删除库存
*
* @param ids 需要删除的库存主键集合
* @return 结果
*/
public int deleteInventoryByIds(String[] ids);
/**
* 删除库存信息
*
* @param id 库存主键
* @return 结果
*/
public int deleteInventoryById(String id);
}
package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.InventoryMapper;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.service.IInventoryService;
/**
* 库存Service业务层处理
*
* @author ruoyi
* @date 2025-12-03
*/
@Service
public class InventoryServiceImpl implements IInventoryService
{
@Autowired
private InventoryMapper inventoryMapper;
@Autowired
private OutboundOrderLogMapper outboundOrderLogMapper;
/**
* 查询库存
*
* @param id 库存主键
* @return 库存
*/
@Override
public Inventory selectInventoryById(String id)
{
return inventoryMapper.selectInventoryById(id);
}
/**
* 查询库存列表
*
* @param inventory 库存
* @return 库存
*/
@Override
public List<Inventory> selectInventoryList(Inventory inventory)
{
return inventoryMapper.selectInventoryList(inventory);
}
@Override
public Inventory selectInventory(Inventory inventory)
{
Inventory inventory1 = inventoryMapper.selectInventory(inventory);
OutboundOrderLog outboundOrderLog = new OutboundOrderLog();
BeanUtils.copyProperties(inventory1,outboundOrderLog);
inventory1.setLockedQuantity(outboundOrderLogMapper.selectLockedQuantity(outboundOrderLog));
return inventory1;
}
/**
* 新增库存
*
* @param inventory 库存
* @return 结果
*/
@Override
public int insertInventory(Inventory inventory)
{
inventory.setCreateTime(DateUtils.getNowDate());
return inventoryMapper.insertInventory(inventory);
}
/**
* 修改库存
*
* @param inventory 库存
* @return 结果
*/
@Override
public int updateInventory(Inventory inventory)
{
inventory.setUpdateTime(DateUtils.getNowDate());
return inventoryMapper.updateInventory(inventory);
}
/**
* 批量删除库存
*
* @param ids 需要删除的库存主键
* @return 结果
*/
@Override
public int deleteInventoryByIds(String[] ids)
{
return inventoryMapper.deleteInventoryByIds(ids);
}
/**
* 删除库存信息
*
* @param id 库存主键
* @return 结果
*/
@Override
public int deleteInventoryById(String id)
{
return inventoryMapper.deleteInventoryById(id);
}
}
<?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.ruoyi.inventory.mapper.InventoryMapper">
<resultMap type="Inventory" id="InventoryResult">
<result property="id" column="id" />
<result property="inventoryType" column="inventory_type" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<result property="locationId" column="location_id" />
<result property="ownerId" column="owner_id" />
<result property="quantity" column="quantity" />
<result property="lockedQuantity" column="locked_quantity" />
<result property="unitWeight" column="unit_weight" />
<result property="totalWeight" column="total_weight" />
<result property="totalVolume" column="total_volume" />
<result property="productionDate" column="production_date" />
<result property="expirationDate" column="expiration_date" />
<result property="inventoryStatus" column="inventory_status" />
<result property="lastInboundTime" column="last_inbound_time" />
<result property="lastOutboundTime" column="last_outbound_time" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectInventoryVo">
select id, inventory_type, order_id, material_id, batch_id, location_id, owner_id, quantity, locked_quantity, unit_weight, total_weight, total_volume, production_date, expiration_date, inventory_status, last_inbound_time, last_outbound_time, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inventory
</sql>
<select id="selectInventoryList" parameterType="Inventory" resultMap="InventoryResult">
<include refid="selectInventoryVo"/>
<where>
<if test="inventoryType != null "> and inventory_type = #{inventoryType}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="lockedQuantity != null "> and locked_quantity = #{lockedQuantity}</if>
<if test="unitWeight != null "> and unit_weight = #{unitWeight}</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="productionDate != null "> and production_date = #{productionDate}</if>
<if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
<if test="inventoryStatus != null "> and inventory_status = #{inventoryStatus}</if>
<if test="lastInboundTime != null "> and last_inbound_time = #{lastInboundTime}</if>
<if test="lastOutboundTime != null "> and last_outbound_time = #{lastOutboundTime}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectInventory" parameterType="Inventory" resultMap="InventoryResult">
<include refid="selectInventoryVo"/>
<where>
<if test="inventoryType != null "> and inventory_type = #{inventoryType}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="batchId != null and batchId != ''"> and batch_id = #{batchId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="lockedQuantity != null "> and locked_quantity = #{lockedQuantity}</if>
<if test="unitWeight != null "> and unit_weight = #{unitWeight}</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="productionDate != null "> and production_date = #{productionDate}</if>
<if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
<if test="inventoryStatus != null "> and inventory_status = #{inventoryStatus}</if>
<if test="lastInboundTime != null "> and last_inbound_time = #{lastInboundTime}</if>
<if test="lastOutboundTime != null "> and last_outbound_time = #{lastOutboundTime}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectInventoryById" parameterType="String" resultMap="InventoryResult">
<include refid="selectInventoryVo"/>
where id = #{id}
</select>
<insert id="insertInventory" parameterType="Inventory">
insert into inventory
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="inventoryType != null">inventory_type,</if>
<if test="orderId != null">order_id,</if>
<if test="materialId != null">material_id,</if>
<if test="batchId != null">batch_id,</if>
<if test="locationId != null">location_id,</if>
<if test="ownerId != null">owner_id,</if>
<if test="quantity != null">quantity,</if>
<if test="lockedQuantity != null">locked_quantity,</if>
<if test="unitWeight != null">unit_weight,</if>
<if test="totalWeight != null">total_weight,</if>
<if test="totalVolume != null">total_volume,</if>
<if test="productionDate != null">production_date,</if>
<if test="expirationDate != null">expiration_date,</if>
<if test="inventoryStatus != null">inventory_status,</if>
<if test="lastInboundTime != null">last_inbound_time,</if>
<if test="lastOutboundTime != null">last_outbound_time,</if>
<if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="inventoryType != null">#{inventoryType},</if>
<if test="orderId != null">#{orderId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="batchId != null">#{batchId},</if>
<if test="locationId != null">#{locationId},</if>
<if test="ownerId != null">#{ownerId},</if>
<if test="quantity != null">#{quantity},</if>
<if test="lockedQuantity != null">#{lockedQuantity},</if>
<if test="unitWeight != null">#{unitWeight},</if>
<if test="totalWeight != null">#{totalWeight},</if>
<if test="totalVolume != null">#{totalVolume},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="expirationDate != null">#{expirationDate},</if>
<if test="inventoryStatus != null">#{inventoryStatus},</if>
<if test="lastInboundTime != null">#{lastInboundTime},</if>
<if test="lastOutboundTime != null">#{lastOutboundTime},</if>
<if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
</trim>
</insert>
<update id="updateInventory" parameterType="Inventory">
update inventory
<trim prefix="SET" suffixOverrides=",">
<if test="inventoryType != null">inventory_type = #{inventoryType},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="batchId != null">batch_id = #{batchId},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="lockedQuantity != null">locked_quantity = #{lockedQuantity},</if>
<if test="unitWeight != null">unit_weight = #{unitWeight},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="productionDate != null">production_date = #{productionDate},</if>
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
<if test="inventoryStatus != null">inventory_status = #{inventoryStatus},</if>
<if test="lastInboundTime != null">last_inbound_time = #{lastInboundTime},</if>
<if test="lastOutboundTime != null">last_outbound_time = #{lastOutboundTime},</if>
<if test="isUsed != null">is_used = #{isUsed},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInventoryById" parameterType="String">
delete from inventory where id = #{id}
</delete>
<delete id="deleteInventoryByIds" parameterType="String">
delete from inventory where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWarehousesList" parameterType="Warehouses" resultMap="WarehousesResult">
<include refid="selectWarehousesVo"/>
<where>
where is_used=1
<if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if>
<if test="warehousesName != null and warehousesName != ''"> and warehouses_name like concat('%', #{warehousesName}, '%')</if>
<if test="warehouseType != null "> and warehouse_type = #{warehouseType}</if>
......@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectWarehousesById" parameterType="String" resultMap="WarehousesResult">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论