<?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="cn.timer.api.dao.adminaccount.AdminAccountMapper"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="cn.timer.api.bean.adminaccount.AdminAccount" id="adminAccountMap"> <result property="id" column="id"/> <result property="realname" column="realname"/> <result property="tel" column="tel"/> <result property="types" column="types"/> <result property="createrid" column="createrid"/> <result property="createtime" column="createtime"/> <result property="department" column="department"/> <result property="groupid" column="groupid"/> <result property="statu" column="statu"/> <result property="mark" column="mark"/> <result property="account" column="account"/> <result property="pwd" column="pwd"/> <result property="avatar" column="avatar"/> <result property="category" column="category"/> <result property="lfc" column="lfc"/> <result property="prohibittime" column="prohibittime"/> <result property="ip" column="ip"/> <result property="logintime" column="logintime"/> <result property="updatetime" column="updatetime"/> </resultMap> <select id="queryObject" resultType="cn.timer.api.bean.adminaccount.AdminAccount"> select * from admin_account where id = #{value} </select> <select id="queryList" resultType="cn.timer.api.bean.adminaccount.AdminAccount"> select * from admin_account <where> <if test="realname != null and realname != ''">AND `realname` = #{realname}</if> <if test="tel != null and tel != ''">AND `tel` = #{tel}</if> <if test="types != null and types != ''">AND `types` = #{types}</if> <if test="createrid != null and createrid != ''">AND `createrid` = #{createrid}</if> <if test="createtime != null and createtime != ''">AND `createtime` = #{createtime}</if> <if test="department != null and department != ''">AND `department` = #{department}</if> <if test="groupid != null and groupid != ''">AND `groupid` = #{groupid}</if> <if test="statu != null and statu != ''">AND `statu` = #{statu}</if> <if test="mark != null and mark != ''">AND `mark` = #{mark}</if> <if test="account != null and account != ''">AND `account` = #{account}</if> <if test="pwd != null and pwd != ''">AND `pwd` = #{pwd}</if> <if test="avatar != null and avatar != ''">AND `avatar` = #{avatar}</if> <if test="category != null and category != ''">AND `category` = #{category}</if> <if test="lfc != null and lfc != ''">AND `lfc` = #{lfc}</if> <if test="prohibittime != null and prohibittime != ''">AND `prohibittime` = #{prohibittime}</if> <if test="ip != null and ip != ''">AND `ip` = #{ip}</if> <if test="logintime != null and logintime != ''">AND `logintime` = #{logintime}</if> <if test="updatetime != null and updatetime != ''">AND `updatetime` = #{updatetime}</if> </where> <choose> <when test="sidx != null and sidx.trim() != ''"> order by ${sidx} ${order} </when> <otherwise> order by id desc </otherwise> </choose> <if test="offset != null and limit != null"> limit #{offset}, #{limit} </if> </select> <select id="queryTotal" resultType="int"> select count(*) from admin_account <where> <if test="realname != null and realname != ''">AND `realname` = #{realname}</if> <if test="tel != null and tel != ''">AND `tel` = #{tel}</if> <if test="types != null and types != ''">AND `types` = #{types}</if> <if test="createrid != null and createrid != ''">AND `createrid` = #{createrid}</if> <if test="createtime != null and createtime != ''">AND `createtime` = #{createtime}</if> <if test="department != null and department != ''">AND `department` = #{department}</if> <if test="groupid != null and groupid != ''">AND `groupid` = #{groupid}</if> <if test="statu != null and statu != ''">AND `statu` = #{statu}</if> <if test="mark != null and mark != ''">AND `mark` = #{mark}</if> <if test="account != null and account != ''">AND `account` = #{account}</if> <if test="pwd != null and pwd != ''">AND `pwd` = #{pwd}</if> <if test="avatar != null and avatar != ''">AND `avatar` = #{avatar}</if> <if test="category != null and category != ''">AND `category` = #{category}</if> <if test="lfc != null and lfc != ''">AND `lfc` = #{lfc}</if> <if test="prohibittime != null and prohibittime != ''">AND `prohibittime` = #{prohibittime}</if> <if test="ip != null and ip != ''">AND `ip` = #{ip}</if> <if test="logintime != null and logintime != ''">AND `logintime` = #{logintime}</if> <if test="updatetime != null and updatetime != ''">AND `updatetime` = #{updatetime}</if> </where> </select> <insert id="save" parameterType="cn.timer.api.bean.adminaccount.AdminAccount" useGeneratedKeys="true" keyProperty="id"> insert into admin_account (`realname`, `tel`, `types`, `createrid`, `createtime`, `department`, `groupid`, `statu`, `mark`, `account`, `pwd`, `avatar`, `category`, `lfc`, `prohibittime`, `ip`, `logintime`, `updatetime`) values (#{realname}, #{tel}, #{types}, #{createrid}, #{createtime}, #{department}, #{groupid}, #{statu}, #{mark}, #{account}, #{pwd}, #{avatar}, #{category}, #{lfc}, #{prohibittime}, #{ip}, #{logintime}, #{updatetime}) </insert> <insert id="saveSelective" parameterType="cn.timer.api.bean.adminaccount.AdminAccount" useGeneratedKeys="true" keyProperty="id"> insert into admin_account ( <if test="realname != null">,`realname`</if> <if test="tel != null">,`tel`</if> <if test="types != null">,`types`</if> <if test="createrid != null">,`createrid`</if> <if test="createtime != null">,`createtime`</if> <if test="department != null">,`department`</if> <if test="groupid != null">,`groupid`</if> <if test="statu != null">,`statu`</if> <if test="mark != null">,`mark`</if> <if test="account != null">,`account`</if> <if test="pwd != null">,`pwd`</if> <if test="avatar != null">,`avatar`</if> <if test="category != null">,`category`</if> <if test="lfc != null">,`lfc`</if> <if test="prohibittime != null">,`prohibittime`</if> <if test="ip != null">,`ip`</if> <if test="logintime != null">,`logintime`</if> <if test="updatetime != null">,`updatetime`</if> ) values ( <if test="realname != null">,#{realname}</if> <if test="tel != null">,#{tel}</if> <if test="types != null">,#{types}</if> <if test="createrid != null">,#{createrid}</if> <if test="createtime != null">,#{createtime}</if> <if test="department != null">,#{department}</if> <if test="groupid != null">,#{groupid}</if> <if test="statu != null">,#{statu}</if> <if test="mark != null">,#{mark}</if> <if test="account != null">,#{account}</if> <if test="pwd != null">,#{pwd}</if> <if test="avatar != null">,#{avatar}</if> <if test="category != null">,#{category}</if> <if test="lfc != null">,#{lfc}</if> <if test="prohibittime != null">,#{prohibittime}</if> <if test="ip != null">,#{ip}</if> <if test="logintime != null">,#{logintime}</if> <if test="updatetime != null">,#{updatetime}</if> ) </insert> <insert id="saveList" parameterType="cn.timer.api.bean.adminaccount.AdminAccount" useGeneratedKeys="true" keyProperty="id"> insert into admin_account ( `realname`, `tel`, `types`, `createrid`, `createtime`, `department`, `groupid`, `statu`, `mark`, `account`, `pwd`, `avatar`, `category`, `lfc`, `prohibittime`, `ip`, `logintime`, `updatetime` ) values <foreach collection="list" item="item" index="index" separator=","> ( #{item.realname}, #{item.tel}, #{item.types}, #{item.createrid}, #{item.createtime}, #{item.department}, #{item.groupid}, #{item.statu}, #{item.mark}, #{item.account}, #{item.pwd}, #{item.avatar}, #{item.category}, #{item.lfc}, #{item.prohibittime}, #{item.ip}, #{item.logintime}, #{item.updatetime} ) </foreach> </insert> <update id="update" parameterType="cn.timer.api.bean.adminaccount.AdminAccount"> update admin_account <set> <if test="realname != null">`realname` = #{realname},</if> <if test="tel != null">`tel` = #{tel},</if> <if test="types != null">`types` = #{types},</if> <if test="createrid != null">`createrid` = #{createrid},</if> <if test="createtime != null">`createtime` = #{createtime},</if> <if test="department != null">`department` = #{department},</if> <if test="groupid != null">`groupid` = #{groupid},</if> <if test="statu != null">`statu` = #{statu},</if> <if test="mark != null">`mark` = #{mark},</if> <if test="account != null">`account` = #{account},</if> <if test="pwd != null">`pwd` = #{pwd},</if> <if test="avatar != null">`avatar` = #{avatar},</if> <if test="category != null">`category` = #{category},</if> <if test="lfc != null">`lfc` = #{lfc},</if> <if test="prohibittime != null">`prohibittime` = #{prohibittime},</if> <if test="ip != null">`ip` = #{ip},</if> <if test="logintime != null">`logintime` = #{logintime},</if> <if test="updatetime != null">`updatetime` = #{updatetime}</if> </set> where id = #{id} </update> <delete id="delete"> delete from admin_account where id = #{value} </delete> <delete id="deleteBatch"> delete from admin_account where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>