ept_user_infoMapper.xml 7.1 KB
<?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.eport.rest.dao.EptUserInfoDao">
    
	<sql id="EptUserInfoEntityColumns">
		a1.USER_ID AS "userId"
		,a1.ACCOUNT AS "account"
		,a1.PASSWORD AS "password"
		,a1.USER_NAME AS "userName"
		,a1.EMAIL AS "email"
		,a1.MOBILE AS "mobile"
		,a1.CREATE_ID AS "createId"
		,a1.STATUS AS "status"
		,a1.IS_ADMIN AS "isAdmin"
		,a1.CREATE_DATE AS "createDate"
		,a1.IS_DELETE AS "isDelete"
		,a1.UPDATE_ID AS "updateId"
		,a1.UPDATE_DATE AS "updateDate"
	</sql>
	
	<sql id="EptUserInfoEntityListColumns">
		a1.USER_ID AS "userId"
		,a1.ACCOUNT AS "account"
		,a1.USER_NAME AS "userName"
		,a1.EMAIL AS "email"
		,a1.MOBILE AS "mobile"
		,a1.STATUS AS "status"
		,a1.CREATE_DATE AS "createDate"
	</sql>
	
	
	
		<!--查询表中所有资料(所有字段) -->
		<select id="listAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserInfoEntity"
		>
		select  
			<include refid="EptUserInfoEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.STATUS) as parName
		FROM ept_user_info  a1
		WHERE 1=1
		<if test="account != null">
		and ACCOUNT like CONCAT(CONCAT('%',#{account}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="status != null">
		and STATUS = #{status}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--分页查询资料(所有字段) -->
		<select id="pageAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserInfoEntity"
		>
		select  
			<include refid="EptUserInfoEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.STATUS) as parName
		FROM ept_user_info  a1
		WHERE 1=1
		<if test="account != null">
		and ACCOUNT like CONCAT(CONCAT('%',#{account}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="status != null">
		and STATUS = #{status}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--查询表中所有资料(仅列表显示字段) -->
		<select id="list"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserInfoEntity"
		>
		select  
			<include refid="EptUserInfoEntityListColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.STATUS) as parName
		FROM ept_user_info  a1
		WHERE 1=1
		<if test="account != null">
		and ACCOUNT like CONCAT(CONCAT('%',#{account}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="status != null">
		and STATUS = #{status}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--分页查询资料(仅列表显示字段) -->
		<select id="page"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserInfoEntity"
		>
		select  
			<include refid="EptUserInfoEntityListColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.STATUS) as parName
		FROM ept_user_info  a1
		WHERE 1=1
		<if test="account != null">
		and ACCOUNT like CONCAT(CONCAT('%',#{account}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="status != null">
		and STATUS = #{status}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--根据主键查询数据 -->
		<select id="findByPK"  
		parameterType="Integer" 
		resultType="com.eport.rest.entity.EptUserInfoEntity"
		>
		select  
		<include refid="EptUserInfoEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.STATUS) as parName
		FROM ept_user_info  a1
		WHERE a1.USER_ID=#{par}
		 and IS_DELETE = 0
		</select>
		
	
		<!--新增数据 -->
		<insert id="insert"  
		parameterType="com.eport.rest.entity.EptUserInfoEntity" 
		>
		<selectKey resultType="Integer" order="AFTER" keyProperty="userId">
		<if test="userId != null ">
		select #{userId} from dual
		</if>
		<if test="userId == null ">
		SELECT LAST_INSERT_ID() AS userId
		</if>
		 </selectKey>
		insert  
		  INTO ept_user_info (
		ACCOUNT
		,PASSWORD
		,USER_NAME
		,EMAIL
		,MOBILE
		,CREATE_ID
		,STATUS
		,IS_ADMIN
		,CREATE_DATE
		,IS_DELETE
		,UPDATE_ID
		,UPDATE_DATE
		<if test="userId != null ">
		,USER_ID
		</if>
		  ) VALUES (
		#{account,jdbcType=VARCHAR}
		,#{password,jdbcType=VARCHAR}
		,#{userName,jdbcType=VARCHAR}
		,#{email,jdbcType=VARCHAR}
		,#{mobile,jdbcType=VARCHAR}
		,#{createId,jdbcType=INTEGER}
		,#{status,jdbcType=INTEGER}
		,#{isAdmin,jdbcType=INTEGER}
		,#{createDate,jdbcType=DATE}
		,#{isDelete,jdbcType=INTEGER}
		,#{updateId,jdbcType=INTEGER}
		,#{updateDate,jdbcType=DATE}
		<if test="userId != null ">
		,#{userId,jdbcType=INTEGER}
		</if>
		  )
		</insert>
		
	
		<!--更新数据 -->
		<update id="update"  
		parameterType="com.eport.rest.entity.EptUserInfoEntity" 
		>
		update  
		ept_user_info
		<set>
		<if test="account != null ">
		ACCOUNT = #{account},
		</if>
		<if test="password != null ">
		PASSWORD = #{password},
		</if>
		<if test="userName != null ">
		USER_NAME = #{userName},
		</if>
		<if test="email != null ">
		EMAIL = #{email},
		</if>
		<if test="mobile != null ">
		MOBILE = #{mobile},
		</if>
		<if test="status != null ">
		STATUS = #{status},
		</if>
		<if test="isAdmin != null ">
		IS_ADMIN = #{isAdmin},
		</if>
		<if test="isDelete != null ">
		IS_DELETE = #{isDelete},
		</if>
		<if test="updateId != null ">
		UPDATE_ID = #{updateId},
		</if>
		<if test="updateDate != null ">
		UPDATE_DATE = #{updateDate},
		</if>
		</set>
		WHERE USER_ID = #{userId}
		</update>
		
	
		<!--根据主键删除数据 -->
		<update id="delete"  
		parameterType="HashMap" 
		>
		update  
		ept_user_info set IS_DELETE = 1
		where USER_ID in (${par})
		</update>
		
	
		<!--获取表中最大的ID -->
		<select id="getTableMaxId"  
		parameterType="HashMap" 
		resultType="HashMap"
		>
		select MAX(${pkName}) as MAXID from ${tableName}
		</select>
		
	
		<!--根据帐号密码获取用户 -->
		<select id="findByAccountAndPassword"  
		parameterType="HashMap" 
		resultType="HashMap"
		>
		select a1.USER_ID AS "userId"
		,a1.ACCOUNT AS "account"
		,a1.USER_NAME AS "userName"
		,a1.EMAIL AS "email"
		,a1.MOBILE AS "mobile"
		,a1.STATUS AS "status"
		,a1.IS_ADMIN AS "isAdmin"
		,a1.CREATE_ID AS "createId"
		,a1.CREATE_DATE AS "createDate"
		,a1.UPDATE_ID AS "updateId"
		,a1.UPDATE_DATE AS "updateDate"
from ept_user_info  a1
where account=#{account} and a1.password=#{password}
		</select>
		
	
		<!--根据帐号查询用户 -->
		<select id="findByAccount"  
		parameterType="HashMap" 
		resultType="HashMap"
		>
		select a1.USER_ID AS "userId"
		,a1.ACCOUNT AS "account"
		,a1.PASSWORD AS "password"
		,a1.USER_NAME AS "userName"
		,a1.EMAIL AS "email"
		,a1.MOBILE AS "mobile"
		,a1.STATUS AS "status"
		,a1.IS_ADMIN AS "isAdmin"
		,a1.CREATE_ID AS "createId"
		,a1.CREATE_DATE AS "createDate"
		,a1.UPDATE_ID AS "updateId"
		,a1.UPDATE_DATE AS "updateDate"
from ept_user_info  a1
where account=#{account} and is_delete=0
		</select>
		
	
		<!--获取删除资料 -->
		<select id="getDelData"  
		parameterType="HashMap" 
		resultType="HashMap"
		>
		select ${selCol} from ${tableName} 
where ${idCol} in (${idVal})
		</select>
		
	
</mapper>