修改商品类别展示方式为树形结构
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<?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.MaterialCategoryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.MaterialCategory">
|
||||
<!--
|
||||
@@ -10,6 +10,14 @@
|
||||
<result column="Name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="CategoryLevel" jdbcType="SMALLINT" property="categorylevel" />
|
||||
<result column="ParentId" jdbcType="BIGINT" property="parentid" />
|
||||
<result column="sort" jdbcType="VARCHAR" property="sort" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="serial_no" jdbcType="VARCHAR" property="serialNo" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="creator" jdbcType="BIGINT" property="creator" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="updater" jdbcType="BIGINT" property="updater" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
@@ -82,7 +90,8 @@
|
||||
WARNING - @mbggenerated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
Id, Name, CategoryLevel, ParentId
|
||||
Id, Name, CategoryLevel, ParentId, sort, status, serial_no, remark, create_time,
|
||||
creator, update_time, updater
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -136,9 +145,15 @@
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into jsh_materialcategory (Id, Name, CategoryLevel,
|
||||
ParentId)
|
||||
ParentId, sort, status,
|
||||
serial_no, remark, create_time,
|
||||
creator, update_time, updater
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{categorylevel,jdbcType=SMALLINT},
|
||||
#{parentid,jdbcType=BIGINT})
|
||||
#{parentid,jdbcType=BIGINT}, #{sort,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{serialNo,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{creator,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=BIGINT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialCategory">
|
||||
<!--
|
||||
@@ -159,6 +174,30 @@
|
||||
<if test="parentid != null">
|
||||
ParentId,
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="serialNo != null">
|
||||
serial_no,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="updater != null">
|
||||
updater,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -173,6 +212,30 @@
|
||||
<if test="parentid != null">
|
||||
#{parentid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
#{sort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="serialNo != null">
|
||||
#{serialNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updater != null">
|
||||
#{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultType="java.lang.Integer">
|
||||
@@ -204,6 +267,30 @@
|
||||
<if test="record.parentid != null">
|
||||
ParentId = #{record.parentid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.sort != null">
|
||||
sort = #{record.sort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.serialNo != null">
|
||||
serial_no = #{record.serialNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.remark != null">
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.updater != null">
|
||||
updater = #{record.updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@@ -218,7 +305,15 @@
|
||||
set Id = #{record.id,jdbcType=BIGINT},
|
||||
Name = #{record.name,jdbcType=VARCHAR},
|
||||
CategoryLevel = #{record.categorylevel,jdbcType=SMALLINT},
|
||||
ParentId = #{record.parentid,jdbcType=BIGINT}
|
||||
ParentId = #{record.parentid,jdbcType=BIGINT},
|
||||
sort = #{record.sort,jdbcType=VARCHAR},
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
serial_no = #{record.serialNo,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
creator = #{record.creator,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{record.updater,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@@ -239,6 +334,30 @@
|
||||
<if test="parentid != null">
|
||||
ParentId = #{parentid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="serialNo != null">
|
||||
serial_no = #{serialNo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updater != null">
|
||||
updater = #{updater,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
where Id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@@ -250,7 +369,15 @@
|
||||
update jsh_materialcategory
|
||||
set Name = #{name,jdbcType=VARCHAR},
|
||||
CategoryLevel = #{categorylevel,jdbcType=SMALLINT},
|
||||
ParentId = #{parentid,jdbcType=BIGINT}
|
||||
ParentId = #{parentid,jdbcType=BIGINT},
|
||||
sort = #{sort,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
serial_no = #{serialNo,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
updater = #{updater,jdbcType=BIGINT}
|
||||
where Id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.MaterialCategoryMapper">
|
||||
<select id="selectByConditionMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="BaseResultMap">
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx">
|
||||
<select id="selectByConditionMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategoryExample" resultMap="com.jsh.erp.datasource.mappers.MaterialCategoryMapper.BaseResultMap">
|
||||
select *
|
||||
FROM jsh_materialcategory
|
||||
where 1=1
|
||||
@@ -29,4 +29,67 @@
|
||||
</if>
|
||||
and Id !=1
|
||||
</select>
|
||||
|
||||
<resultMap id="BaseTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
|
||||
<result column="id" property="id"/>
|
||||
<result column="name" property="text"/>
|
||||
<collection column="id" property="children" javaType="java.util.ArrayList"
|
||||
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="NextTreeResultMap" type="com.jsh.erp.datasource.vo.TreeNode">
|
||||
<result column="id" property="id"/>
|
||||
<result column="name" property="text"/>
|
||||
<collection column="id" property="children" javaType="java.util.ArrayList"
|
||||
ofType="com.jsh.erp.datasource.vo.TreeNode" select="getNextNodeTree"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name
|
||||
</sql>
|
||||
|
||||
<select id="getNextNodeTree" resultMap="NextTreeResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM jsh_materialcategory
|
||||
WHERE ParentId = #{id}
|
||||
and status !='2'
|
||||
order by sort asc
|
||||
</select>
|
||||
|
||||
<select id="getNodeTree" resultMap="BaseTreeResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM jsh_materialcategory
|
||||
WHERE ParentId = -1
|
||||
and status !='2'
|
||||
order by sort asc
|
||||
</select>
|
||||
<insert id="addMaterialCategory" parameterType="com.jsh.erp.datasource.entities.MaterialCategory"
|
||||
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into jsh_materialcategory
|
||||
(Name, CategoryLevel, ParentId, sort,status,serial_no,remark,
|
||||
create_Time, creator,update_Time, updater)
|
||||
values
|
||||
(#{name},#{categorylevel},#{parentid},#{sort},#{status},#{serialNo},#{remark},
|
||||
#{createTime},#{creator},#{updateTime},#{updater}
|
||||
)
|
||||
</insert>
|
||||
<update id="batchDeleteMaterialCategoryByIds">
|
||||
update jsh_materialcategory
|
||||
set update_Time=#{updateTime},updater=#{updater},status='2'
|
||||
where id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
<update id="editMaterialCategory">
|
||||
update jsh_materialcategory
|
||||
set update_Time=#{updateTime},updater=#{updater},
|
||||
ParentId=#{parentid},sort=#{sort},serial_no=#{serialNo},
|
||||
name=#{name},remark=#{remark}
|
||||
where id =#{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user