You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
5.6 KiB
98 lines
5.6 KiB
<?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.system.mapper.PurchaseOrderMapper"> |
|
|
|
<resultMap type="PurchaseOrder" id="PurchaseOrderResult"> |
|
<id property="id" column="id" /> |
|
<result property="planNo" column="plan_no" /> |
|
<result property="purchaseNo" column="purchase_no" /> |
|
<result property="supplierCode" column="supplier_code" /> |
|
<result property="supplierName" column="supplier_name" /> |
|
<result property="machineCode" column="machine_code" /> |
|
<result property="internalModel" column="internal_model" /> |
|
<result property="quantity" column="quantity" /> |
|
<result property="adjustmentTime" column="adjustment_time" /> |
|
<result property="price" column="price" /> |
|
<result property="totalAmount" column="total_amount" /> |
|
<result property="warehouseCode" column="warehouse_code" /> |
|
<result property="warehouseName" column="warehouse_name" /> |
|
<result property="createBy" column="create_by" /> |
|
<result property="createTime" column="create_time" /> |
|
<result property="updateBy" column="update_by" /> |
|
<result property="updateTime" column="update_time" /> |
|
<result property="remark" column="remark" /> |
|
<result property="delFlag" column="del_flag" /> |
|
</resultMap> |
|
|
|
<sql id="selectPurchaseOrderVo"> |
|
select id, plan_no, purchase_no, supplier_code, supplier_name, machine_code, |
|
internal_model, quantity, adjustment_time, price, total_amount, |
|
warehouse_code, warehouse_name, create_by, create_time, update_by, |
|
update_time, remark, del_flag |
|
from purchase_order |
|
</sql> |
|
|
|
<select id="selectPurchaseOrderList" parameterType="PurchaseOrder" resultMap="PurchaseOrderResult"> |
|
<include refid="selectPurchaseOrderVo"/> |
|
<where> |
|
<if test="planNo != null and planNo != ''"> and plan_no like concat('%', #{planNo}, '%')</if> |
|
<if test="purchaseNo != null and purchaseNo != ''"> and purchase_no like concat('%', #{purchaseNo}, '%')</if> |
|
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if> |
|
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if> |
|
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if> |
|
<if test="internalModel != null and internalModel != ''"> and internal_model like concat('%', #{internalModel}, '%')</if> |
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
|
AND date_format(adjustment_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
|
</if> |
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
|
AND date_format(adjustment_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
|
</if> |
|
and del_flag = '0' |
|
</where> |
|
</select> |
|
|
|
<select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult"> |
|
<include refid="selectPurchaseOrderVo"/> |
|
where id = #{id} and del_flag = '0' |
|
</select> |
|
|
|
<insert id="insertPurchaseOrder" parameterType="PurchaseOrder" useGeneratedKeys="true" keyProperty="id"> |
|
insert into purchase_order( |
|
plan_no, purchase_no, supplier_code, supplier_name, machine_code, internal_model, |
|
quantity, adjustment_time, price, total_amount, warehouse_code, warehouse_name, |
|
create_by, create_time, remark, del_flag |
|
) values ( |
|
#{planNo}, #{purchaseNo}, #{supplierCode}, #{supplierName}, #{machineCode}, #{internalModel}, |
|
#{quantity}, #{adjustmentTime}, #{price}, #{totalAmount}, #{warehouseCode}, #{warehouseName}, |
|
#{createBy}, sysdate(), #{remark}, '0' |
|
) |
|
</insert> |
|
|
|
<update id="updatePurchaseOrder" parameterType="PurchaseOrder"> |
|
update purchase_order |
|
<set> |
|
<if test="planNo != null">plan_no = #{planNo},</if> |
|
<if test="purchaseNo != null">purchase_no = #{purchaseNo},</if> |
|
<if test="supplierCode != null">supplier_code = #{supplierCode},</if> |
|
<if test="supplierName != null">supplier_name = #{supplierName},</if> |
|
<if test="machineCode != null">machine_code = #{machineCode},</if> |
|
<if test="internalModel != null">internal_model = #{internalModel},</if> |
|
<if test="quantity != null">quantity = #{quantity},</if> |
|
<if test="adjustmentTime != null">adjustment_time = #{adjustmentTime},</if> |
|
<if test="price != null">price = #{price},</if> |
|
<if test="totalAmount != null">total_amount = #{totalAmount},</if> |
|
<if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if> |
|
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if> |
|
<if test="updateBy != null">update_by = #{updateBy},</if> |
|
update_time = sysdate() |
|
</set> |
|
where id = #{id} |
|
</update> |
|
|
|
<update id="deletePurchaseOrderByIds" parameterType="Long"> |
|
update purchase_order set del_flag = '2' where id in |
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|
#{id} |
|
</foreach> |
|
</update> |
|
</mapper> |