|  |  | <?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.tianbo.warehouse.dao.ROLEMapper"> | 
|  |  | <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.ROLE"> | 
|  |  | <id column="role_id" jdbcType="INTEGER" property="roleId" /> | 
|  |  | <result column="role_name" jdbcType="VARCHAR" property="roleName" /> | 
|  |  | <result column="role_sign" jdbcType="VARCHAR" property="roleSign" /> | 
|  |  | <result column="description" jdbcType="VARCHAR" property="description" /> | 
|  |  | <collection property="permissions" ofType="PERMISSION" javaType="java.util.ArrayList" select="com.tianbo.warehouse.dao.PERMISSIONMapper.getRolePermisson" column="role_id"></collection> | 
|  |  | <?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.tianbo.warehouse.dao.ROLEMapper" > | 
|  |  | <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.ROLE" > | 
|  |  | <id column="role_id" property="roleId" jdbcType="INTEGER" /> | 
|  |  | <result column="role_name" property="roleName" jdbcType="VARCHAR" /> | 
|  |  | <result column="role_sign" property="roleSign" jdbcType="VARCHAR" /> | 
|  |  | <result column="description" property="description" jdbcType="VARCHAR" /> | 
|  |  | <result column="department_id" property="departmentId" jdbcType="VARCHAR" /> | 
|  |  | </resultMap> | 
|  |  | <sql id="Base_Column_List"> | 
|  |  | role_id, role_name, role_sign, description | 
|  |  | <sql id="Base_Column_List" > | 
|  |  | role_id, role_name, role_sign, description, department_id | 
|  |  | </sql> | 
|  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 
|  |  | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | 
|  |  | select | 
|  |  | <include refid="Base_Column_List" /> | 
|  |  | from role | 
|  |  | where role_id = #{roleId,jdbcType=INTEGER} | 
|  |  | </select> | 
|  |  |  | 
|  |  | <select id="findAll" resultMap="BaseResultMap" > | 
|  |  | SELECT | 
|  |  | <include refid="Base_Column_List" /> | 
| ... | ... | @@ -31,68 +32,78 @@ | 
|  |  | LEFT JOIN role R ON  R.role_id= UR.role_id | 
|  |  | where U.user_id = #{userId,jdbcType=INTEGER} | 
|  |  | </select> | 
|  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 
|  |  |  | 
|  |  | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 
|  |  | delete from role | 
|  |  | where role_id = #{roleId,jdbcType=INTEGER} | 
|  |  | </delete> | 
|  |  | <insert id="insert" parameterType="com.tianbo.warehouse.model.ROLE"> | 
|  |  | <insert id="insert" parameterType="com.tianbo.warehouse.model.ROLE" > | 
|  |  | insert into role (role_id, role_name, role_sign, | 
|  |  | description) | 
|  |  | description, department_id) | 
|  |  | values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{roleSign,jdbcType=VARCHAR}, | 
|  |  | #{description,jdbcType=VARCHAR}) | 
|  |  | #{description,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}) | 
|  |  | </insert> | 
|  |  |  | 
|  |  | <insert id="insertSelective" parameterType="Integer"> | 
|  |  | <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.ROLE" > | 
|  |  | insert into role | 
|  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|  |  | <if test="roleId != null"> | 
|  |  | <trim prefix="(" suffix=")" suffixOverrides="," > | 
|  |  | <if test="roleId != null" > | 
|  |  | role_id, | 
|  |  | </if> | 
|  |  | <if test="roleName != null"> | 
|  |  | <if test="roleName != null" > | 
|  |  | role_name, | 
|  |  | </if> | 
|  |  | <if test="roleSign != null"> | 
|  |  | <if test="roleSign != null" > | 
|  |  | role_sign, | 
|  |  | </if> | 
|  |  | <if test="description != null"> | 
|  |  | <if test="description != null" > | 
|  |  | description, | 
|  |  | </if> | 
|  |  | <if test="departmentId != null" > | 
|  |  | department_id, | 
|  |  | </if> | 
|  |  | </trim> | 
|  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|  |  | <if test="roleId != null"> | 
|  |  | <trim prefix="values (" suffix=")" suffixOverrides="," > | 
|  |  | <if test="roleId != null" > | 
|  |  | #{roleId,jdbcType=INTEGER}, | 
|  |  | </if> | 
|  |  | <if test="roleName != null"> | 
|  |  | <if test="roleName != null" > | 
|  |  | #{roleName,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="roleSign != null"> | 
|  |  | <if test="roleSign != null" > | 
|  |  | #{roleSign,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="description != null"> | 
|  |  | <if test="description != null" > | 
|  |  | #{description,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="departmentId != null" > | 
|  |  | #{departmentId,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | </trim> | 
|  |  | </insert> | 
|  |  | <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.ROLE"> | 
|  |  | <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.ROLE" > | 
|  |  | update role | 
|  |  | <set> | 
|  |  | <if test="roleName != null"> | 
|  |  | <set > | 
|  |  | <if test="roleName != null" > | 
|  |  | role_name = #{roleName,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="roleSign != null"> | 
|  |  | <if test="roleSign != null" > | 
|  |  | role_sign = #{roleSign,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="description != null"> | 
|  |  | <if test="description != null" > | 
|  |  | description = #{description,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | <if test="departmentId != null" > | 
|  |  | department_id = #{departmentId,jdbcType=VARCHAR}, | 
|  |  | </if> | 
|  |  | </set> | 
|  |  | where role_id = #{roleId,jdbcType=INTEGER} | 
|  |  | </update> | 
|  |  | <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.ROLE"> | 
|  |  | <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.ROLE" > | 
|  |  | update role | 
|  |  | set role_name = #{roleName,jdbcType=VARCHAR}, | 
|  |  | role_sign = #{roleSign,jdbcType=VARCHAR}, | 
|  |  | description = #{description,jdbcType=VARCHAR} | 
|  |  | description = #{description,jdbcType=VARCHAR}, | 
|  |  | department_id = #{departmentId,jdbcType=VARCHAR} | 
|  |  | where role_id = #{roleId,jdbcType=INTEGER} | 
|  |  | </update> | 
|  |  | </mapper> | 
|  |  | \ No newline at end of file | 
... | ... |  |