增加商品条码功能

This commit is contained in:
季圣华
2020-02-17 00:59:25 +08:00
parent 301d053bd4
commit 4b61eb59ee
33 changed files with 3728 additions and 1995 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -28,6 +28,7 @@
<result column="AnotherDepotName" jdbcType="VARCHAR" property="AnotherDepotName" />
<result column="UnitId" jdbcType="BIGINT" property="UnitId" />
<result column="UName" jdbcType="VARCHAR" property="UName" />
<result column="barCode" jdbcType="VARCHAR" property="barCode" />
</resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
@@ -134,9 +135,10 @@
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select di.*,m.Name MName,m.Model MModel,m.Unit MaterialUnit,m.Color MColor,m.Standard MStandard,m.Mfrs MMfrs,
m.OtherField1 MOtherField1,m.OtherField2 MOtherField2,m.OtherField3 MOtherField3,
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName, me.bar_code barCode
from jsh_depotitem di
left join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left join jsh_depot dp1 on di.DepotId=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
left join jsh_depot dp2 on di.AnotherDepotId=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'

View File

@@ -0,0 +1,353 @@
<?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.jsh.erp.datasource.mappers.MaterialExtendMapper">
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialExtend">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="material_id" jdbcType="BIGINT" property="materialId" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="commodity_unit" jdbcType="VARCHAR" property="commodityUnit" />
<result column="purchase_decimal" jdbcType="DECIMAL" property="purchaseDecimal" />
<result column="commodity_decimal" jdbcType="DECIMAL" property="commodityDecimal" />
<result column="wholesale_decimal" jdbcType="DECIMAL" property="wholesaleDecimal" />
<result column="low_decimal" jdbcType="DECIMAL" property="lowDecimal" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_serial" jdbcType="VARCHAR" property="createSerial" />
<result column="update_serial" jdbcType="VARCHAR" property="updateSerial" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, material_id, bar_code, commodity_unit, purchase_decimal, commodity_decimal, wholesale_decimal,
low_decimal, create_time, create_serial, update_serial, update_time, tenant_id, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from jsh_material_extend
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from jsh_material_extend
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample">
delete from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
insert into jsh_material_extend (id, material_id, bar_code,
commodity_unit, purchase_decimal, commodity_decimal,
wholesale_decimal, low_decimal, create_time,
create_serial, update_serial, update_time,
tenant_id, delete_Flag)
values (#{id,jdbcType=BIGINT}, #{materialId,jdbcType=BIGINT}, #{barCode,jdbcType=VARCHAR},
#{commodityUnit,jdbcType=VARCHAR}, #{purchaseDecimal,jdbcType=DECIMAL}, #{commodityDecimal,jdbcType=DECIMAL},
#{wholesaleDecimal,jdbcType=DECIMAL}, #{lowDecimal,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP},
#{createSerial,jdbcType=VARCHAR}, #{updateSerial,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
insert into jsh_material_extend
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="materialId != null">
material_id,
</if>
<if test="barCode != null">
bar_code,
</if>
<if test="commodityUnit != null">
commodity_unit,
</if>
<if test="purchaseDecimal != null">
purchase_decimal,
</if>
<if test="commodityDecimal != null">
commodity_decimal,
</if>
<if test="wholesaleDecimal != null">
wholesale_decimal,
</if>
<if test="lowDecimal != null">
low_decimal,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createSerial != null">
create_serial,
</if>
<if test="updateSerial != null">
update_serial,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deleteFlag != null">
delete_Flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="materialId != null">
#{materialId,jdbcType=BIGINT},
</if>
<if test="barCode != null">
#{barCode,jdbcType=VARCHAR},
</if>
<if test="commodityUnit != null">
#{commodityUnit,jdbcType=VARCHAR},
</if>
<if test="purchaseDecimal != null">
#{purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="commodityDecimal != null">
#{commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="wholesaleDecimal != null">
#{wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="lowDecimal != null">
#{lowDecimal,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createSerial != null">
#{createSerial,jdbcType=VARCHAR},
</if>
<if test="updateSerial != null">
#{updateSerial,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultType="java.lang.Long">
select count(*) from jsh_material_extend
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update jsh_material_extend
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.materialId != null">
material_id = #{record.materialId,jdbcType=BIGINT},
</if>
<if test="record.barCode != null">
bar_code = #{record.barCode,jdbcType=VARCHAR},
</if>
<if test="record.commodityUnit != null">
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
</if>
<if test="record.purchaseDecimal != null">
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="record.commodityDecimal != null">
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="record.wholesaleDecimal != null">
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="record.lowDecimal != null">
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.createSerial != null">
create_serial = #{record.createSerial,jdbcType=VARCHAR},
</if>
<if test="record.updateSerial != null">
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update jsh_material_extend
set id = #{record.id,jdbcType=BIGINT},
material_id = #{record.materialId,jdbcType=BIGINT},
bar_code = #{record.barCode,jdbcType=VARCHAR},
commodity_unit = #{record.commodityUnit,jdbcType=VARCHAR},
purchase_decimal = #{record.purchaseDecimal,jdbcType=DECIMAL},
commodity_decimal = #{record.commodityDecimal,jdbcType=DECIMAL},
wholesale_decimal = #{record.wholesaleDecimal,jdbcType=DECIMAL},
low_decimal = #{record.lowDecimal,jdbcType=DECIMAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
create_serial = #{record.createSerial,jdbcType=VARCHAR},
update_serial = #{record.updateSerial,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
update jsh_material_extend
<set>
<if test="materialId != null">
material_id = #{materialId,jdbcType=BIGINT},
</if>
<if test="barCode != null">
bar_code = #{barCode,jdbcType=VARCHAR},
</if>
<if test="commodityUnit != null">
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
</if>
<if test="purchaseDecimal != null">
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
</if>
<if test="commodityDecimal != null">
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
</if>
<if test="wholesaleDecimal != null">
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
</if>
<if test="lowDecimal != null">
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createSerial != null">
create_serial = #{createSerial,jdbcType=VARCHAR},
</if>
<if test="updateSerial != null">
update_serial = #{updateSerial,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.MaterialExtend">
update jsh_material_extend
set material_id = #{materialId,jdbcType=BIGINT},
bar_code = #{barCode,jdbcType=VARCHAR},
commodity_unit = #{commodityUnit,jdbcType=VARCHAR},
purchase_decimal = #{purchaseDecimal,jdbcType=DECIMAL},
commodity_decimal = #{commodityDecimal,jdbcType=DECIMAL},
wholesale_decimal = #{wholesaleDecimal,jdbcType=DECIMAL},
low_decimal = #{lowDecimal,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_serial = #{createSerial,jdbcType=VARCHAR},
update_serial = #{updateSerial,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=BIGINT},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,55 @@
<?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.jsh.erp.datasource.mappers.MaterialExtendMapperEx" >
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialExtendMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.vo.MaterialExtendVo4List">
</resultMap>
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.MaterialExtendExample" resultMap="ResultMapList">
select DISTINCT d.Id,d.bar_code,d.commodity_unit,d.commodity_decimal,d.purchase_decimal,d.wholesale_decimal,d.low_decimal
from jsh_material_extend d
where d.material_id = '${materialId}'
and ifnull(d.delete_Flag,'0') !='1'
order by d.id asc
</select>
<select id="getMaxTimeByTenantAndTime" resultType="java.lang.Long">
select max(update_time) from
(
select update_time from jsh_material_extend
where 1=1
<if test="lastTime != null">
and update_time > ${lastTime}
</if>
order by update_time asc
<if test="syncNum != null">
limit 0,#{syncNum}
</if>
) time_list
</select>
<select id="getListByMId" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
select
<include refid="com.jsh.erp.datasource.mappers.MaterialExtendMapper.Base_Column_List" />
from jsh_material_extend
where 1=1
and material_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
group by material_id
</select>
<update id="batchDeleteMaterialExtendByIds">
update jsh_material_extend
set delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@@ -4,6 +4,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
<result column="m_bar_code" jdbcType="VARCHAR" property="mBarCode" />
</resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
@@ -19,6 +20,9 @@
<if test="name != null">
and m.name like '%${name}%'
</if>
<if test="standard != null">
and m.Standard like '%${standard}%'
</if>
<if test="model != null">
and m.model like '%${model}%'
</if>
@@ -42,6 +46,9 @@
<if test="name != null">
and m.name like '%${name}%'
</if>
<if test="standard != null">
and m.Standard like '%${standard}%'
</if>
<if test="model != null">
and m.model like '%${model}%'
</if>
@@ -65,6 +72,14 @@
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="findByIdWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_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.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where me.id = ${meId}
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="findBySelect" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName from jsh_material m
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
@@ -73,6 +88,32 @@
ORDER BY Id desc
</select>
<select id="findBySelectWithBarCode" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName,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.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
<if test="q != null">
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
</if>
and ifnull(m.delete_Flag,'0') !='1'
ORDER BY Id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="findBySelectWithBarCodeCount" resultType="java.lang.Integer">
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.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
<if test="q != null">
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
<update id="updatePriceNullByPrimaryKey" parameterType="java.lang.Long">
update jsh_material
set
@@ -174,168 +215,21 @@
and ifnull(delete_Flag,'0') !='1'
</select>
<insert id="insertSelectiveEx" parameterType="com.jsh.erp.datasource.entities.Material"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
Id,
</if>
<if test="categoryid != null">
CategoryId,
</if>
<if test="name != null">
Name,
</if>
<if test="mfrs != null">
Mfrs,
</if>
<if test="packing != null">
Packing,
</if>
<if test="safetystock != null">
SafetyStock,
</if>
<if test="model != null">
Model,
</if>
<if test="standard != null">
Standard,
</if>
<if test="color != null">
Color,
</if>
<if test="unit != null">
Unit,
</if>
<if test="remark != null">
Remark,
</if>
<if test="retailprice != null">
RetailPrice,
</if>
<if test="lowprice != null">
LowPrice,
</if>
<if test="presetpriceone != null">
PresetPriceOne,
</if>
<if test="presetpricetwo != null">
PresetPriceTwo,
</if>
<if test="unitid != null">
UnitId,
</if>
<if test="firstoutunit != null">
FirstOutUnit,
</if>
<if test="firstinunit != null">
FirstInUnit,
</if>
<if test="pricestrategy != null">
PriceStrategy,
</if>
<if test="enabled != null">
Enabled,
</if>
<if test="otherfield1 != null">
OtherField1,
</if>
<if test="otherfield2 != null">
OtherField2,
</if>
<if test="otherfield3 != null">
OtherField3,
</if>
<if test="enableserialnumber != null">
enableSerialNumber,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deleteFlag != null">
delete_Flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="categoryid != null">
#{categoryid,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="mfrs != null">
#{mfrs,jdbcType=VARCHAR},
</if>
<if test="packing != null">
#{packing,jdbcType=DECIMAL},
</if>
<if test="safetystock != null">
#{safetystock,jdbcType=DECIMAL},
</if>
<if test="model != null">
#{model,jdbcType=VARCHAR},
</if>
<if test="standard != null">
#{standard,jdbcType=VARCHAR},
</if>
<if test="color != null">
#{color,jdbcType=VARCHAR},
</if>
<if test="unit != null">
#{unit,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="retailprice != null">
#{retailprice,jdbcType=DECIMAL},
</if>
<if test="lowprice != null">
#{lowprice,jdbcType=DECIMAL},
</if>
<if test="presetpriceone != null">
#{presetpriceone,jdbcType=DECIMAL},
</if>
<if test="presetpricetwo != null">
#{presetpricetwo,jdbcType=DECIMAL},
</if>
<if test="unitid != null">
#{unitid,jdbcType=BIGINT},
</if>
<if test="firstoutunit != null">
#{firstoutunit,jdbcType=VARCHAR},
</if>
<if test="firstinunit != null">
#{firstinunit,jdbcType=VARCHAR},
</if>
<if test="pricestrategy != null">
#{pricestrategy,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
#{enabled,jdbcType=BIT},
</if>
<if test="otherfield1 != null">
#{otherfield1,jdbcType=VARCHAR},
</if>
<if test="otherfield2 != null">
#{otherfield2,jdbcType=VARCHAR},
</if>
<if test="otherfield3 != null">
#{otherfield3,jdbcType=VARCHAR},
</if>
<if test="enableserialnumber != null">
#{enableserialnumber,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="getMaxBarCode" resultType="java.lang.String">
select max(CAST(l.bar_code AS SIGNED)) bar_code from jsh_material_extend l
</select>
<select id="getMaterialByMeId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
select m.*,me.bar_code m_bar_code,u.uname unitName, mc.name categoryName, org.org_abr
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.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
left join jsh_organization org on m.orga_id = org.id
where 1=1
<if test="meId != null">
and me.id = ${meId}
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
</mapper>