Преглед изворни кода

新增角色资源表与新增、修改接口,新增离职人员资源转交

anderx пре 7 година
родитељ
комит
ad1dd5de7b

+ 1 - 1
GeneratorConfig.xml

@@ -10,6 +10,6 @@
     <javaModelGenerator targetPackage="com.goafanti.common.model" targetProject="AFT" />
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
-    <table schema="aft" tableName="user"/> 
+    <table schema="aft" tableName="role_resources"/> 
   </context>
 </generatorConfiguration>

+ 106 - 0
src/main/java/com/goafanti/common/dao/RoleResourcesMapper.java

@@ -0,0 +1,106 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.RoleResources;
+import com.goafanti.common.model.RoleResourcesExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface RoleResourcesMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    long countByExample(RoleResourcesExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int deleteByExample(RoleResourcesExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int deleteByPrimaryKey(String id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int insert(RoleResources record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int insertSelective(RoleResources record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    List<RoleResources> selectByExample(RoleResourcesExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    RoleResources selectByPrimaryKey(String id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int updateByExampleSelective(@Param("record") RoleResources record, @Param("example") RoleResourcesExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int updateByExample(@Param("record") RoleResources record, @Param("example") RoleResourcesExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int updateByPrimaryKeySelective(RoleResources record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    int updateByPrimaryKey(RoleResources record);
+
+	int deleteResources(String rid);
+
+	int checkRid(String rid);
+
+	List<Integer> selectAdminRoleResources(String aid);
+
+	int updateDimissionTransfer( @Param("type")Integer type,  @Param("aid")String aid,  @Param("transferId")String transferId);
+
+	int updateLockRelease(@Param("type")String type,  @Param("aid")String aid,@Param("transferId")String transferId);
+}

+ 55 - 0
src/main/java/com/goafanti/common/enums/roleResources.java

@@ -0,0 +1,55 @@
+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;
+	}
+
+}

+ 334 - 0
src/main/java/com/goafanti/common/mapper/RoleResourcesMapper.xml

@@ -0,0 +1,334 @@
+<?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.RoleResourcesMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.RoleResources">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="role_id" jdbcType="VARCHAR" property="roleId" />
+    <result column="resources" jdbcType="INTEGER" property="resources" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </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 Mon Jun 11 10:45:21 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 Mon Jun 11 10:45:21 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 Mon Jun 11 10:45:21 CST 2018.
+    -->
+    id, role_id, resources, create_time
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.RoleResourcesExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from role_resources
+    <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 Mon Jun 11 10:45:21 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from role_resources
+    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 Mon Jun 11 10:45:21 CST 2018.
+    -->
+    delete from role_resources
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.RoleResourcesExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    delete from role_resources
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.RoleResources">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    insert into role_resources (id, role_id, resources, 
+      create_time)
+    values (#{id,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR}, #{resources,jdbcType=INTEGER}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.RoleResources">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    insert into role_resources
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="roleId != null">
+        role_id,
+      </if>
+      <if test="resources != null">
+        resources,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="roleId != null">
+        #{roleId,jdbcType=VARCHAR},
+      </if>
+      <if test="resources != null">
+        #{resources,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.RoleResourcesExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    select count(*) from role_resources
+    <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 Mon Jun 11 10:45:21 CST 2018.
+    -->
+    update role_resources
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.roleId != null">
+        role_id = #{record.roleId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.resources != null">
+        resources = #{record.resources,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </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 Mon Jun 11 10:45:21 CST 2018.
+    -->
+    update role_resources
+    set id = #{record.id,jdbcType=VARCHAR},
+      role_id = #{record.roleId,jdbcType=VARCHAR},
+      resources = #{record.resources,jdbcType=INTEGER},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.RoleResources">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    update role_resources
+    <set>
+      <if test="roleId != null">
+        role_id = #{roleId,jdbcType=VARCHAR},
+      </if>
+      <if test="resources != null">
+        resources = #{resources,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.RoleResources">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jun 11 10:45:21 CST 2018.
+    -->
+    update role_resources
+    set role_id = #{roleId,jdbcType=VARCHAR},
+      resources = #{resources,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+   <delete id="deleteResources" parameterType="java.lang.String">
+    delete from role_resources
+    where role_id = #{rid,jdbcType=VARCHAR}
+  </delete>
+   
+   <select id="checkRid" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(1) from role_resources
+    where role_id = #{rid,jdbcType=VARCHAR}
+  </select>
+  <select id="selectAdminRoleResources" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select c.resources
+from admin a left join user_role b on a.id=b.uid 
+left join role_resources c on  b.rid=c.role_id
+where a.id= #{aid,jdbcType=VARCHAR}
+  </select>
+  <update id="updateDimissionTransfer" parameterType="java.lang.String">
+    <if test="type == 0">
+        update  user 
+	 set aid=#{transferId,jdbcType=VARCHAR}
+	 where aid = #{aid,jdbcType=VARCHAR}
+	and type = 1
+	and share_type = 0
+	and status != 1
+      </if>
+      <if test="type == 2">
+	update  user 
+		 set information_maintainer=#{transferId,jdbcType=VARCHAR}
+		 where information_maintainer = #{aid,jdbcType=VARCHAR}
+		and share_type = 0
+		and status != 1
+      </if>
+      <if test="type == 3">
+	update t_order
+		set salesman_id=#{transferId,jdbcType=VARCHAR}
+		WHERE order_type = 0
+		and salesman_id=#{aid,jdbcType=VARCHAR}
+      </if>
+      <if test="type == 4">
+	update contract_task
+		set task_allocator=#{aid,jdbcType=VARCHAR},
+			task_receiver=#{transferId,jdbcType=VARCHAR}
+		where task_receiver=#{aid,jdbcType=VARCHAR}	
+      </if>
+      <if test="type == 5">
+		update demand
+		set tech_broker_id=#{transferId,jdbcType=VARCHAR}
+		where deleted_sign=0
+		and tech_broker_id= #{aid,jdbcType=VARCHAR}
+      </if>
+      <if test="type == 6">
+		update achievement
+			set tech_broker_id=#{transferId,jdbcType=VARCHAR}
+		where deleted_sign=0
+		and tech_broker_id= #{aid,jdbcType=VARCHAR}
+      </if>
+  </update>
+  <update id="updateLockRelease" parameterType="java.lang.String">
+     update  user_lock_release 
+	 set aid=#{transferId,jdbcType=VARCHAR}
+	 where aid = #{aid,jdbcType=VARCHAR}
+	 and type=#{type,jdbcType=VARCHAR}
+	 and status=0
+</update>
+</mapper>

+ 137 - 0
src/main/java/com/goafanti/common/model/RoleResources.java

@@ -0,0 +1,137 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+public class RoleResources {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column role_resources.id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    private String id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column role_resources.role_id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    private String roleId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column role_resources.resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    private Integer resources;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column role_resources.create_time
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    private Date createTime;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column role_resources.id
+     *
+     * @return the value of role_resources.id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column role_resources.id
+     *
+     * @param id the value for role_resources.id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column role_resources.role_id
+     *
+     * @return the value of role_resources.role_id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public String getRoleId() {
+        return roleId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column role_resources.role_id
+     *
+     * @param roleId the value for role_resources.role_id
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setRoleId(String roleId) {
+        this.roleId = roleId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column role_resources.resources
+     *
+     * @return the value of role_resources.resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public Integer getResources() {
+        return resources;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column role_resources.resources
+     *
+     * @param resources the value for role_resources.resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setResources(Integer resources) {
+        this.resources = resources;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column role_resources.create_time
+     *
+     * @return the value of role_resources.create_time
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column role_resources.create_time
+     *
+     * @param createTime the value for role_resources.create_time
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 563 - 0
src/main/java/com/goafanti/common/model/RoleResourcesExample.java

@@ -0,0 +1,563 @@
+package com.goafanti.common.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class RoleResourcesExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public RoleResourcesExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(String value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(String value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(String value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(String value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(String value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(String value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLike(String value) {
+            addCriterion("id like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotLike(String value) {
+            addCriterion("id not like", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<String> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<String> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(String value1, String value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(String value1, String value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdIsNull() {
+            addCriterion("role_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdIsNotNull() {
+            addCriterion("role_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdEqualTo(String value) {
+            addCriterion("role_id =", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdNotEqualTo(String value) {
+            addCriterion("role_id <>", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdGreaterThan(String value) {
+            addCriterion("role_id >", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdGreaterThanOrEqualTo(String value) {
+            addCriterion("role_id >=", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdLessThan(String value) {
+            addCriterion("role_id <", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdLessThanOrEqualTo(String value) {
+            addCriterion("role_id <=", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdLike(String value) {
+            addCriterion("role_id like", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdNotLike(String value) {
+            addCriterion("role_id not like", value, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdIn(List<String> values) {
+            addCriterion("role_id in", values, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdNotIn(List<String> values) {
+            addCriterion("role_id not in", values, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdBetween(String value1, String value2) {
+            addCriterion("role_id between", value1, value2, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIdNotBetween(String value1, String value2) {
+            addCriterion("role_id not between", value1, value2, "roleId");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesIsNull() {
+            addCriterion("resources is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesIsNotNull() {
+            addCriterion("resources is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesEqualTo(Integer value) {
+            addCriterion("resources =", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesNotEqualTo(Integer value) {
+            addCriterion("resources <>", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesGreaterThan(Integer value) {
+            addCriterion("resources >", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesGreaterThanOrEqualTo(Integer value) {
+            addCriterion("resources >=", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesLessThan(Integer value) {
+            addCriterion("resources <", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesLessThanOrEqualTo(Integer value) {
+            addCriterion("resources <=", value, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesIn(List<Integer> values) {
+            addCriterion("resources in", values, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesNotIn(List<Integer> values) {
+            addCriterion("resources not in", values, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesBetween(Integer value1, Integer value2) {
+            addCriterion("resources between", value1, value2, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andResourcesNotBetween(Integer value1, Integer value2) {
+            addCriterion("resources not between", value1, value2, "resources");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table role_resources
+     *
+     * @mbg.generated do_not_delete_during_merge Mon Jun 11 10:45:21 CST 2018
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table role_resources
+     *
+     * @mbg.generated Mon Jun 11 10:45:21 CST 2018
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 48 - 1
src/main/java/com/goafanti/permission/controller/NewRoleApiController.java

@@ -17,11 +17,12 @@ import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.dao.RoleMapper;
 import com.goafanti.common.model.Role;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.permission.bo.RoleBo;
 import com.goafanti.permission.service.NewRoleService;
 
 @RestController
-@RequestMapping("api/admin")
+@RequestMapping("/open/api/admin")
 public class NewRoleApiController extends BaseApiController{
 	@Resource
 	private NewRoleService newRoleService;
@@ -127,4 +128,50 @@ public class NewRoleApiController extends BaseApiController{
 		res.setData(newRoleService.bindUser(rid, uid));
 		return res;
 	}
+	@RequestMapping(value = "/role/addResources", method = RequestMethod.POST)
+	public Result addResources(String rid, String resources) {
+		Result res = new Result();
+		if (StringUtils.isBlank(rid)) {
+			res.getError().add(buildError("","角色错误"));
+			return res;
+		}
+		if (StringUtils.isBlank(resources)) {
+			res.getError().add(buildError("","角色资源不能为空"));
+			return res;
+		}
+		if (newRoleService.checkRid(rid)) {
+			res.getError().add(buildError("","角色资源已存在"));
+			return res;
+		}
+		res.setData(newRoleService.addResources(rid, resources));
+		return res;
+	}
+	@RequestMapping(value = "/role/updateResources", method = RequestMethod.POST)
+	public Result updateResources(String rid, String resources) {
+		Result res = new Result();
+		if (StringUtils.isBlank(rid)) {
+			res.getError().add(buildError("","角色错误"));
+			return res;
+		}
+		if (StringUtils.isBlank(resources)) {
+			res.getError().add(buildError("","角色资源不能为空"));
+			return res;
+		}
+		res.setData(newRoleService.updateResources(rid, resources));
+		return res;
+	}
+	@RequestMapping(value = "/role/dimission", method = RequestMethod.POST)
+	public Result dimission(String aid ,String transferId) {
+		Result res = new Result();
+		if (StringUtils.isBlank(aid)) {
+			res.getError().add(buildError("","角色错误"));
+			return res;
+		}
+		if (StringUtils.isBlank(transferId)) {
+			res.getError().add(buildError("","转移角色错误"));
+			return res;
+		}
+		res.setData(newRoleService.updatedimission(aid,transferId));
+		return res;
+	}
 }

+ 8 - 0
src/main/java/com/goafanti/permission/service/NewRoleService.java

@@ -32,4 +32,12 @@ public interface NewRoleService {
 	int insert(Role record, List<String> permissions);
 	
 	List<RolePermissionBo> selectRolePList(String id);
+	
+	int addResources(String rid, String resources);
+
+	int updateResources(String rid, String resources);
+
+	boolean checkRid(String rid);
+
+	int updatedimission(String aid, String transferId);
 }

+ 57 - 0
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -2,21 +2,26 @@ 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.dao.RoleMapper;
 import com.goafanti.common.dao.RolePermissionMapper;
+import com.goafanti.common.dao.RoleResourcesMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.dao.UserRoleMapper;
+import com.goafanti.common.enums.roleResources;
 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;
@@ -35,6 +40,8 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 	UserRoleMapper			userRoleMapper;
 	@Autowired
 	RolePermissionMapper	rolePermissionMapper;
+	@Autowired
+	RoleResourcesMapper		roleResourcesMapper;
 	@Override
 	public Pagination<RoleBo> findRoles(RoleBo role, Integer pageNo, Integer pageSize) {
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -135,5 +142,55 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 		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();
+		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 updateResources(String rid, String resources) {
+		roleResourcesMapper.deleteResources(rid);
+		addResources(rid,resources);
+		return 1;
+	}
+	@Override
+	public boolean checkRid(String rid) {
+		if (roleResourcesMapper.checkRid(rid)>0) {
+			return true;
+		}
+		return false;
+	}
+	@Override
+	public int updatedimission(String aid, String transferId) {
+		List<Integer> list=roleResourcesMapper.selectAdminRoleResources(aid);
+		if (list.size()<1) {
+			return 0;
+		}
+		for (Integer s : list) {
+			System.out.println(s);
+			if (s==roleResources.YXKH.getCode()) {
+				roleResourcesMapper.updateLockRelease("0",aid,transferId);//将用户锁转给指定人
+			}
+			if (s==roleResources.QDYW.getCode()) {
+				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
+			}
+			if (s!=roleResources.QDYW.getCode()) {
+				roleResourcesMapper.updateDimissionTransfer(s,aid,transferId);
+			}
+		}
+		return 1;
+	}
 	
 }