|
@@ -16,11 +16,11 @@
|
|
|
</constructor>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
- id, agent_name, agent_pwd, agent_real_name, agent_phone, agent_code, add_time, is_lock,
|
|
|
+ id, agent_name, agent_pwd, agent_real_name, agent_phone, agent_code, add_time, is_lock,
|
|
|
parent_id, parent_name
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
- select
|
|
|
+ select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from agent_user
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
@@ -30,13 +30,13 @@
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.xc.pojo.AgentUser" >
|
|
|
- insert into agent_user (id, agent_name, agent_pwd,
|
|
|
- agent_real_name, agent_phone, agent_code,
|
|
|
- add_time, is_lock, parent_id,
|
|
|
+ insert into agent_user (id, agent_name, agent_pwd,
|
|
|
+ agent_real_name, agent_phone, agent_code,
|
|
|
+ add_time, is_lock, parent_id,
|
|
|
parent_name)
|
|
|
- values (#{id,jdbcType=INTEGER}, #{agentName,jdbcType=VARCHAR}, #{agentPwd,jdbcType=VARCHAR},
|
|
|
- #{agentRealName,jdbcType=VARCHAR}, #{agentPhone,jdbcType=VARCHAR}, #{agentCode,jdbcType=VARCHAR},
|
|
|
- #{addTime,jdbcType=TIMESTAMP}, #{isLock,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER},
|
|
|
+ values (#{id,jdbcType=INTEGER}, #{agentName,jdbcType=VARCHAR}, #{agentPwd,jdbcType=VARCHAR},
|
|
|
+ #{agentRealName,jdbcType=VARCHAR}, #{agentPhone,jdbcType=VARCHAR}, #{agentCode,jdbcType=VARCHAR},
|
|
|
+ #{addTime,jdbcType=TIMESTAMP}, #{isLock,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER},
|
|
|
#{parentName,jdbcType=VARCHAR})
|
|
|
|
|
|
</insert>
|
|
@@ -223,4 +223,16 @@
|
|
|
order by
|
|
|
t2.parent_id asc
|
|
|
</select>
|
|
|
-</mapper>
|
|
|
+
|
|
|
+ <select id="findChildren" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ select <include refid="Base_Column_List"/>
|
|
|
+ from (
|
|
|
+ select <include refid="Base_Column_List"/>,
|
|
|
+ if(find_in_set(parent_id, @pids) > 0, @pids := concat(@pids, ',', id), 0) as ischild
|
|
|
+ from (
|
|
|
+ select <include refid="Base_Column_List"/> from agent_user t order by parent_id, id
|
|
|
+ ) t1,
|
|
|
+ (select @pids := #{id}) t2
|
|
|
+ ) t3 where ischild != 0
|
|
|
+ </select>
|
|
|
+</mapper>
|