<?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.example.erp.mapper.mm.MaterialStoreMapper">
|
|
<select id="getSelectMaterialStore">
|
select
|
m.id,m.type,m.json,m.create_time,bb.consume,bb.type as bomType,bb.price
|
from
|
mm.material_store m
|
left join sd.bom_base as bb on bb.material_id=m.id
|
<where>
|
<if test="materialStore.id != null and materialStore.id != ''">
|
and m.id regexp #{materialStore.id}
|
</if>
|
<if test="materialStore.type != null and materialStore.type != ''">
|
and m.type regexp #{materialStore.type}
|
</if>
|
</where>
|
order by m.id desc
|
limit #{offset},#{pageSize};
|
</select>
|
|
<select id="getSelectProductBOM">
|
select
|
m.id,m.type,m.json,m.create_time,bb.consume,bb.type as bomType,bb.price,bb.id as tabId
|
from
|
sd.bom_base as bb
|
left join mm.material_store m on bb.material_id=m.id
|
<where>
|
<if test="materialStore.id != null and materialStore.id != ''">
|
and m.id regexp #{materialStore.id}
|
</if>
|
<if test="materialStore.type != null and materialStore.type != ''">
|
and m.type regexp #{materialStore.type}
|
</if>
|
</where>
|
order by m.id desc
|
limit #{offset},#{pageSize};
|
</select>
|
|
<select id="getSelectMaterialStores">
|
select
|
*
|
from
|
mm.material_store m
|
<where>
|
<if test="materialStore.id != null and materialStore.id != ''">
|
and m.id regexp #{materialStore.id}
|
</if>
|
<if test="materialStore.type != null and materialStore.type != ''">
|
and m.type regexp #{materialStore.type}
|
</if>
|
</where>
|
order by m.id desc
|
</select>
|
|
<select id="getSelectMaterialStoreById">
|
select * from mm.material_store m where id=#{id}
|
</select>
|
|
<select id="getSelectMaterialStorePageTotal">
|
select
|
CEILING(count(id)/#{pageSize}) as 'pageTotal',
|
count(id) as 'total'
|
from
|
mm.material_store m
|
<where>
|
<if test="materialStore.id != null and materialStore.id != ''">
|
and m.id regexp #{materialStore.id}
|
</if>
|
<if test="materialStore.type != null and materialStore.type != ''">
|
and m.type regexp #{materialStore.type}
|
</if>
|
</where>
|
limit #{offset},#{pageSize};
|
</select>
|
|
<insert id="insertMaterialStore" useGeneratedKeys="true" >
|
insert into mm.material_store (type,json,create_time
|
)
|
values (
|
#{type},#{json},now()
|
)
|
</insert>
|
|
<update id="updateMaterialStore" >
|
update mm.material_store set json=#{json} where id=#{id}
|
</update>
|
|
<delete id="deleteMaterialStore" >
|
delete from mm.material_store where id=#{id}
|
</delete>
|
|
<select id="selectMaterialStore" >
|
select count(*) from mm.material_inventory where material_code=#{id}
|
</select>
|
|
<select id="selectMaterialStoreJson" >
|
select count(*) from mm.material_store where json=#{json}
|
</select>
|
|
|
|
|
</mapper>
|