select m.*,u.name unitName, mc.name categoryName, me.bar_code,
me.purchase_decimal, me.commodity_decimal, me.wholesale_decimal,me.low_decimal,me.sku
FROM jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and m.color like #{bindColor}
and (m.mfrs like #{bindOther} or m.other_field1 like #{bindOther}
or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
and m.weight = #{weight}
and m.expiry_num = #{expiryNum}
and m.enable_serial_number = #{enableSerialNumber}
and m.enable_batch_number = #{enableBatchNumber}
and m.enabled = #{enabled}
and m.remark like #{bindRemark}
and m.category_id in
#{item}
and ifnull(m.delete_flag,'0') !='1'
group by m.id
order by m.id desc
limit #{offset},#{rows}
SELECT
COUNT(m.id)
FROM jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
WHERE 1=1
and me.default_flag=1
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and m.color like #{bindColor}
and (m.mfrs like #{bindOther} or m.other_field1 like #{bindOther}
or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
and m.weight = #{weight}
and m.expiry_num = #{expiryNum}
and m.enable_serial_number = #{enableSerialNumber}
and m.enable_batch_number = #{enableBatchNumber}
and m.enabled = #{enabled}
and m.remark like #{bindRemark}
and m.category_id in
#{item}
and ifnull(m.delete_flag,'0') !='1'
insert into jsh_material
id,
category_id,
name,
mfrs,
model,
standard,
color,
unit,
remark,
img_name,
unit_id,
expiry_num,
weight,
enabled,
other_field1,
other_field2,
other_field3,
enable_serial_number,
enable_batch_number,
tenant_id,
delete_flag,
#{id,jdbcType=BIGINT},
#{categoryId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR},
#{mfrs,jdbcType=VARCHAR},
#{model,jdbcType=VARCHAR},
#{standard,jdbcType=VARCHAR},
#{color,jdbcType=VARCHAR},
#{unit,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR},
#{imgName,jdbcType=VARCHAR},
#{unitId,jdbcType=BIGINT},
#{expiryNum,jdbcType=INTEGER},
#{weight,jdbcType=DECIMAL},
#{enabled,jdbcType=BIT},
#{otherField1,jdbcType=VARCHAR},
#{otherField2,jdbcType=VARCHAR},
#{otherField3,jdbcType=VARCHAR},
#{enableSerialNumber,jdbcType=VARCHAR},
#{enableBatchNumber,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR},
select u.* from jsh_unit u
left join jsh_material m on m.unit_id=u.id and ifnull(m.delete_flag,'0') !='1'
where m.id = #{mId}
and ifnull(u.delete_flag,'0') !='1'
select m.*,u.name unit_name from jsh_material m
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_flag,'0') !='1'
where m.id = #{id}
and ifnull(m.delete_flag,'0') !='1'
select m.*,u.name unit_name,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
me.wholesale_decimal, me.low_decimal
from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where me.id = #{meId}
and ifnull(m.delete_flag,'0') !='1'
select m.*,u.name unit_name,mc.name categoryName,me.bar_code m_bar_code,me.id meId,me.commodity_unit,me.sku from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey} or m.color like #{bindKey})
and m.category_id in
#{item}
and m.enable_serial_number = #{enableSerialNumber}
and m.enable_batch_number = #{enableBatchNumber}
and ifnull(m.delete_flag,'0') !='1'
ORDER BY m.id desc, me.default_flag desc, me.id asc
limit #{offset},#{rows}
select count(1) from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and m.category_id in
#{item}
and m.enable_serial_number = #{enableSerialNumber}
and m.enable_batch_number = #{enableBatchNumber}
and ifnull(m.delete_flag,'0') !='1'
select m.*,u.name unitName, mc.name categoryName,me.bar_code,me.commodity_unit,me.purchase_decimal, me.commodity_decimal,
me.wholesale_decimal, me.low_decimal
FROM jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and m.color like #{bindColor}
and m.weight = #{weight}
and m.expiry_num = #{expiryNum}
and m.enabled = #{enabled}
and m.enable_serial_number = #{enableSerialNumber}
and m.enable_batch_number = #{enableBatchNumber}
and m.remark like #{bindRemark}
and m.category_id in
#{item}
and ifnull(m.delete_flag,'0') !='1'
order by m.id desc
select m.*
FROM jsh_material m
where 1=1
and m.name =#{name}
and ifnull(m.delete_flag,'0') !='1'
select m.*,me.bar_code m_bar_code from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
where 1=1
and m.enabled=1
and m.enable_serial_number ='1'
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and ifnull(m.delete_flag,'0') !='1'
order by m.id desc
limit #{offset},#{rows}
select count(me.id) from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
where 1=1
and m.enabled ='1'
and m.enable_serial_number ='1'
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and ifnull(m.delete_flag,'0') !='1'
update jsh_material
set delete_flag='1'
where 1=1
and ifnull(delete_flag,'0') !='1'
and id in (
#{id}
)
select
from jsh_material
where 1=1
and category_id in (
#{categoryId}
)
and ifnull(delete_flag,'0') !='1'
select
from jsh_material
where 1=1
and unit_id in (
#{unitId}
)
and ifnull(delete_flag,'0') !='1'
select max(CAST(me.bar_code AS SIGNED)) bar_code from jsh_material_extend me
where 1=1
and ifnull(me.delete_Flag,'0') !='1'
select m.*,me.bar_code,u.name unitName, mc.name categoryName
FROM jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.id = #{meId}
and ifnull(m.delete_flag,'0') !='1'
select m.name from jsh_material m
where m.name is not null and m.name !='' and ifnull(m.delete_flag,'0') !='1'
group by m.name
order by m.name asc
select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
me.wholesale_decimal, me.low_decimal, me.sku
from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where
me.bar_code in (
#{barCode}
)
and ifnull(m.delete_flag,'0') !='1'
order by me.id desc
select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
me.wholesale_decimal, me.low_decimal, me.sku
from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where
me.bar_code in (
#{barCode}
)
and me.material_id!=#{mId}
and ifnull(m.delete_flag,'0') !='1'
order by me.id desc
update jsh_material
set unit_id = null
where 1=1
and ifnull(delete_flag,'0') !='1'
and id = #{id}
update jsh_material
set expiry_num = null
where 1=1
and ifnull(delete_flag,'0') !='1'
and id = #{id}
select material_id, ifnull(sum(mis.number),0) number
from jsh_material_initial_stock mis
where 1=1
and mis.depot_id in
#{item}
group by mis.material_id
select m.*, me.commodity_unit unitName, mc.name categoryName, me.bar_code,
ifnull(me.purchase_decimal,0) purchase_decimal,
ifnull(sum(mcs.current_number),0) currentStock,
sum(ifnull(me.purchase_decimal, 0) * ifnull(mcs.current_number, 0)) currentStockPrice
FROM jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and mcs.depot_id in
#{item}
and m.category_id in
#{item}
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})
and ifnull(m.delete_flag,'0') !='1'
group by m.id
having currentStock!=0
order by m.id desc
order by ${column} ${order}
limit #{offset},#{rows}
select count(tb.id) from
(select m.id, ifnull(sum(mcs.current_number),0) currentStock from jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and mcs.depot_id in
#{item}
and m.category_id in
#{item}
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})
and ifnull(m.delete_flag,'0') !='1'
group by m.id
having currentStock!=0
) tb
select
ifnull(sum(mcs.current_number),0) currentStock,
sum(ifnull(me.purchase_decimal,0)*ifnull(mcs.current_number,0)) currentStockPrice
from jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on m.id = mcs.material_id and ifnull(mcs.delete_flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and mcs.depot_id in
#{item}
and m.category_id in
#{item}
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})
and ifnull(m.delete_flag,'0') !='1'
select count(1) from jsh_material m
where ifnull(m.delete_flag,'0') !='1'
and m.name = #{name}
and m.model = #{model}
and m.color = #{color}
and m.standard = #{standard}
and m.mfrs = #{mfrs}
and m.other_field1 = #{otherField1}
and m.other_field2 = #{otherField2}
and m.other_field3 = #{otherField3}
and m.unit = #{unit}
and m.unit_id = #{unitId}
and m.id != #{id}