select m.*,u.name unitName, mc.name categoryName, me.bar_code,
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.status,'0') !='2'
where 1=1
and me.default_flag=1
and me.bar_code like '%${barCode}%'
and m.name like '%${name}%'
and m.standard like '%${standard}%'
and m.model like '%${model}%'
and m.category_id in (${categoryIds})
and ifnull(m.delete_flag,'0') !='1'
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.status,'0') !='2'
WHERE 1=1
and me.default_flag=1
and me.bar_code like '%${barCode}%'
and m.name like '%${name}%'
and m.standard like '%${standard}%'
and m.model like '%${model}%'
and m.category_id in (${categoryIds})
and ifnull(m.delete_flag,'0') !='1'
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 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.status,'0') !='2'
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 ifnull(m.delete_flag,'0') !='1'
ORDER BY id desc
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 (m.name like '%${q}%' or me.bar_code like '%${q}%')
and m.category_id in
#{item}
and ifnull(m.delete_flag,'0') !='1'
select m.*,u.name unitName, mc.name categoryName,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.status,'0') !='2'
where 1=1
and me.default_flag=1
and m.name like '%${name}%'
and m.model like '%${model}%'
and m.category_id in (${categoryIds})
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
id, category_id, name, mfrs, safety_stock, model, standard, color, unit, remark,
unit_id, enabled,enable_serial_number
FROM jsh_material
where 1=1
and enabled ='1'
and enable_serial_number ='1'
and name like #{name}
and model like #{model}
and ifnull(delete_flag,'0') !='1'
order by id desc
select count(1)
FROM jsh_material
where 1=1
and enabled ='1'
and enable_serial_number ='1'
and name like #{name}
and model like #{model}
and ifnull(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(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l
where 1=1
and ifnull(l.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.status,'0') !='2'
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
update jsh_material
set unit_id = null
where 1=1
and ifnull(delete_flag,'0') !='1'
and id = #{id}