| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.usoftchina.saas.account.mapper.RoleMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.account.po.Role">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="code" jdbcType="VARCHAR" property="code"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="description" jdbcType="VARCHAR" property="description"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="company_id" jdbcType="BIGINT" property="companyId"/>
- <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="updater_id" jdbcType="BIGINT" property="updaterId"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- </resultMap>
- <sql id="baseColumns">
- ac_role.id,ac_role.code,ac_role.name,ac_role.description,ac_role.type,ac_role.company_id,
- ac_role.creator_id,ac_role.create_time,ac_role.updater_id,ac_role.update_time
- </sql>
- <insert id="insert" parameterType="com.usoftchina.saas.account.po.Role"
- useGeneratedKeys="true" keyProperty="id">
- insert into ac_role(code,name,description,type,company_id,creator_id,create_time,updater_id,update_time)
- values (#{code,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT},
- #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Role"
- useGeneratedKeys="true" keyProperty="id">
- insert into ac_role
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="code != null">
- code,
- </if>
- <if test="name != null">
- name,
- </if>
- <if test="description != null">
- description,
- </if>
- <if test="type != null">
- type,
- </if>
- <if test="companyId != null">
- company_id,
- </if>
- <if test="creatorId != null">
- creator_id,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updaterId != null">
- updater_id,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="code != null">
- #{code,jdbcType=VARCHAR},
- </if>
- <if test="name != null">
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="description != null">
- #{description,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=INTEGER},
- </if>
- <if test="companyId != null">
- #{companyId,jdbcType=BIGINT},
- </if>
- <if test="creatorId != null">
- #{creatorId,jdbcType=BIGINT},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updaterId != null">
- #{updaterId,jdbcType=BIGINT},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.account.po.Role">
- update ac_role set code=#{code,jdbcType=VARCHAR},name=#{name,jdbcType=VARCHAR},
- description=#{description,jdbcType=VARCHAR},type=#{type,jdbcType=INTEGER},company_id=#{companyId,jdbcType=BIGINT},
- creator_id=#{creatorId,jdbcType=BIGINT},create_time=#{createTime,jdbcType=TIMESTAMP},
- updater_id=#{updaterId,jdbcType=BIGINT},update_time=#{updateTime,jdbcType=TIMESTAMP} where id=#{id,jdbcType=BIGINT}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from ac_role where id=#{id,jdbcType=BIGINT}
- </delete>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select <include refid="baseColumns"/> from ac_role where id=#{id,jdbcType=BIGINT}
- </select>
- <select id="selectByCompanyId" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select <include refid="baseColumns"/> from ac_role where company_id=#{companyId,jdbcType=BIGINT}
- </select>
- <select id="selectByAccountId" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select <include refid="baseColumns"/> from ac_role,ac_account_role
- where ac_role.id=ac_account_role.role_id and ac_account_role.account_id=#{accountId,jdbcType=BIGINT}
- </select>
- </mapper>
|