把商品扩展字段表改为带租户id的模式

This commit is contained in:
jishenghua
2025-03-25 23:37:31 +08:00
parent ef587ae8f9
commit a9edd44f6c
10 changed files with 190 additions and 37 deletions

View File

@@ -7,6 +7,7 @@
<result column="enabled" jdbcType="BIT" property="enabled" />
<result column="sort" jdbcType="VARCHAR" property="sort" />
<result column="another_name" jdbcType="VARCHAR" property="anotherName" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
<sql id="Example_Where_Clause">
@@ -68,7 +69,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, native_name, enabled, sort, another_name, delete_flag
id, native_name, enabled, sort, another_name, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialPropertyExample" resultMap="BaseResultMap">
select
@@ -102,11 +103,11 @@
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.MaterialProperty">
insert into jsh_material_property (id, native_name, enabled,
sort, another_name, delete_flag
)
sort, another_name, tenant_id,
delete_flag)
values (#{id,jdbcType=BIGINT}, #{nativeName,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
#{sort,jdbcType=VARCHAR}, #{anotherName,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}
)
#{sort,jdbcType=VARCHAR}, #{anotherName,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialProperty">
insert into jsh_material_property
@@ -126,6 +127,9 @@
<if test="anotherName != null">
another_name,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
@@ -146,6 +150,9 @@
<if test="anotherName != null">
#{anotherName,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
@@ -175,6 +182,9 @@
<if test="record.anotherName != null">
another_name = #{record.anotherName,jdbcType=VARCHAR},
</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>
@@ -190,6 +200,7 @@
enabled = #{record.enabled,jdbcType=BIT},
sort = #{record.sort,jdbcType=VARCHAR},
another_name = #{record.anotherName,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -210,6 +221,9 @@
<if test="anotherName != null">
another_name = #{anotherName,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
@@ -222,6 +236,7 @@
enabled = #{enabled,jdbcType=BIT},
sort = #{sort,jdbcType=VARCHAR},
another_name = #{anotherName,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>

View File

@@ -10,6 +10,7 @@
and native_name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
order by native_name asc
</select>
<update id="batchDeleteMaterialPropertyByIds">
@@ -22,4 +23,18 @@
</foreach>
)
</update>
<select id="getCountByNativeName" resultType="java.lang.Integer">
select count(1)
from jsh_material_property
where native_name = #{nativeName}
and ifnull(delete_flag,'0') !='1'
</select>
<update id="updateMaterialPropertyByNativeName">
update jsh_material_property
set another_name = #{anotherName}
where native_name = #{nativeName}
and ifnull(delete_flag,'0') !='1'
</update>
</mapper>