Sfoglia il codice sorgente

修改客户信息

zou_ht 8 anni fa
parent
commit
455346d8bf

+ 29 - 3
src/main/java/com/goafanti/admin/controller/AdminCustomerApiController.java

@@ -14,7 +14,6 @@ import com.goafanti.admin.service.CustomerService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.model.Customer;
-import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 
 @RestController
@@ -76,11 +75,11 @@ public class AdminCustomerApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 查询客户信息
+	 * 查询客户列表
 	 * 
 	 * @return
 	 */
-	@RequestMapping(value = "/SearchCustomerList", method = RequestMethod.GET)
+	@RequestMapping(value = "/searchCustomerList", method = RequestMethod.GET)
 	public Result SearchCustomerList(String companyName, Integer customerTyp, String province,
 			String customerName, String telNum, String customerStatue, String CompanyIntention, String fllowSituation,Integer pageNo,Integer pageSize) {
 		Result res =new Result();
@@ -88,5 +87,32 @@ public class AdminCustomerApiController extends CertifyApiController {
 				CompanyIntention, fllowSituation,pageNo,pageSize));
 		return res;
 	}
+	
+	/**
+	 * 查询客户信息
+	 * 
+	 * @return
+	 */
+	@RequestMapping(value = "/findCustomer", method = RequestMethod.GET)
+	public Result SearchCustomerInfo(String id) {
+		Result res =new Result();
+		res.setData(customerService.searchCustomer(id));
+		return res;
+	}
+	
+	/**
+	 * 修改客户信息
+	 * 
+	 * @return
+	 */
+	@RequestMapping(value = "/updCustomerList", method = RequestMethod.GET)
+	public Result updCustomerInfo(String id,String aid,String createTime, String companyName, String companyIndustry, String companyIntention,
+			String adress, String customerName, String mobile, String email, String qq, String wechat,
+			String customerPosition, String remark, String province, String fllowSituation, int sex,
+			String customerStatue, String department, int customerTyp, String telNum) {
+		Result res =new Result();
+		customerService.updCustomer(id, aid, createTime, companyName, companyIndustry, companyIntention, adress, customerName, mobile, email, qq, wechat, customerPosition, remark, province, fllowSituation, sex, customerStatue, department, customerTyp, telNum);
+		return res;
+	}
 
 }

+ 7 - 1
src/main/java/com/goafanti/admin/service/CustomerService.java

@@ -12,5 +12,11 @@ public interface CustomerService {
 	
 	Pagination<Customer> findCustomerByPage(String companyName ,Integer customerTyp ,String province ,String customerName ,String telNum ,
 			String customerStatue  ,String CompanyIntention  ,String fllowSituation,Integer pageNo, Integer pageSize);
-
+	
+	int updCustomer(String id,String aid,String createTime, String companyName, String companyIndustry, String companyIntention,
+			String adress, String customerName, String mobile, String email, String qq, String wechat,
+			String customerPosition, String remark, String province, String fllowSituation, int sex,
+			String customerStatue, String department, int customerTyp, String telNum);
+	
+	Customer searchCustomer(String id);
 }

+ 18 - 0
src/main/java/com/goafanti/admin/service/impl/CustomerServiceImpl.java

@@ -72,5 +72,23 @@ public class CustomerServiceImpl extends BaseMybatisDao<CustomerMapper> implemen
 		
 		return params;
 	}
+
+
+	@Override
+	public int updCustomer(String id,String aid,String createTime, String companyName, String companyIndustry, String companyIntention,
+			String adress, String customerName, String mobile, String email, String qq, String wechat,
+			String customerPosition, String remark, String province, String fllowSituation, int sex,
+			String customerStatue, String department, int customerTyp, String telNum) {
+		
+		int res = customerMapper.updateByPrimaryKey(id,aid,createTime, companyName, companyIndustry, companyIntention, adress, customerName, mobile, 
+				email, qq, wechat, customerPosition,remark, province, fllowSituation, sex,customerStatue, department, customerTyp, telNum);
+		return res;
+	}
+
+
+	@Override
+	public Customer searchCustomer(String id) {
+		return customerMapper.selectByPrimaryKey(id);
+	}
 	
 }

+ 8 - 18
src/main/java/com/goafanti/common/dao/CustomerMapper.java

@@ -6,9 +6,8 @@ import com.goafanti.common.model.Customer;
 
 public interface CustomerMapper {
 
-
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
+	 * 删除客户信息
 	 * @mbg.generated  Tue Oct 10 10:30:05 CST 2017
 	 */
 	int deleteByPrimaryKey(String id);
@@ -26,29 +25,20 @@ public interface CustomerMapper {
 	List<Customer> findSearchCustomerListByPage(String companyName ,Integer customerTyp ,String province ,String customerName ,String telNum ,
 			String customerStatue  ,String CompanyIntention  ,String fllowSituation  ,String aid);
 
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Tue Oct 10 10:30:05 CST 2017
-	 */
-	int insertSelective(Customer record);
-
 
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
+	 * 查询单个客户信息
 	 * @mbg.generated  Tue Oct 10 10:30:05 CST 2017
 	 */
 	Customer selectByPrimaryKey(String id);
 
-
 	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
+	 * 修改客户信息
 	 * @mbg.generated  Tue Oct 10 10:30:05 CST 2017
 	 */
-	int updateByPrimaryKeySelective(Customer record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table customer
-	 * @mbg.generated  Tue Oct 10 10:30:05 CST 2017
-	 */
-	int updateByPrimaryKey(Customer record);
+	
+	int updateByPrimaryKey(String id,String aid,String createTime, String companyName, String companyIndustry, String companyIntention,
+			String adress, String customerName, String mobile, String email, String qq, String wechat,
+			String customerPosition, String remark, String province, String fllowSituation, int sex,
+			String customerStatue, String department, int customerTyp, String telNum);
 }

+ 12 - 167
src/main/java/com/goafanti/common/mapper/CustomerMapper.xml

@@ -87,36 +87,22 @@
     customer_name, customer_position, mobile, email, department, qq, wechat, remark, 
     province, fllow_situation, sex, customer_statue
   </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.CustomerExample" resultMap="BaseResultMap">
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from customer
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
+  
+  <!-- 查询单个客户信息 -->
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select 
     <include refid="Base_Column_List" />
     from customer
     where id = #{id,jdbcType=VARCHAR}
   </select>
+  
+   <!-- 删除用户 -->
   <update id="deleteByPrimaryKey" parameterType="java.lang.String">
     update  customer set delete_flg= 1
     where id = #{id,jdbcType=VARCHAR}
   </update>
-  <delete id="deleteByExample" parameterType="java.lang.String">
-    delete from customer
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
+  
+   <!-- 新增客户 -->
   <insert id="insertCustomer" parameterType="com.goafanti.common.model.Customer">
     insert into customer (id, aid, company_nmae, 
       create_time, company_industry, company_intention, 
@@ -133,6 +119,7 @@
       #{province,jdbcType=VARCHAR}, #{fllowSituation,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, 
       #{customerStatue,jdbcType=VARCHAR}, #{customerTyp,jdbcType=INTEGER}, #{telNum,jdbcType=VARCHAR},0,0)
   </insert>
+  
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Customer">
     insert into customer
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -254,123 +241,9 @@
       </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.CustomerExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 10 10:30:05 CST 2017.
-    -->
-    select count(*) from customer
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 10 10:30:05 CST 2017.
-    -->
-    update customer
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.companyName != null">
-        company_nmae = #{record.companyName,jdbcType=VARCHAR},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.companyIndustry != null">
-        company_industry = #{record.companyIndustry,jdbcType=VARCHAR},
-      </if>
-      <if test="record.companyIntention != null">
-        company_intention = #{record.companyIntention,jdbcType=VARCHAR},
-      </if>
-      <if test="record.adress != null">
-        adress = #{record.adress,jdbcType=VARCHAR},
-      </if>
-      <if test="record.customerName != null">
-        customer_name = #{record.customerName,jdbcType=VARCHAR},
-      </if>
-      <if test="record.customerPosition != null">
-        customer_position = #{record.customerPosition,jdbcType=VARCHAR},
-      </if>
-      <if test="record.mobile != null">
-        mobile = #{record.mobile,jdbcType=VARCHAR},
-      </if>
-      <if test="record.email != null">
-        email = #{record.email,jdbcType=VARCHAR},
-      </if>
-      <if test="record.department != null">
-        department = #{record.department,jdbcType=VARCHAR},
-      </if>
-      <if test="record.qq != null">
-        qq = #{record.qq,jdbcType=VARCHAR},
-      </if>
-      <if test="record.wechat != null">
-        wechat = #{record.wechat,jdbcType=VARCHAR},
-      </if>
-      <if test="record.remark != null">
-        remark = #{record.remark,jdbcType=VARCHAR},
-      </if>
-      <if test="record.province != null">
-        province = #{record.province,jdbcType=VARCHAR},
-      </if>
-      <if test="record.fllowSituation != null">
-        fllow_situation = #{record.fllowSituation,jdbcType=VARCHAR},
-      </if>
-      <if test="record.sex != null">
-        sex = #{record.sex,jdbcType=INTEGER},
-      </if>
-      <if test="record.customerStatue != null">
-        customer_statue = #{record.customerStatue,jdbcType=VARCHAR},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Tue Oct 10 10:30:05 CST 2017.
-    -->
-    update customer
-    set id = #{record.id,jdbcType=VARCHAR},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      company_nmae = #{record.companyName,jdbcType=VARCHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      company_industry = #{record.companyIndustry,jdbcType=VARCHAR},
-      company_intention = #{record.companyIntention,jdbcType=VARCHAR},
-      adress = #{record.adress,jdbcType=VARCHAR},
-      customer_name = #{record.customerName,jdbcType=VARCHAR},
-      customer_position = #{record.customerPosition,jdbcType=VARCHAR},
-      mobile = #{record.mobile,jdbcType=VARCHAR},
-      email = #{record.email,jdbcType=VARCHAR},
-      department = #{record.department,jdbcType=VARCHAR},
-      qq = #{record.qq,jdbcType=VARCHAR},
-      wechat = #{record.wechat,jdbcType=VARCHAR},
-      remark = #{record.remark,jdbcType=VARCHAR},
-      province = #{record.province,jdbcType=VARCHAR},
-      fllow_situation = #{record.fllowSituation,jdbcType=VARCHAR},
-      sex = #{record.sex,jdbcType=INTEGER},
-      customer_statue = #{record.customerStatue,jdbcType=VARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" 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 Tue Oct 10 10:30:05 CST 2017.
-    -->
+  
+  <!-- 修改客户信息 -->
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
     update customer
     <set>
       <if test="aid != null">
@@ -430,38 +303,9 @@
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
-  <update id="updateByPrimaryKey" 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 Tue Oct 10 10:30:05 CST 2017.
-    -->
-    update customer
-    set aid = #{aid,jdbcType=VARCHAR},
-      company_nmae = #{companyName,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      company_industry = #{companyIndustry,jdbcType=VARCHAR},
-      company_intention = #{companyIntention,jdbcType=VARCHAR},
-      adress = #{adress,jdbcType=VARCHAR},
-      customer_name = #{customerName,jdbcType=VARCHAR},
-      customer_position = #{customerPosition,jdbcType=VARCHAR},
-      mobile = #{mobile,jdbcType=VARCHAR},
-      email = #{email,jdbcType=VARCHAR},
-      department = #{department,jdbcType=VARCHAR},
-      qq = #{qq,jdbcType=VARCHAR},
-      wechat = #{wechat,jdbcType=VARCHAR},
-      remark = #{remark,jdbcType=VARCHAR},
-      province = #{province,jdbcType=VARCHAR},
-      fllow_situation = #{fllowSituation,jdbcType=VARCHAR},
-      sex = #{sex,jdbcType=INTEGER},
-      customer_statue = #{customerStatue,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  
-  
-  
   
   
+  <!-- 分页查询客户 -->
   <select id="findSearchCustomerListByPage"  resultType="com.goafanti.common.model.Customer">
   	select 
   		a.id,
@@ -506,6 +350,7 @@
 	
   </select>
   
+  <!-- 分页查询客户 -->
   <select id="findSearchCustomerCount" parameterType="String" resultType="java.lang.Integer">
   	select 
   		count(1)