|
|
@@ -26,35 +26,20 @@
|
|
|
</select>
|
|
|
|
|
|
<!--查询指定行数据-->
|
|
|
- <select id="findSalesTeamList" resultMap="SalesTeamMap">
|
|
|
- select
|
|
|
- <include refid="SalesTeamAllSql"/>
|
|
|
-
|
|
|
- from sales_team
|
|
|
+ <select id="findSalesTeamList" resultType="com.goafanti.admin.bo.SalesTeamBo">
|
|
|
+ select a.id, a.name, a.aid, a.lvl, a.dep_id depId, a.super_id superId, a.status, a.create_time createTime,
|
|
|
+ b.name adminName,c.name depName,d.name superName
|
|
|
+ from sales_team a left join admin b on a.aid=b.id left join department c on a.dep_id=c.id
|
|
|
+ left join sales_team d on a.super_id=d.id
|
|
|
<where>
|
|
|
- <if test="id != null">
|
|
|
- and id = #{id}
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- and name = #{name}
|
|
|
- </if>
|
|
|
<if test="aid != null and aid != ''">
|
|
|
- and aid = #{aid}
|
|
|
- </if>
|
|
|
- <if test="lvl != null">
|
|
|
- and lvl = #{lvl}
|
|
|
+ and a.aid = #{aid}
|
|
|
</if>
|
|
|
<if test="depId != null and depId != ''">
|
|
|
- and dep_id = #{depId}
|
|
|
- </if>
|
|
|
- <if test="superId != null">
|
|
|
- and super_id = #{superId}
|
|
|
+ and a.dep_id = #{depId}
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and status = #{status}
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- and create_time = #{createTime}
|
|
|
+ and a.status = #{status}
|
|
|
</if>
|
|
|
</where>
|
|
|
<if test="page_sql != null">
|
|
|
@@ -65,35 +50,21 @@
|
|
|
<!--统计总行数-->
|
|
|
<select id="findSalesTeamCount" resultType="java.lang.Integer">
|
|
|
select count(1)
|
|
|
- from sales_team
|
|
|
+ from sales_team a
|
|
|
<where>
|
|
|
- <if test="id != null">
|
|
|
- and id = #{id}
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- and name = #{name}
|
|
|
- </if>
|
|
|
<if test="aid != null and aid != ''">
|
|
|
- and aid = #{aid}
|
|
|
- </if>
|
|
|
- <if test="lvl != null">
|
|
|
- and lvl = #{lvl}
|
|
|
+ and a.aid = #{aid}
|
|
|
</if>
|
|
|
<if test="depId != null and depId != ''">
|
|
|
- and dep_id = #{depId}
|
|
|
- </if>
|
|
|
- <if test="superId != null">
|
|
|
- and super_id = #{superId}
|
|
|
+ and a.dep_id = #{depId}
|
|
|
</if>
|
|
|
<if test="status != null">
|
|
|
- and status = #{status}
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- and create_time = #{createTime}
|
|
|
+ and a.status = #{status}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
<!--新增所有列-->
|
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
insert into sales_team(name, aid, lvl, dep_id, super_id, status, create_time)
|
|
|
@@ -162,5 +133,18 @@
|
|
|
where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
+ <select id="queryByName" resultMap="SalesTeamMap">
|
|
|
+ select
|
|
|
+ <include refid="SalesTeamAllSql"/>
|
|
|
+ from sales_team
|
|
|
+ where name = #{name}
|
|
|
+ </select>
|
|
|
+ <select id="queryDetailsById" resultType="com.goafanti.admin.bo.SalesTeamBo">
|
|
|
+ select a.id, a.name, a.aid, a.lvl, a.dep_id depId, a.super_id superId, a.status, a.create_time createTime,
|
|
|
+ b.name adminName,c.name depName,d.name superName
|
|
|
+ from sales_team a left join admin b on a.aid=b.id left join department c on a.dep_id=c.id
|
|
|
+ left join sales_team d on a.super_id=d.id
|
|
|
+ where a.id = #{id}
|
|
|
+ </select>
|
|
|
</mapper>
|
|
|
|