Authored by linlong

update

  1 +package com.yoho.unions.dal;
  2 +
  3 +
  4 +
  5 +import com.yoho.unions.dal.model.Profile;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +public interface IProfileDAO {
  11 + int deleteByPrimaryKey(Integer pid);
  12 +
  13 + int insert(Profile record);
  14 +
  15 + int insertSelective(Profile record);
  16 +
  17 + Profile selectByPrimaryKey(Integer pid);
  18 +
  19 + int updateByPrimaryKeySelective(Profile record);
  20 +
  21 + int updateByPrimaryKey(Profile record);
  22 +
  23 + /**
  24 + * 根据用户id列表批量获取用户信息
  25 + */
  26 + List<Profile> batchSelectByPrimaryKey(@Param("list") List<Integer> pids);
  27 +
  28 +}
  1 +package com.yoho.unions.dal.model;
  2 +
  3 +/**
  4 + * Created by yoho on 2017/2/16.
  5 + */
  6 +public class Profile{
  7 +
  8 + private static final long serialVersionUID = 6342804270613557444L;
  9 +
  10 + /**
  11 + * 帐号记录ID
  12 + */
  13 + private Integer pid;
  14 +
  15 + /**
  16 + * 登录帐号
  17 + */
  18 + private String account;
  19 +
  20 + /**
  21 + * 真实姓名
  22 + */
  23 + private String truename;
  24 +
  25 + /**
  26 + * 员工号
  27 + */
  28 + private String staffCode;
  29 +
  30 + /**
  31 + * 邮件地址
  32 + */
  33 + private String email;
  34 +
  35 + /**
  36 + * 密码
  37 + */
  38 + private String password;
  39 +
  40 + /**
  41 + * 手机号
  42 + */
  43 + private String phone;
  44 +
  45 + /**
  46 + * 创建时间
  47 + */
  48 + private Integer createTime;
  49 +
  50 + /**
  51 + * 过期时间
  52 + */
  53 + private Integer expires;
  54 +
  55 + /**
  56 + * 登录时间
  57 + */
  58 + private Integer loginTime;
  59 +
  60 + /**
  61 + * 状态
  62 + */
  63 + private Byte status;
  64 +
  65 + /**
  66 + * 身份
  67 + * 1 => '品牌公司'
  68 + * 2 => '品牌经销商'
  69 + * 3 => '品牌代运营商'
  70 + * 4 => '有货品牌经理'
  71 + * 5 => '有货店铺运营'
  72 + * 6 => '有货商品运营'
  73 + * 7 => '有货平台运营'
  74 + */
  75 + private Byte identity;
  76 +
  77 + /**
  78 + * 认证站点
  79 + * 1 => '运营平台',
  80 + * 2 => '商家平台'
  81 + *
  82 + */
  83 + private String authSite;
  84 +
  85 + /**
  86 + * 角色ID
  87 + */
  88 + private Integer roleId;
  89 +
  90 + /**
  91 + * 部门ID
  92 + */
  93 + private Integer deptId;
  94 +
  95 + public Integer getRoleId() {
  96 + return roleId;
  97 + }
  98 +
  99 + public void setRoleId(Integer roleId) {
  100 + this.roleId = roleId;
  101 + }
  102 +
  103 + public Integer getPid() {
  104 + return pid;
  105 + }
  106 +
  107 + public void setPid(Integer pid) {
  108 + this.pid = pid;
  109 + }
  110 +
  111 + public String getAccount() {
  112 + return account;
  113 + }
  114 +
  115 + public void setAccount(String account) {
  116 + this.account = account == null ? null : account.trim();
  117 + }
  118 +
  119 + public String getTruename() {
  120 + return truename;
  121 + }
  122 +
  123 + public void setTruename(String truename) {
  124 + this.truename = truename == null ? null : truename.trim();
  125 + }
  126 +
  127 + public String getStaffCode() {
  128 + return staffCode;
  129 + }
  130 +
  131 + public void setStaffCode(String staffCode) {
  132 + this.staffCode = staffCode == null ? null : staffCode.trim();
  133 + }
  134 +
  135 + public String getEmail() {
  136 + return email;
  137 + }
  138 +
  139 + public void setEmail(String email) {
  140 + this.email = email == null ? null : email.trim();
  141 + }
  142 +
  143 + public String getPassword() {
  144 + return password;
  145 + }
  146 +
  147 + public void setPassword(String password) {
  148 + this.password = password == null ? null : password.trim();
  149 + }
  150 +
  151 + public String getPhone() {
  152 + return phone;
  153 + }
  154 +
  155 + public void setPhone(String phone) {
  156 + this.phone = phone == null ? null : phone.trim();
  157 + }
  158 +
  159 + public Integer getCreateTime() {
  160 + return createTime;
  161 + }
  162 +
  163 + public void setCreateTime(Integer createTime) {
  164 + this.createTime = createTime;
  165 + }
  166 +
  167 + public Integer getExpires() {
  168 + return expires;
  169 + }
  170 +
  171 + public void setExpires(Integer expires) {
  172 + this.expires = expires;
  173 + }
  174 +
  175 + public Integer getLoginTime() {
  176 + return loginTime;
  177 + }
  178 +
  179 + public void setLoginTime(Integer loginTime) {
  180 + this.loginTime = loginTime;
  181 + }
  182 +
  183 + public Byte getStatus() {
  184 + return status;
  185 + }
  186 +
  187 + public void setStatus(Byte status) {
  188 + this.status = status;
  189 + }
  190 +
  191 + public Byte getIdentity() {
  192 + return identity;
  193 + }
  194 +
  195 + public void setIdentity(Byte identity) {
  196 + this.identity = identity;
  197 + }
  198 +
  199 + public String getAuthSite() {
  200 + return authSite;
  201 + }
  202 +
  203 + public void setAuthSite(String authSite) {
  204 + this.authSite = authSite == null ? null : authSite.trim();
  205 + }
  206 +
  207 + public Integer getDeptId() {
  208 + return deptId;
  209 + }
  210 +
  211 + public void setDeptId(Integer deptId) {
  212 + this.deptId = deptId;
  213 + }
  214 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.unions.dal.IProfileDAO">
  4 + <resultMap id="BaseResultMap"
  5 + type="com.yoho.unions.dal.model.Profile">
  6 + <id column="pid" property="pid" jdbcType="INTEGER" />
  7 + <result column="account" property="account" jdbcType="VARCHAR" />
  8 + <result column="truename" property="truename" jdbcType="VARCHAR" />
  9 + <result column="staff_code" property="staffCode" jdbcType="VARCHAR" />
  10 + <result column="email" property="email" jdbcType="VARCHAR" />
  11 + <result column="password" property="password" jdbcType="VARCHAR" />
  12 + <result column="phone" property="phone" jdbcType="VARCHAR" />
  13 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  14 + <result column="expires" property="expires" jdbcType="INTEGER" />
  15 + <result column="login_time" property="loginTime" jdbcType="INTEGER" />
  16 + <result column="status" property="status" jdbcType="TINYINT" />
  17 + <result column="identity" property="identity" jdbcType="TINYINT" />
  18 + <result column="auth_site" property="authSite" jdbcType="VARCHAR" />
  19 + <result column="role_id" property="roleId" jdbcType="INTEGER" />
  20 + <result column="dept_id" property="deptId" jdbcType="INTEGER" />
  21 + </resultMap>
  22 + <sql id="Base_Column_List">
  23 + pid, account, truename, staff_code, email, password, phone, create_time,
  24 + expires,
  25 + login_time, status, identity, auth_site, role_id, dept_id
  26 + </sql>
  27 + <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  28 + parameterType="java.lang.Integer">
  29 + select
  30 + <include refid="Base_Column_List" />
  31 + from profile
  32 + where pid = #{pid,jdbcType=INTEGER}
  33 + </select>
  34 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  35 + delete from profile
  36 + where pid = #{pid,jdbcType=INTEGER}
  37 + </delete>
  38 + <insert id="insert" parameterType="com.yoho.unions.dal.model.Profile">
  39 + insert into profile (pid, account, truename,
  40 + staff_code, email, password,
  41 + phone, create_time, expires,
  42 + login_time, status, identity,
  43 + auth_site)
  44 + values (#{pid,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR},
  45 + #{truename,jdbcType=VARCHAR},
  46 + #{staffCode,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  47 + #{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER},
  48 + #{expires,jdbcType=INTEGER},
  49 + #{loginTime,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}, #{identity,jdbcType=TINYINT},
  50 + #{authSite,jdbcType=VARCHAR})
  51 + </insert>
  52 + <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.Profile">
  53 + insert into profile
  54 + <trim prefix="(" suffix=")" suffixOverrides=",">
  55 + <if test="pid != null">
  56 + pid,
  57 + </if>
  58 + <if test="account != null">
  59 + account,
  60 + </if>
  61 + <if test="truename != null">
  62 + truename,
  63 + </if>
  64 + <if test="staffCode != null">
  65 + staff_code,
  66 + </if>
  67 + <if test="email != null">
  68 + email,
  69 + </if>
  70 + <if test="password != null">
  71 + password,
  72 + </if>
  73 + <if test="phone != null">
  74 + phone,
  75 + </if>
  76 + <if test="createTime != null">
  77 + create_time,
  78 + </if>
  79 + <if test="expires != null">
  80 + expires,
  81 + </if>
  82 + <if test="loginTime != null">
  83 + login_time,
  84 + </if>
  85 + <if test="status != null">
  86 + status,
  87 + </if>
  88 + <if test="identity != null">
  89 + identity,
  90 + </if>
  91 + <if test="authSite != null">
  92 + auth_site,
  93 + </if>
  94 + </trim>
  95 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  96 + <if test="pid != null">
  97 + #{pid,jdbcType=INTEGER},
  98 + </if>
  99 + <if test="account != null">
  100 + #{account,jdbcType=VARCHAR},
  101 + </if>
  102 + <if test="truename != null">
  103 + #{truename,jdbcType=VARCHAR},
  104 + </if>
  105 + <if test="staffCode != null">
  106 + #{staffCode,jdbcType=VARCHAR},
  107 + </if>
  108 + <if test="email != null">
  109 + #{email,jdbcType=VARCHAR},
  110 + </if>
  111 + <if test="password != null">
  112 + #{password,jdbcType=VARCHAR},
  113 + </if>
  114 + <if test="phone != null">
  115 + #{phone,jdbcType=VARCHAR},
  116 + </if>
  117 + <if test="createTime != null">
  118 + #{createTime,jdbcType=INTEGER},
  119 + </if>
  120 + <if test="expires != null">
  121 + #{expires,jdbcType=INTEGER},
  122 + </if>
  123 + <if test="loginTime != null">
  124 + #{loginTime,jdbcType=INTEGER},
  125 + </if>
  126 + <if test="status != null">
  127 + #{status,jdbcType=TINYINT},
  128 + </if>
  129 + <if test="identity != null">
  130 + #{identity,jdbcType=TINYINT},
  131 + </if>
  132 + <if test="authSite != null">
  133 + #{authSite,jdbcType=VARCHAR},
  134 + </if>
  135 + </trim>
  136 + </insert>
  137 + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.Profile">
  138 + update profile
  139 + <set>
  140 + <if test="account != null">
  141 + account = #{account,jdbcType=VARCHAR},
  142 + </if>
  143 + <if test="truename != null">
  144 + truename = #{truename,jdbcType=VARCHAR},
  145 + </if>
  146 + <if test="staffCode != null">
  147 + staff_code = #{staffCode,jdbcType=VARCHAR},
  148 + </if>
  149 + <if test="email != null">
  150 + email = #{email,jdbcType=VARCHAR},
  151 + </if>
  152 + <if test="password != null">
  153 + password = #{password,jdbcType=VARCHAR},
  154 + </if>
  155 + <if test="phone != null">
  156 + phone = #{phone,jdbcType=VARCHAR},
  157 + </if>
  158 + <if test="createTime != null">
  159 + create_time = #{createTime,jdbcType=INTEGER},
  160 + </if>
  161 + <if test="expires != null">
  162 + expires = #{expires,jdbcType=INTEGER},
  163 + </if>
  164 + <if test="loginTime != null">
  165 + login_time = #{loginTime,jdbcType=INTEGER},
  166 + </if>
  167 + <if test="status != null">
  168 + status = #{status,jdbcType=TINYINT},
  169 + </if>
  170 + <if test="identity != null">
  171 + identity = #{identity,jdbcType=TINYINT},
  172 + </if>
  173 + <if test="authSite != null">
  174 + auth_site = #{authSite,jdbcType=VARCHAR},
  175 + </if>
  176 + </set>
  177 + where pid = #{pid,jdbcType=INTEGER}
  178 + </update>
  179 + <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.Profile">
  180 + update profile
  181 + set account = #{account,jdbcType=VARCHAR},
  182 + truename = #{truename,jdbcType=VARCHAR},
  183 + staff_code = #{staffCode,jdbcType=VARCHAR},
  184 + email = #{email,jdbcType=VARCHAR},
  185 + password = #{password,jdbcType=VARCHAR},
  186 + phone = #{phone,jdbcType=VARCHAR},
  187 + create_time = #{createTime,jdbcType=INTEGER},
  188 + expires = #{expires,jdbcType=INTEGER},
  189 + login_time = #{loginTime,jdbcType=INTEGER},
  190 + status = #{status,jdbcType=TINYINT},
  191 + identity = #{identity,jdbcType=TINYINT},
  192 + auth_site = #{authSite,jdbcType=VARCHAR}
  193 + where pid = #{pid,jdbcType=INTEGER}
  194 + </update>
  195 + <select id="batchSelectByPrimaryKey" resultMap="BaseResultMap"
  196 + parameterType="java.util.List" >
  197 + select
  198 + <include refid="Base_Column_List" />
  199 + from profile
  200 + where pid in
  201 + <foreach collection="list" item="item" open="(" close=")" separator=",">
  202 + #{item}
  203 + </foreach>
  204 + </select>
  205 +</mapper>