Просмотр исходного кода

update

Signed-off-by: anderx <anderx@qq.com>
anderx лет назад: 5
Родитель
Сommit
e91f7f7ed5

+ 98 - 96
src/main/java/com/goafanti/common/dao/UserBusinessMapper.java

@@ -1,97 +1,99 @@
-package com.goafanti.common.dao;
-
-import com.goafanti.common.model.UserBusiness;
-import com.goafanti.common.model.UserBusinessExample;
-import com.goafanti.customer.bo.BusinessListBo;
-import com.goafanti.customer.bo.BussinessFollowBo;
-
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-
-public interface UserBusinessMapper {
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	long countByExample(UserBusinessExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int deleteByExample(UserBusinessExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int deleteByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int insert(UserBusiness record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int insertSelective(UserBusiness record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	List<UserBusiness> selectByExample(UserBusinessExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	UserBusiness selectByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int updateByExampleSelective(@Param("record") UserBusiness record, @Param("example") UserBusinessExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int updateByExample(@Param("record") UserBusiness record, @Param("example") UserBusinessExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int updateByPrimaryKeySelective(UserBusiness record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
-	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
-	 */
-	int updateByPrimaryKey(UserBusiness record);
-
-	List<BusinessListBo> selectBusinessGlossory();
-
-	int judgeBusiness(@Param("uid")String uid,@Param("businessProjectId")String businessProjectId,@Param("aid")String aid);
-
-	List<BusinessListBo> selectBusinessByUAid(@Param("uid")String uid, @Param("aid")String aid);
-	
-	List<BusinessListBo> selectLockedBusinessByUAid(@Param("uid")String uid, @Param("aid")String aid);
-	
-	List<BusinessListBo> selectBusinessProjectByUAPid(@Param("uid")String uid, @Param("aid")String aid, @Param("pid")String pid);
-
-	BussinessFollowBo findBusinessDetail(@Param("businessId")String businessId);
-
-	BussinessFollowBo findFollowOneBusiness(@Param("ufbId") String ufbId);
-	
-	int selectFollowCountByUAid(@Param("uid")String uid, @Param("aid")String aid);
-
-	void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId);
-	
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.UserBusiness;
+import com.goafanti.common.model.UserBusinessExample;
+import com.goafanti.customer.bo.BusinessListBo;
+import com.goafanti.customer.bo.BussinessFollowBo;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface UserBusinessMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	long countByExample(UserBusinessExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int deleteByExample(UserBusinessExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int insert(UserBusiness record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int insertSelective(UserBusiness record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	List<UserBusiness> selectByExample(UserBusinessExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	UserBusiness selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") UserBusiness record, @Param("example") UserBusinessExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int updateByExample(@Param("record") UserBusiness record, @Param("example") UserBusinessExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int updateByPrimaryKeySelective(UserBusiness record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_business
+	 * @mbg.generated  Sat May 05 10:50:19 CST 2018
+	 */
+	int updateByPrimaryKey(UserBusiness record);
+
+	List<BusinessListBo> selectBusinessGlossory();
+
+	int judgeBusiness(@Param("uid")String uid,@Param("businessProjectId")String businessProjectId,@Param("aid")String aid);
+
+	List<BusinessListBo> selectBusinessByUAid(@Param("uid")String uid, @Param("aid")String aid);
+	
+	List<BusinessListBo> selectLockedBusinessByUAid(@Param("uid")String uid, @Param("aid")String aid);
+	
+	List<BusinessListBo> selectBusinessProjectByUAPid(@Param("uid")String uid, @Param("aid")String aid, @Param("pid")String pid);
+
+	BussinessFollowBo findBusinessDetail(@Param("businessId")String businessId);
+
+	BussinessFollowBo findFollowOneBusiness(@Param("ufbId") String ufbId);
+	
+	int selectFollowCountByUAid(@Param("uid")String uid, @Param("aid")String aid);
+
+	void updateDimissionTransfer(@Param("aid")String aid, @Param("transferId")String transferId);
+
+	int checkLock(@Param("aid")String aid, @Param("uid")String uid, @Param("pid")String pid);
+	
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/UserFollowMapper.java

@@ -75,4 +75,6 @@ public interface UserFollowMapper {
 
 
 	int pushUserGuidance(@Param("id")String id, @Param("guidance")Integer guidance);
+
+	
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/UserLockReleaseMapper.java

@@ -126,5 +126,7 @@ public interface UserLockReleaseMapper {
 
 	int insertList(List<UserLockRelease> ulrList);
 
+	int checkLock(@Param("aid")String aid, @Param("uid")String uid, @Param("pid")String pid);
+
 	
 }

+ 64 - 62
src/main/java/com/goafanti/common/enums/roleResources.java

@@ -1,62 +1,64 @@
-package com.goafanti.common.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum roleResources {
-	/**意向客户 */
-	YXKH(	0, "意向客户"),
-	/**签单业务  */
-	QDYW(1, "签单业务 "),
-	/**客户资料  */
-	KHZL(2, "客户资料 "),
-	/**已签订单 */
-	YQDD(3, "已签订单"), 
-	/**项目任务  */
-	XMRW(	4, "项目任务 "),
-	/**科技需求 */
-	KJXQ(	5, "科技需求"), 
-	/**科技成果 */
-	KJCG(	6, "科技成果"),
-	OTHER(7, "未知参数");
-	
-	private Integer	code;
-	private String	desc;
-	
-	private static Map<Integer, roleResources> status = new HashMap<Integer, roleResources>();
-	
-	private roleResources(Integer code, String desc) {
-		this.code = code;
-		this.desc = desc;
-	}
-	
-	static {
-		for (roleResources value : roleResources.values()) {
-			status.put(value.getCode(), value);
-		}
-	}
-	
-	public static roleResources getField(Integer code) {
-		if (containsType(code)) {
-			return status.get(code);
-		}
-		return OTHER;
-	}
-	
-	public static String getFieldDesc(Integer code) {
-		return getField(code).getDesc();
-	}
-
-	public static boolean containsType(Integer code) {
-		return status.containsKey(code);
-	}
-	
-	public Integer getCode() {
-		return code;
-	}
-
-	public String getDesc() {
-		return desc;
-	}
-
-}
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum roleResources {
+	/**意向客户 */
+	YXKH(	0, "意向客户"),
+	/**签单业务  */
+	QDYW(1, "签单业务 "),
+	/**客户资料  */
+	KHZL(2, "客户资料 "),
+	/**已签订单 */
+	YQDD(3, "已签订单"), 
+	/**项目任务  */
+	XMRW(	4, "项目任务 "),
+	/**科技需求 */
+	KJXQ(	5, "科技需求"), 
+	/**科技成果 */
+	KJCG(	6, "科技成果"),
+	/**签单客户 */
+	QDKH(	8, "签单客户"),
+	OTHER(99, "未知参数");
+	
+	private Integer	code;
+	private String	desc;
+	
+	private static Map<Integer, roleResources> status = new HashMap<Integer, roleResources>();
+	
+	private roleResources(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+	
+	static {
+		for (roleResources value : roleResources.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+	
+	public static roleResources getField(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+	
+	public static String getFieldDesc(Integer code) {
+		return getField(code).getDesc();
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+	
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 491 - 486
src/main/java/com/goafanti/common/mapper/UserBusinessMapper.xml

@@ -1,487 +1,492 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.UserBusinessMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserBusiness">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    <id column="id" jdbcType="VARCHAR" property="id" />
-    <result column="uid" jdbcType="VARCHAR" property="uid" />
-    <result column="aid" jdbcType="VARCHAR" property="aid" />
-    <result column="follow_situation" jdbcType="INTEGER" property="followSituation" />
-    <result column="customer_status" jdbcType="INTEGER" property="customerStatus" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
-    <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    id, uid, aid, follow_situation, customer_status, create_time, update_time, remarks, 
-    business_project_id
-  </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from user_business
-    <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">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    select 
-    <include refid="Base_Column_List" />
-    from user_business
-    where id = #{id,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    delete from user_business
-    where id = #{id,jdbcType=VARCHAR}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserBusinessExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    delete from user_business
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.UserBusiness">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    insert into user_business (id, uid, aid, 
-      follow_situation, customer_status, create_time, 
-      update_time, remarks, business_project_id
-      )
-    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
-      #{followSituation,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserBusiness">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    insert into user_business
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="uid != null">
-        uid,
-      </if>
-      <if test="aid != null">
-        aid,
-      </if>
-      <if test="followSituation != null">
-        follow_situation,
-      </if>
-      <if test="customerStatus != null">
-        customer_status,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="updateTime != null">
-        update_time,
-      </if>
-      <if test="remarks != null">
-        remarks,
-      </if>
-      <if test="businessProjectId != null">
-        business_project_id,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
-      <if test="uid != null">
-        #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="followSituation != null">
-        #{followSituation,jdbcType=INTEGER},
-      </if>
-      <if test="customerStatus != null">
-        #{customerStatus,jdbcType=INTEGER},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="remarks != null">
-        #{remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="businessProjectId != null">
-        #{businessProjectId,jdbcType=VARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    select count(*) from user_business
-    <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 Sat May 05 10:50:19 CST 2018.
-    -->
-    update user_business
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=VARCHAR},
-      </if>
-      <if test="record.uid != null">
-        uid = #{record.uid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.followSituation != null">
-        follow_situation = #{record.followSituation,jdbcType=INTEGER},
-      </if>
-      <if test="record.customerStatus != null">
-        customer_status = #{record.customerStatus,jdbcType=INTEGER},
-      </if>
-      <if test="record.createTime != null">
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.updateTime != null">
-        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.remarks != null">
-        remarks = #{record.remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="record.businessProjectId != null">
-        business_project_id = #{record.businessProjectId,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 Sat May 05 10:50:19 CST 2018.
-    -->
-    update user_business
-    set id = #{record.id,jdbcType=VARCHAR},
-      uid = #{record.uid,jdbcType=VARCHAR},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      follow_situation = #{record.followSituation,jdbcType=INTEGER},
-      customer_status = #{record.customerStatus,jdbcType=INTEGER},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
-      remarks = #{record.remarks,jdbcType=VARCHAR},
-      business_project_id = #{record.businessProjectId,jdbcType=VARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserBusiness">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    update user_business
-    <set>
-      <if test="uid != null">
-        uid = #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        aid = #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="followSituation != null">
-        follow_situation = #{followSituation,jdbcType=INTEGER},
-      </if>
-      <if test="customerStatus != null">
-        customer_status = #{customerStatus,jdbcType=INTEGER},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="remarks != null">
-        remarks = #{remarks,jdbcType=VARCHAR},
-      </if>
-      <if test="businessProjectId != null">
-        business_project_id = #{businessProjectId,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserBusiness">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat May 05 10:50:19 CST 2018.
-    -->
-    update user_business
-    set uid = #{uid,jdbcType=VARCHAR},
-      aid = #{aid,jdbcType=VARCHAR},
-      follow_situation = #{followSituation,jdbcType=INTEGER},
-      customer_status = #{customerStatus,jdbcType=INTEGER},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      update_time = #{updateTime,jdbcType=TIMESTAMP},
-      remarks = #{remarks,jdbcType=VARCHAR},
-      business_project_id = #{businessProjectId,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  
-  <select id="selectBusinessGlossory" resultType="com.goafanti.customer.bo.BusinessListBo">
-  	select id as businessGlossoryId,name as businessName from business_glossory
-  </select>
-  
-  <select id="judgeBusiness" resultType="java.lang.Integer">
-  	select count(0) from user_business where
-  	 uid = #{uid,jdbcType=VARCHAR} and customer_status  != 6 
-  	 <if test="businessProjectId != null and businessProjectId != ''">
-  	  	and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
-  	 </if>
-  	 <if test="aid != null and aid != ''">
-  	 	and aid = #{aid,jdbcType=VARCHAR}
-  	 </if>
-  </select>
- 
-  <select id="selectBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
-	select 
-		a.id as businessId,
-		a.uid,
-		a.business_project_id as businessProjectId,
-		a.follow_situation as followSituation,
-		a.customer_status as customerStatus,
-		a.remarks,
-		b.bname as businessProjectName,
-		c.cname as businessvarietiesName
-	from user_business a
-	left join business_project b on a.business_project_id = b.id
-	left join business_category c on b.cid = c.id
-	where  a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR} and  a.customer_status != 6
-	order by a.create_time
-  </select>
-  
-  <select id="selectLockedBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
-	select 
-		x.id as businessId,
-		x.uid,
-		5 as followSituation,
-		x.customer_status as customerStatus,
-		y.business_project_id as businessProjectId,
-		y.bname as businessProjectName,
-		y.cname as businessvarietiesName
-	from(
-		select 
-			id,
-			uid,
-			business_project_id,
-			follow_situation,
-			customer_status,
-			remarks
-		from user_business
-		where uid = #{uid} and aid = #{aid} and customer_status != 6
-	)x right join(
-		select 
-			a.business_project_id,
-			b.bname,
-			c.cname
-		from user_lock_release a
-		left join business_project b on a.business_project_id = b.id
-		left join business_category c on b.cid = c.id
-		where a.uid = #{uid} and a.aid = #{aid} and a.type = 1 and a.status = 0	
-	)y on x.business_project_id = y.business_project_id
-  </select>
-  
-  <select id="selectFollowCountByUAid" parameterType="java.lang.String" resultType="java.lang.Integer">
-  	select count(0) from user_follow where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
-  </select>
-  
-  
-  <select id="findBusinessDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
-	select
-		a.id as businessId,
-		a.uid,
-		a.business_project_id as businessProjectId,
-		a.create_time as createTime,
-		a.follow_situation as followSituation,
-		a.customer_status as customerStatus,
-		a.remarks,
-		b.identify_name as identifyName,
-		c.name as adminName,
-		d.bname as businessProjectName
-	from
-		user_business a left join user b on
-		a.uid = b.id left join admin c on
-		a.aid = c.id left join business_project d on
-		a.business_project_id = d.id
-	where a.id = #{businessId,jdbcType=VARCHAR}
-  </select>
-  
-  <select id="findFollowOneBusiness" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
-	select
-		a.customer_status as customerStatus,
-		a.follow_situation as followSituation,
-		a.remarks,
-		a.business_project_id as businessProjectId,
-		b.id as followId,
-		b.create_time as createTime,
-		b.result,
-		b.contact_type as contactType,
-		d.name as contacts,
-		d.mobile as contactMobile,
-		b.create_time as followTime,
-		e.name as adminName,
-		f.identify_name as identifyName,
-		g.bname as businessProjectName
-	from
-		user_follow_business a 
-	left join user_follow b on a.follow_id = b.id
-	left join user_business c on a.business_id = c.id
-	left join organization_contact_book d on b.ocb_id = d.id
-	left join admin e on b.aid = e.id
-	left join user f on b.uid = f.id
-	left join business_project g on a.business_project_id = g.id
-	where a.id = #{ufbId,jdbcType=VARCHAR}
-  </select>
-  <update id="updateDimissionTransfer" parameterType="java.lang.String">
-  update  user_business 
-	set aid= #{transferId,jdbcType=VARCHAR}
-	where aid= #{aid,jdbcType=VARCHAR}
-  </update>
-  <select id="selectBusinessProjectByUAPid" resultType="com.goafanti.customer.bo.BusinessListBo">
-  select 
-		a.id as businessId,
-		a.uid,
-		a.business_project_id as businessProjectId,
-		a.follow_situation as followSituation,
-		a.customer_status as customerStatus,
-		a.remarks,
-		b.bname as businessProjectName,
-		c.cname as businessvarietiesName
-	from user_business a
-	left join business_project b on a.business_project_id = b.id
-	left join business_category c on b.cid = c.id
-	where  a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR} 
-	and a.business_project_id= #{pid} and  a.customer_status != 6
-  </select>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.UserBusinessMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserBusiness">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="follow_situation" jdbcType="INTEGER" property="followSituation" />
+    <result column="customer_status" jdbcType="INTEGER" property="customerStatus" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    id, uid, aid, follow_situation, customer_status, create_time, update_time, remarks, 
+    business_project_id
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from user_business
+    <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">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from user_business
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    delete from user_business
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserBusinessExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    delete from user_business
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.UserBusiness">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    insert into user_business (id, uid, aid, 
+      follow_situation, customer_status, create_time, 
+      update_time, remarks, business_project_id
+      )
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
+      #{followSituation,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserBusiness">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    insert into user_business
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="uid != null">
+        uid,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="followSituation != null">
+        follow_situation,
+      </if>
+      <if test="customerStatus != null">
+        customer_status,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="businessProjectId != null">
+        business_project_id,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="followSituation != null">
+        #{followSituation,jdbcType=INTEGER},
+      </if>
+      <if test="customerStatus != null">
+        #{customerStatus,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="businessProjectId != null">
+        #{businessProjectId,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    select count(*) from user_business
+    <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 Sat May 05 10:50:19 CST 2018.
+    -->
+    update user_business
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.uid != null">
+        uid = #{record.uid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.aid != null">
+        aid = #{record.aid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.followSituation != null">
+        follow_situation = #{record.followSituation,jdbcType=INTEGER},
+      </if>
+      <if test="record.customerStatus != null">
+        customer_status = #{record.customerStatus,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updateTime != null">
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.remarks != null">
+        remarks = #{record.remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="record.businessProjectId != null">
+        business_project_id = #{record.businessProjectId,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 Sat May 05 10:50:19 CST 2018.
+    -->
+    update user_business
+    set id = #{record.id,jdbcType=VARCHAR},
+      uid = #{record.uid,jdbcType=VARCHAR},
+      aid = #{record.aid,jdbcType=VARCHAR},
+      follow_situation = #{record.followSituation,jdbcType=INTEGER},
+      customer_status = #{record.customerStatus,jdbcType=INTEGER},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      remarks = #{record.remarks,jdbcType=VARCHAR},
+      business_project_id = #{record.businessProjectId,jdbcType=VARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserBusiness">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    update user_business
+    <set>
+      <if test="uid != null">
+        uid = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="followSituation != null">
+        follow_situation = #{followSituation,jdbcType=INTEGER},
+      </if>
+      <if test="customerStatus != null">
+        customer_status = #{customerStatus,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="businessProjectId != null">
+        business_project_id = #{businessProjectId,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserBusiness">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Sat May 05 10:50:19 CST 2018.
+    -->
+    update user_business
+    set uid = #{uid,jdbcType=VARCHAR},
+      aid = #{aid,jdbcType=VARCHAR},
+      follow_situation = #{followSituation,jdbcType=INTEGER},
+      customer_status = #{customerStatus,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      business_project_id = #{businessProjectId,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <select id="selectBusinessGlossory" resultType="com.goafanti.customer.bo.BusinessListBo">
+  	select id as businessGlossoryId,name as businessName from business_glossory
+  </select>
+  
+  <select id="judgeBusiness" resultType="java.lang.Integer">
+  	select count(0) from user_business where
+  	 uid = #{uid,jdbcType=VARCHAR} and customer_status  != 6 
+  	 <if test="businessProjectId != null and businessProjectId != ''">
+  	  	and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
+  	 </if>
+  	 <if test="aid != null and aid != ''">
+  	 	and aid = #{aid,jdbcType=VARCHAR}
+  	 </if>
+  </select>
+ 
+  <select id="selectBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
+	select 
+		a.id as businessId,
+		a.uid,
+		a.business_project_id as businessProjectId,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		a.remarks,
+		b.bname as businessProjectName,
+		c.cname as businessvarietiesName
+	from user_business a
+	left join business_project b on a.business_project_id = b.id
+	left join business_category c on b.cid = c.id
+	where  a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR} and  a.customer_status != 6
+	order by a.create_time
+  </select>
+  
+  <select id="selectLockedBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
+	select 
+		x.id as businessId,
+		x.uid,
+		5 as followSituation,
+		x.customer_status as customerStatus,
+		y.business_project_id as businessProjectId,
+		y.bname as businessProjectName,
+		y.cname as businessvarietiesName
+	from(
+		select 
+			id,
+			uid,
+			business_project_id,
+			follow_situation,
+			customer_status,
+			remarks
+		from user_business
+		where uid = #{uid} and aid = #{aid} and customer_status != 6
+	)x right join(
+		select 
+			a.business_project_id,
+			b.bname,
+			c.cname
+		from user_lock_release a
+		left join business_project b on a.business_project_id = b.id
+		left join business_category c on b.cid = c.id
+		where a.uid = #{uid} and a.aid = #{aid} and a.type = 1 and a.status = 0	
+	)y on x.business_project_id = y.business_project_id
+  </select>
+  
+  <select id="selectFollowCountByUAid" parameterType="java.lang.String" resultType="java.lang.Integer">
+  	select count(0) from user_follow where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
+  </select>
+  
+  
+  <select id="findBusinessDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
+	select
+		a.id as businessId,
+		a.uid,
+		a.business_project_id as businessProjectId,
+		a.create_time as createTime,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		a.remarks,
+		b.identify_name as identifyName,
+		c.name as adminName,
+		d.bname as businessProjectName
+	from
+		user_business a left join user b on
+		a.uid = b.id left join admin c on
+		a.aid = c.id left join business_project d on
+		a.business_project_id = d.id
+	where a.id = #{businessId,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="findFollowOneBusiness" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
+	select
+		a.customer_status as customerStatus,
+		a.follow_situation as followSituation,
+		a.remarks,
+		a.business_project_id as businessProjectId,
+		b.id as followId,
+		b.create_time as createTime,
+		b.result,
+		b.contact_type as contactType,
+		d.name as contacts,
+		d.mobile as contactMobile,
+		b.create_time as followTime,
+		e.name as adminName,
+		f.identify_name as identifyName,
+		g.bname as businessProjectName
+	from
+		user_follow_business a 
+	left join user_follow b on a.follow_id = b.id
+	left join user_business c on a.business_id = c.id
+	left join organization_contact_book d on b.ocb_id = d.id
+	left join admin e on b.aid = e.id
+	left join user f on b.uid = f.id
+	left join business_project g on a.business_project_id = g.id
+	where a.id = #{ufbId,jdbcType=VARCHAR}
+  </select>
+  <update id="updateDimissionTransfer" parameterType="java.lang.String">
+  update  user_business 
+	set aid= #{transferId,jdbcType=VARCHAR}
+	where aid= #{aid,jdbcType=VARCHAR}
+  </update>
+  <select id="selectBusinessProjectByUAPid" resultType="com.goafanti.customer.bo.BusinessListBo">
+  select 
+		a.id as businessId,
+		a.uid,
+		a.business_project_id as businessProjectId,
+		a.follow_situation as followSituation,
+		a.customer_status as customerStatus,
+		a.remarks,
+		b.bname as businessProjectName,
+		c.cname as businessvarietiesName
+	from user_business a
+	left join business_project b on a.business_project_id = b.id
+	left join business_category c on b.cid = c.id
+	where  a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR} 
+	and a.business_project_id= #{pid} and  a.customer_status != 6
+  </select>
+  <select id="checkLock" resultType="java.lang.Integer">
+	select count(*) from user_business 
+	where aid= #{aid} and uid= #{uid} and business_project_id = #{pid}
+	
+  </select>
 </mapper>

+ 5 - 0
src/main/java/com/goafanti/common/mapper/UserLockReleaseMapper.xml

@@ -486,4 +486,9 @@
      </foreach>
   </insert>
   
+  <select id="checkLock" resultType="java.lang.Integer">
+   	select count(*) from user_lock_release 
+	where aid= #{aid} and uid= #{uid} and business_project_id = #{pid}
+  </select>
+  
 </mapper>

+ 2 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -246,7 +246,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		List<LockingReleaseBo> list=userLockReleaseMapper.checkTask(order.getBuyerId(),t.getCommodityId());
 		if (list.size()>0) {
 			for (LockingReleaseBo lockingReleaseBo : list) {
-				if (!lockingReleaseBo.getAid().equals(TokenManager.getAdminId())) {
+				System.out.println(lockingReleaseBo.getAid() +"======="+order.getSalesmanId());
+				if (!lockingReleaseBo.getAid().equals(order.getSalesmanId())) {
 					throw new BusinessException(new Error( "该业务已经被其他人锁定","该业务已经被其他人锁定"));
 				}
 			}

+ 40 - 5
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -52,6 +52,8 @@ import com.goafanti.common.dao.TTaskMidMapper;
 import com.goafanti.common.dao.TaskHoursCountMapper;
 import com.goafanti.common.dao.TaskLogMapper;
 import com.goafanti.common.dao.TaskProgressMapper;
+import com.goafanti.common.dao.UserBusinessMapper;
+import com.goafanti.common.dao.UserLockReleaseMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.OrderLogProcess;
@@ -73,6 +75,8 @@ import com.goafanti.common.model.TTaskMid;
 import com.goafanti.common.model.TaskHoursCount;
 import com.goafanti.common.model.TaskLog;
 import com.goafanti.common.model.TaskProgress;
+import com.goafanti.common.model.UserBusiness;
+import com.goafanti.common.model.UserLockRelease;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.ExportExcelUtil;
 import com.goafanti.common.utils.LoggerUtils;
@@ -142,6 +146,10 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private TTaskMidMapper	tTaskMidMapper;
 	@Autowired
 	private UserMapper	userMapper;
+	@Autowired
+	private UserLockReleaseMapper	userLockReleaseMapper;
+	@Autowired
+	private UserBusinessMapper	userBusinessMapper;
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
 	
@@ -151,10 +159,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	public int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially,String remarks) {
 		TOrderTask t=tOrderTaskMapper.selectByPrimaryKey(taskId);
 		TOrderNew tn=checkDeleteSign(t.getOrderNo());
+		Date date=new Date();
 		t.setTaskStatus(TaskState.DISTRIBUTION.getCode());
 		t.setTaskAllocator(TokenManager.getAdminId());
 		t.setTaskReceiver(taskReceiverId);
-		t.setTaskDistributionTime(new Date());
+		t.setTaskDistributionTime(date);
 		Admin a=adminMapper.selectByPrimaryKey(taskReceiverId);
 		if (a==null||a.getId()==null) {
 			throw  new BusinessException(new Error("分配人员不存在!","分配人员不存在!"));
@@ -168,10 +177,38 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			//设置催款触发
 			TOrderNew b=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
 			if(b.getApproval()==0)orderNewService.pushOrderDun(t.getOrderNo());
+			if (userMapper.checkLock(tn.getBuyerId())<1) {
+				userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
+			}
+			if (userLockReleaseMapper.checkLock(taskReceiverId,tn.getBuyerId(),t.getCommodityId())<1) {
+				UserLockRelease ulr=new UserLockRelease();
+				ulr.setId(UUID.randomUUID().toString());
+				ulr.setBusinessProjectId(t.getCommodityId());
+				ulr.setType(1);
+				ulr.setUid(tn.getBuyerId());
+				ulr.setAid(tn.getSalesmanId());
+				ulr.setStatus(0);
+				ulr.setLockTime(date);
+				userLockReleaseMapper.insertSelective(ulr);
+			}
+			if (userBusinessMapper.checkLock(taskReceiverId,tn.getBuyerId(),t.getCommodityId())<1) {
+				UserBusiness ub=new UserBusiness();
+				ub.setId(UUID.randomUUID().toString());
+				ub.setUid(tn.getBuyerId());
+				ub.setAid(tn.getSalesmanId());
+				ub.setFollowSituation(5);
+				ub.setCustomerStatus(4);
+				ub.setCreateTime(date);
+				ub.setUpdateTime(date);
+				ub.setRemarks("派单自动锁定客户");
+				ub.setBusinessProjectId(t.getCommodityId());
+				userBusinessMapper.insertSelective(ub);
+			}
 		}else if (specially==0) {
 			addOrderLog(t.getOrderNo(), OrderLogProcess.XMPD.getCode(),remarks);
 			t.setConsultantId(taskReceiverId);
-		}else if(specially==2) { //咨询师推给咨询师经理
+		//咨询师推给咨询师经理
+		}else if(specially==2) { 
 			t.setConsultantId(null);
 		}
 		t.setReceiverName(a.getName());
@@ -179,9 +216,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		List<String> aids = new ArrayList<>();
 		aids.add(taskReceiverId);
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),t.getOrderNo(), TokenManager.getAdminId(),0);
-		if (userMapper.checkLock(tn.getBuyerId())<1) {
-			userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
-		}
+		
 		checkProjiectAllocation(t.getOrderNo());
 		return 1;
 	}

+ 240 - 239
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -1,239 +1,240 @@
-package com.goafanti.permission.service.impl;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.goafanti.common.bo.Error;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.OrderExamineMapper;
-import com.goafanti.common.dao.OrganizationContactBookMapper;
-import com.goafanti.common.dao.PatentNewMapper;
-import com.goafanti.common.dao.RoleMapper;
-import com.goafanti.common.dao.RolePermissionMapper;
-import com.goafanti.common.dao.RoleResourcesMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
-import com.goafanti.common.dao.TOrderNewMapper;
-import com.goafanti.common.dao.TOrderTaskMapper;
-import com.goafanti.common.dao.TTaskLogMapper;
-import com.goafanti.common.dao.UserBusinessMapper;
-import com.goafanti.common.dao.UserMapper;
-import com.goafanti.common.dao.UserRoleMapper;
-import com.goafanti.common.enums.roleResources;
-import com.goafanti.common.error.BusinessException;
-import com.goafanti.common.model.Role;
-import com.goafanti.common.model.RolePermission;
-import com.goafanti.common.model.RoleResources;
-import com.goafanti.common.model.UserRole;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.permission.bo.RoleBo;
-import com.goafanti.permission.bo.RolePermissionBo;
-import com.goafanti.permission.service.NewRoleService;
-@Service
-public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements NewRoleService {
-	@Autowired
-	private RoleMapper				roleMapper;
-	@Autowired
-	private UserMapper				userMapper;
-	@Autowired
-	private AdminMapper				adminMapper;
-	@Autowired
-	private UserRoleMapper			userRoleMapper;
-	@Autowired
-	private RolePermissionMapper	rolePermissionMapper;
-	@Autowired
-	private RoleResourcesMapper		roleResourcesMapper;
-	@Autowired
-	private UserBusinessMapper		userBusinessMapper;
-	@Autowired
-	private PatentNewMapper			patentNewMapper;
-	@Autowired
-	private OrganizationContactBookMapper	organizationContactBookMapper;
-	@Autowired
-	private TOrderTaskMapper	tOrderTaskMapper;
-	@Autowired
-	private TOrderNewMapper	tOrderNewMapper;
-	@Autowired
-	private TTaskLogMapper	tTaskLogMapper;
-	@Autowired
-	private TOrderMidMapper	tOrderMidMapper;
-	@Autowired
-	private OrderExamineMapper	orderExamineMapper;
-	@Override
-	public Pagination<RoleBo> findRoles(RoleBo role, Integer pageNo, Integer pageSize) {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		Map<String,Object> params =disposeParams(role);
-		@SuppressWarnings("unchecked")
-		Pagination<RoleBo> p=(Pagination<RoleBo>)findPage("selectRoleList","selectRoleCount",params,pageNo,pageSize);		
-		@SuppressWarnings("unchecked")
-		List<RoleBo> list=(List<RoleBo>) p.getList();
-		for(RoleBo i:list){
-			if(i.getCreateTime()!=null){
-				i.setCreateTimez(sdf.format(i.getCreateTime()));
-			}
-			
-		}
-		return p;
-	}
-	private Map<String,Object> disposeParams(RoleBo role){
-		Map<String,Object> params = new HashMap<String, Object>();			
-		if(StringUtils.isNotBlank(role.getRoleName())) params.put("roleName", role.getRoleName());		
-		return params;
-		
-	}
-	
-	@Override
-	public Set<String> findRoleByUserId(String userId) {
-		return roleMapper.findRoleByUserId(userId);
-	}
-
-	
-
-	@Override
-	public int insert(List<Role> records) {
-		return roleMapper.insertBatch(records);
-	}
-
-	@Override
-	public int deleteByPrimaryKeys(List<String> records) {
-		rolePermissionMapper.deleteByRoleId(records);
-		userRoleMapper.deleteByRoleId(records);
-		List<String> data= userRoleMapper.findUserIdByRoleIds(records);
-		TokenManager.clearUserAuthByUserId(data.toArray(new String[]{}));
-		return roleMapper.deleteByPrimaryKeys(records);
-	}
-
-
-	@Override
-	public int bindPermission(String rid, String pid) {
-		TokenManager.clearUserAuthByUserId((String[]) userRoleMapper.findUserIdByRoleId(rid).toArray());
-		return rolePermissionMapper.insert(new RolePermission(rid, pid));
-	}
-
-	@Override
-	public int bindUser(String rid, String uid) {
-		TokenManager.clearUserAuthByUserId(new String[] { uid });
-		return userRoleMapper.insert(new UserRole(uid, rid));
-	}
-
-	@Override
-	public int unbindPermission(String roleId, String permissionId) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("rid", roleId);
-		params.put("pid", permissionId);
-		TokenManager.clearUserAuthByUserId((String[]) userRoleMapper.findUserIdByRoleId(roleId).toArray());
-		return rolePermissionMapper.deleteByPrimaryKey(params);
-	}
-
-	@Override
-	public int unbindUser(String roleId, String userId) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("rid", roleId);
-		params.put("uid", userId);
-		TokenManager.clearUserAuthByUserId(new String[] { userId });
-		return userRoleMapper.deleteByUserRole(params);
-	}
-
-	@Override
-	public int insert(Role record, List<String> permissions) {
-		Date now = new Date();
-		if (record.getId() != null) {
-			List<RolePermission> rps = new ArrayList<>();
-			rolePermissionMapper.deleteByRid(record.getId());
-			for (String pid : permissions) {
-				rps.add(new RolePermission(record.getId(), pid));
-			}
-			if (!rps.isEmpty()) {
-				rolePermissionMapper.insertBatch(rps);
-			}
-			List<String> ids = userRoleMapper.findUserIdByRoleId(record.getId());
-			TokenManager.clearUserAuthByUserId(ids.toArray(new String[ids.size()]));
-		}
-		record.getId();
-		record.setCreater("管理员");		
-		record.setCreateTime(now);
-		return roleMapper.insert(record);
-	}
-	@Override
-	public List<RolePermissionBo> selectRolePList(String id) {
-		List<RolePermissionBo> list=roleMapper.selectRolePList(id);
-		return list;
-	}
-	@Override
-	public int addResources(String rid, String resources) {
-		List<String> list = Arrays.asList(resources.split(","));
-		RoleResources rr=new RoleResources();
-		if (roleResourcesMapper.checkRid(rid)>0) {
-			roleResourcesMapper.deleteResources(rid);
-		}
-		for (String s : list) {
-			rr.setId(UUID.randomUUID().toString());
-			rr.setRoleId(rid);
-			rr.setCreateTime(new Date());
-			try {
-			    rr.setResources(Integer.parseInt(s));
-			} catch (NumberFormatException e) {
-			    e.printStackTrace();
-			}
-			roleResourcesMapper.insert(rr);
-		}
-		return 1;
-	}
-	
-	@Override
-	public int updatedimission(String aid, String transferId) {
-		List<Integer> list=roleResourcesMapper.selectAdminRoleResources(aid);
-		if (list.size()<1||list.get(0)==null) {
-			throw new BusinessException(new Error("","用户角色资源不存在"));
-		}
-		for (Integer s : list) {
-			if (s==roleResources.YXKH.getCode()) {
-				roleResourcesMapper.updateLockRelease("0",aid,transferId);//将用户锁转给指定人
-				userBusinessMapper.updateDimissionTransfer(aid,transferId);
-				organizationContactBookMapper.updateDimissionTransfer(aid,transferId);
-				userMapper.updateDimissionTransfer(aid,transferId);
-			}
-			if (s==roleResources.QDYW.getCode()) {
-				tOrderNewMapper.updateSalesmanId(aid, transferId);
-				tOrderMidMapper.updateSalesmanId(aid, transferId);
-				patentNewMapper.updateAdmin(aid,transferId);
-				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
-			}
-			if (s==roleResources.XMRW.getCode()) {
-//				contractTaskLogMapper.updateDimissionTransfer(aid,transferId);
-				//获取被转角色判断修改对应任务角色
-				String qx=adminMapper.getPermission(transferId);
-				Integer type=-1;
-				if (qx.equals(AFTConstants.TECH)) type=0;
-				else if(qx.equals(AFTConstants.TECH_MANAGER))type=1;
-				if (type!=-1) {
-					tOrderTaskMapper.updateDimissionTransfer(aid,transferId,type);
-					tTaskLogMapper.updateDimissionTransfer(aid,transferId);
-					orderExamineMapper.updateDimissionTransfer(aid,transferId);
-				}
-			}
-			if (s!=roleResources.QDYW.getCode()) {
-				roleResourcesMapper.updateDimissionTransfer(s,aid,transferId);
-			}
-		}
-		return 1;
-	}
-	@Override
-	public List<RoleResources> ResourcesDetail(String rid) {
-		return roleResourcesMapper.selectByRid(rid);
-	}
-	
-}
+package com.goafanti.permission.service.impl;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.OrderExamineMapper;
+import com.goafanti.common.dao.OrganizationContactBookMapper;
+import com.goafanti.common.dao.PatentNewMapper;
+import com.goafanti.common.dao.RoleMapper;
+import com.goafanti.common.dao.RolePermissionMapper;
+import com.goafanti.common.dao.RoleResourcesMapper;
+import com.goafanti.common.dao.TOrderMidMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.dao.TOrderTaskMapper;
+import com.goafanti.common.dao.TTaskLogMapper;
+import com.goafanti.common.dao.UserBusinessMapper;
+import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.dao.UserRoleMapper;
+import com.goafanti.common.enums.roleResources;
+import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.Role;
+import com.goafanti.common.model.RolePermission;
+import com.goafanti.common.model.RoleResources;
+import com.goafanti.common.model.UserRole;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.permission.bo.RoleBo;
+import com.goafanti.permission.bo.RolePermissionBo;
+import com.goafanti.permission.service.NewRoleService;
+@Service
+public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements NewRoleService {
+	@Autowired
+	private RoleMapper				roleMapper;
+	@Autowired
+	private UserMapper				userMapper;
+	@Autowired
+	private AdminMapper				adminMapper;
+	@Autowired
+	private UserRoleMapper			userRoleMapper;
+	@Autowired
+	private RolePermissionMapper	rolePermissionMapper;
+	@Autowired
+	private RoleResourcesMapper		roleResourcesMapper;
+	@Autowired
+	private UserBusinessMapper		userBusinessMapper;
+	@Autowired
+	private PatentNewMapper			patentNewMapper;
+	@Autowired
+	private OrganizationContactBookMapper	organizationContactBookMapper;
+	@Autowired
+	private TOrderTaskMapper	tOrderTaskMapper;
+	@Autowired
+	private TOrderNewMapper	tOrderNewMapper;
+	@Autowired
+	private TTaskLogMapper	tTaskLogMapper;
+	@Autowired
+	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private OrderExamineMapper	orderExamineMapper;
+	@Override
+	public Pagination<RoleBo> findRoles(RoleBo role, Integer pageNo, Integer pageSize) {
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Map<String,Object> params =disposeParams(role);
+		@SuppressWarnings("unchecked")
+		Pagination<RoleBo> p=(Pagination<RoleBo>)findPage("selectRoleList","selectRoleCount",params,pageNo,pageSize);		
+		@SuppressWarnings("unchecked")
+		List<RoleBo> list=(List<RoleBo>) p.getList();
+		for(RoleBo i:list){
+			if(i.getCreateTime()!=null){
+				i.setCreateTimez(sdf.format(i.getCreateTime()));
+			}
+			
+		}
+		return p;
+	}
+	private Map<String,Object> disposeParams(RoleBo role){
+		Map<String,Object> params = new HashMap<String, Object>();			
+		if(StringUtils.isNotBlank(role.getRoleName())) params.put("roleName", role.getRoleName());		
+		return params;
+		
+	}
+	
+	@Override
+	public Set<String> findRoleByUserId(String userId) {
+		return roleMapper.findRoleByUserId(userId);
+	}
+
+	
+
+	@Override
+	public int insert(List<Role> records) {
+		return roleMapper.insertBatch(records);
+	}
+
+	@Override
+	public int deleteByPrimaryKeys(List<String> records) {
+		rolePermissionMapper.deleteByRoleId(records);
+		userRoleMapper.deleteByRoleId(records);
+		List<String> data= userRoleMapper.findUserIdByRoleIds(records);
+		TokenManager.clearUserAuthByUserId(data.toArray(new String[]{}));
+		return roleMapper.deleteByPrimaryKeys(records);
+	}
+
+
+	@Override
+	public int bindPermission(String rid, String pid) {
+		TokenManager.clearUserAuthByUserId((String[]) userRoleMapper.findUserIdByRoleId(rid).toArray());
+		return rolePermissionMapper.insert(new RolePermission(rid, pid));
+	}
+
+	@Override
+	public int bindUser(String rid, String uid) {
+		TokenManager.clearUserAuthByUserId(new String[] { uid });
+		return userRoleMapper.insert(new UserRole(uid, rid));
+	}
+
+	@Override
+	public int unbindPermission(String roleId, String permissionId) {
+		Map<String, Object> params = new HashMap<>();
+		params.put("rid", roleId);
+		params.put("pid", permissionId);
+		TokenManager.clearUserAuthByUserId((String[]) userRoleMapper.findUserIdByRoleId(roleId).toArray());
+		return rolePermissionMapper.deleteByPrimaryKey(params);
+	}
+
+	@Override
+	public int unbindUser(String roleId, String userId) {
+		Map<String, Object> params = new HashMap<>();
+		params.put("rid", roleId);
+		params.put("uid", userId);
+		TokenManager.clearUserAuthByUserId(new String[] { userId });
+		return userRoleMapper.deleteByUserRole(params);
+	}
+
+	@Override
+	public int insert(Role record, List<String> permissions) {
+		Date now = new Date();
+		if (record.getId() != null) {
+			List<RolePermission> rps = new ArrayList<>();
+			rolePermissionMapper.deleteByRid(record.getId());
+			for (String pid : permissions) {
+				rps.add(new RolePermission(record.getId(), pid));
+			}
+			if (!rps.isEmpty()) {
+				rolePermissionMapper.insertBatch(rps);
+			}
+			List<String> ids = userRoleMapper.findUserIdByRoleId(record.getId());
+			TokenManager.clearUserAuthByUserId(ids.toArray(new String[ids.size()]));
+		}
+		record.getId();
+		record.setCreater("管理员");		
+		record.setCreateTime(now);
+		return roleMapper.insert(record);
+	}
+	@Override
+	public List<RolePermissionBo> selectRolePList(String id) {
+		List<RolePermissionBo> list=roleMapper.selectRolePList(id);
+		return list;
+	}
+	@Override
+	public int addResources(String rid, String resources) {
+		List<String> list = Arrays.asList(resources.split(","));
+		RoleResources rr=new RoleResources();
+		if (roleResourcesMapper.checkRid(rid)>0) {
+			roleResourcesMapper.deleteResources(rid);
+		}
+		for (String s : list) {
+			rr.setId(UUID.randomUUID().toString());
+			rr.setRoleId(rid);
+			rr.setCreateTime(new Date());
+			try {
+			    rr.setResources(Integer.parseInt(s));
+			} catch (NumberFormatException e) {
+			    e.printStackTrace();
+			}
+			roleResourcesMapper.insert(rr);
+		}
+		return 1;
+	}
+	
+	@Override
+	public int updatedimission(String aid, String transferId) {
+		List<Integer> list=roleResourcesMapper.selectAdminRoleResources(aid);
+		if (list.size()<1||list.get(0)==null) {
+			throw new BusinessException(new Error("","用户角色资源不存在"));
+		}
+		for (Integer s : list) {
+			if (s==roleResources.YXKH.getCode()) {
+				roleResourcesMapper.updateLockRelease("0",aid,transferId);//将用户锁转给指定人
+				userBusinessMapper.updateDimissionTransfer(aid,transferId);
+				organizationContactBookMapper.updateDimissionTransfer(aid,transferId);
+				//所有客户转交给接受者
+				userMapper.updateDimissionTransfer(aid,transferId);
+			}
+			if (s==roleResources.QDYW.getCode()) {
+				tOrderNewMapper.updateSalesmanId(aid, transferId);
+				tOrderMidMapper.updateSalesmanId(aid, transferId);
+				patentNewMapper.updateAdmin(aid,transferId);
+				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
+			}
+			if (s==roleResources.XMRW.getCode()) {
+//				contractTaskLogMapper.updateDimissionTransfer(aid,transferId);
+				//获取被转角色判断修改对应任务角色
+				String qx=adminMapper.getPermission(transferId);
+				Integer type=-1;
+				if (qx.equals(AFTConstants.TECH)) type=0;
+				else if(qx.equals(AFTConstants.TECH_MANAGER))type=1;
+				if (type!=-1) {
+					tOrderTaskMapper.updateDimissionTransfer(aid,transferId,type);
+					tTaskLogMapper.updateDimissionTransfer(aid,transferId);
+					orderExamineMapper.updateDimissionTransfer(aid,transferId);
+				}
+			}
+			if (s!=roleResources.QDYW.getCode()) {
+				roleResourcesMapper.updateDimissionTransfer(s,aid,transferId);
+			}
+		}
+		return 1;
+	}
+	@Override
+	public List<RoleResources> ResourcesDetail(String rid) {
+		return roleResourcesMapper.selectByRid(rid);
+	}
+	
+}