Browse Source

更新客户管理

wanghui 8 years ago
parent
commit
8d34346e37

+ 31 - 0
src/main/java/com/goafanti/common/dao/CustomerMapper.java

@@ -93,4 +93,35 @@ public interface CustomerMapper {
      * @mbg.generated Thu Oct 12 20:42:55 CST 2017
      */
     int updateByPrimaryKey(Customer record);
+    
+
+    /**
+     * 删除客户信息
+     */
+    int deleteCustomerByPrimaryKey(String id);
+
+
+    /**
+     * 查询客户详情
+     */
+    Customer selectCustomerByPrimaryKey(String id);
+
+
+
+    /**
+     * 修改客户信息
+     */
+    int updateCustomerByPrimaryKey(String id);
+
+    /**
+     * 新增
+     */
+    int insertCustomer(Customer cus);
+    
+    /**
+     * 
+     * @param ladderId 上层领导ID
+     * @return 所有包含上层领导ID的 客户记录
+     */
+    List<Customer> selectByLadderId(@Param("ladderId")String ladderId);
 }

+ 132 - 0
src/main/java/com/goafanti/common/mapper/CustomerMapper.xml

@@ -378,4 +378,136 @@
       tag = #{tag,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  
+    <update id="updateCustomerByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
+    update customer
+    <set>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="customerTyp != null">
+        customer_typ = #{customerTyp,jdbcType=VARCHAR},
+      </if>
+      <if test="shareTyp != null">
+        share_typ = #{shareTyp,jdbcType=INTEGER},
+      </if>
+      <if test="agentId != null">
+        agent_id = #{agentId,jdbcType=VARCHAR},
+      </if>
+      <if test="companyIntention != null">
+        company_intention = #{companyIntention,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="followSituation != null">
+        follow_situation = #{followSituation,jdbcType=VARCHAR},
+      </if>
+      <if test="customerStatue != null">
+        customer_statue = #{customerStatue,jdbcType=VARCHAR},
+      </if>
+      <if test="paid != null">
+        paid = #{paid,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+
+   <insert id="insertCustomer" parameterType="com.goafanti.common.model.Customer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 11 15:40:31 CST 2017.
+    -->
+    insert into customer
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="customerTyp != null">
+        customer_typ,
+      </if>
+      <if test="shareTyp != null">
+        share_typ,
+      </if>
+      <if test="agentId != null">
+        agent_id,
+      </if>
+      <if test="companyIntention != null">
+        company_intention,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="followSituation != null">
+        follow_situation,
+      </if>
+      <if test="customerStatue != null">
+        customer_statue,
+      </if>
+      <if test="paid != null">
+        paid,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="customerTyp != null">
+        #{customerTyp,jdbcType=VARCHAR},
+      </if>
+      <if test="shareTyp != null">
+        #{shareTyp,jdbcType=INTEGER},
+      </if>
+      <if test="agentId != null">
+        #{agentId,jdbcType=VARCHAR},
+      </if>
+      <if test="companyIntention != null">
+        #{companyIntention,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="followSituation != null">
+        #{followSituation,jdbcType=VARCHAR},
+      </if>
+      <if test="customerStatue != null">
+        #{customerStatue,jdbcType=VARCHAR},
+      </if>
+      <if test="paid != null">
+        #{paid,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+
+  <delete id="deleteCustomerByPrimaryKey" parameterType="java.lang.String">
+    delete from customer
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+
+  <select id="selectCustomerByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerBo">
+    select 
+    a.customer_typ as customerTyp,
+     a.share_typ as shareTyp,
+    a.company_intention as companyIntention,
+    a.create_time as createTime,
+    a.follow_situation as followSituation,
+    a.customer_statue as customerStatue,
+    b.name,b.sex,b.mobile,b.tel_num as telNum,b.email,b.qq,b.wechat,b.depatrment,b.remarks,
+    b.customer_position as customerPosition,
+    c.company_name as companyName,
+    c.location_province as locationProvince,
+    c.company_industry as companyIndustry,
+    c.adress -->
+    from customer a 
+    left join customer_user_info b on  a.id=b.cid
+    left join customer_organization_info c on a.id=c.cid
+    where id = #{id,jdbcType=VARCHAR}
+  </select> 
 </mapper>

+ 0 - 2
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -7,8 +7,6 @@ import java.util.UUID;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.Subject;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;