<?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.yonge.cooleshow.biz.dal.dao.SysUserTsignDao">
	
	<resultMap type="com.yonge.cooleshow.biz.dal.entity.SysUserTsign" id="SysUserTsign">
		<result column="user_id_" property="userId" />
		<result column="account_id_" property="accountId" />
		<result column="seal_data_" property="sealData" />
		<result column="name_" property="name" />
		<result column="card_no_" property="cardNo" />
		<result column="create_time_" property="createTime" />
	</resultMap>
	
	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="SysUserTsign" >
		SELECT * FROM sys_user_tsign WHERE user_id_ = #{userId} 
	</select>
	
	<!-- 全查询 -->
	<select id="findAll" resultMap="SysUserTsign">
		SELECT * FROM sys_user_tsign  ORDER BY user_id_
	</select>
	
	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.yonge.cooleshow.biz.dal.entity.SysUserTsign" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO sys_user_tsign (user_id_,account_id_,seal_data_,name_,card_no_,create_time_) VALUES(#{userId},#{accountId},#{sealData},#{name},#{cardNo},now())
	</insert>
	
	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.yonge.cooleshow.biz.dal.entity.SysUserTsign">
		UPDATE sys_user_tsign <set>
		<if test="userId != null">
		user_id_ = #{userId},
		</if>
		<if test="accountId != null">
		account_id_ = #{accountId},
		</if>
		<if test="sealData != null">
		seal_data_ = #{sealData},
		</if>
		<if test="name != null">
		name_ = #{name},
		</if>
		<if test="cardNo != null">
		card_no_ = #{cardNo},
		</if>
		<if test="createTime != null">
		create_time_ = #{createTime},
		</if>
		</set> WHERE user_id_ = #{userId}
	</update>
	
	<!-- 根据主键删除一条记录 -->
	<delete id="delete" >
		DELETE FROM sys_user_tsign WHERE user_id_ = #{userId} 
	</delete>
	
	<!-- 分页查询 -->
	<select id="queryPage" resultMap="SysUserTsign" parameterType="map">
		SELECT * FROM sys_user_tsign ORDER BY user_id_ <include refid="global.limit"/>
	</select>
	
	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM sys_user_tsign
	</select>
	
	<select id="queryByCardNo" resultMap="SysUserTsign">
		SELECT * FROM sys_user_tsign where card_no_ = #{cardNo}
	</select>
</mapper>
