|
@@ -18,6 +18,7 @@
|
|
|
<result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
|
|
|
<result column="create_by" property="createBy" jdbcType="VARCHAR"/>
|
|
|
<result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
|
|
|
+ <result column="parent_id" property="parentId" jdbcType="INTEGER"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!--auto generated Code-->
|
|
@@ -36,7 +37,8 @@
|
|
|
date_create,
|
|
|
date_update,
|
|
|
create_by,
|
|
|
- update_by
|
|
|
+ update_by,
|
|
|
+ parent_id
|
|
|
</sql>
|
|
|
|
|
|
<!--auto generated Code-->
|
|
@@ -56,7 +58,8 @@
|
|
|
date_create,
|
|
|
date_update,
|
|
|
create_by,
|
|
|
- update_by
|
|
|
+ update_by,
|
|
|
+ parent_id
|
|
|
) VALUES (
|
|
|
#{customer.id,jdbcType=INTEGER},
|
|
|
#{customer.siteId,jdbcType=INTEGER},
|
|
@@ -72,7 +75,8 @@
|
|
|
#{customer.dateCreate,jdbcType=TIMESTAMP},
|
|
|
#{customer.dateUpdate,jdbcType=TIMESTAMP},
|
|
|
#{customer.createBy,jdbcType=VARCHAR},
|
|
|
- #{customer.updateBy,jdbcType=VARCHAR}
|
|
|
+ #{customer.updateBy,jdbcType=VARCHAR},
|
|
|
+ #{customer.parentId,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
|
|
@@ -95,6 +99,7 @@
|
|
|
<if test="customer.dateUpdate!=null"> date_update,</if>
|
|
|
<if test="customer.createBy!=null"> create_by,</if>
|
|
|
<if test="customer.updateBy!=null"> update_by,</if>
|
|
|
+ <if test="customer.parentId!=null"> parent_id,</if>
|
|
|
</trim>
|
|
|
VALUES
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -128,6 +133,8 @@
|
|
|
</if>
|
|
|
<if test="customer.updateBy!=null">#{customer.updateBy,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="customer.parentId!=null">#{customer.parentId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
@@ -148,7 +155,8 @@
|
|
|
date_create,
|
|
|
date_update,
|
|
|
create_by,
|
|
|
- update_by
|
|
|
+ update_by,
|
|
|
+ parent_id
|
|
|
)VALUES
|
|
|
<foreach collection="customers" item="customer" index="index" separator=",">
|
|
|
(
|
|
@@ -166,7 +174,8 @@
|
|
|
#{customer.dateCreate,jdbcType=TIMESTAMP},
|
|
|
#{customer.dateUpdate,jdbcType=TIMESTAMP},
|
|
|
#{customer.createBy,jdbcType=VARCHAR},
|
|
|
- #{customer.updateBy,jdbcType=VARCHAR}
|
|
|
+ #{customer.updateBy,jdbcType=VARCHAR},
|
|
|
+ #{customer.parentId,jdbcType=INTEGER}
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
@@ -188,7 +197,8 @@
|
|
|
<if test="customer.dateCreate != null"> date_create= #{customer.dateCreate,jdbcType=TIMESTAMP},</if>
|
|
|
<if test="customer.dateUpdate != null"> date_update= #{customer.dateUpdate,jdbcType=TIMESTAMP},</if>
|
|
|
<if test="customer.createBy != null"> create_by= #{customer.createBy,jdbcType=VARCHAR},</if>
|
|
|
- <if test="customer.updateBy != null"> update_by= #{customer.updateBy,jdbcType=VARCHAR}</if>
|
|
|
+ <if test="customer.updateBy != null"> update_by= #{customer.updateBy,jdbcType=VARCHAR},</if>
|
|
|
+ <if test="customer.parentId != null"> parent_id= #{customer.parentId,jdbcType=INTEGER}</if>
|
|
|
</set>
|
|
|
WHERE id = #{customer.id,jdbcType=INTEGER}
|
|
|
</update>
|
|
@@ -202,7 +212,7 @@
|
|
|
select
|
|
|
id,
|
|
|
customer_name
|
|
|
- from sc_customer
|
|
|
+ from sc_customer
|
|
|
where status = 1
|
|
|
and token = #{code,jdbcType=VARCHAR}
|
|
|
</select>
|
|
@@ -263,5 +273,16 @@
|
|
|
select id,customer_name from sc_customer where status = 1
|
|
|
and id = #{customerId}
|
|
|
</select>
|
|
|
+ <select id="getCustomerTree" resultType="com.bz.smart_city.dto.CustomerDto">
|
|
|
+ select <include refid="Base_Column_List"></include> from sc_customer
|
|
|
+ where status = 1
|
|
|
+ <if test="siteId != null"> and site_id = #{siteId} </if>
|
|
|
+ <if test="customerName != null and customerName != ''"> and customer_name like concat('%',#{customerName} ,'%')</if>
|
|
|
+ order by date_create desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countChildrenNum" resultType="java.lang.Integer">
|
|
|
+ select count(1) from sc_customer where status = 1 and parent_id = #{customerId}
|
|
|
+ </select>
|
|
|
</mapper>
|
|
|
|