AnchorCheckedMapper.xml 5.4 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.bjivt.entity.showtime.AnchorChecked">
	<resultMap id="BaseResultMap" type="com.bjivt.entity.showtime.AnchorChecked">

		<id column="id" jdbcType="INTEGER" property="id" />
		<result column="user_id" jdbcType="INTEGER" property="userId" />
		<result column="user_name" jdbcType="VARCHAR" property="userName" />
		<result column="contact" jdbcType="VARCHAR" property="contact" />
		<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
		<result column="id_card" jdbcType="VARCHAR" property="idCard" />
		<result column="card_file_front" jdbcType="VARCHAR" property="cardFileFront" />
		<result column="hand_Card" jdbcType="VARCHAR" property="handCard" />
		<result column="card_file_back" jdbcType="VARCHAR" property="cardFileBack" />
		<result column="is_checked" jdbcType="INTEGER" property="isChecked" />
		<result column="reason" jdbcType="VARCHAR" property="reason" />
	</resultMap>

	<sql id="Base_Column_List">
		id,user_id,user_name,contact,create_time,id_card,card_file_front,hand_Card,card_file_back,is_checked,reason
	</sql>

  <update id="updateByIdSelective" parameterType="com.bjivt.entity.showtime.AnchorChecked">
    update tbl_anchor_checked
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="contact != null">
        contact = #{contact,jdbcType=VARCHAR},
      </if>
      <if test="idCard != null">
        id_card = #{idCard,jdbcType=INTEGER},
      </if>
      <if test="cardFileFront != null">
        card_file_front = #{cardFileFront,jdbcType=INTEGER},
      </if>
       <if test="handCard != null">
        hand_Card = #{handCard,jdbcType=VARCHAR},
      </if>
       <if test="cardFileBack != null">
        card_file_back = #{cardFileBack,jdbcType=VARCHAR},
      </if>
       <if test="isChecked != null">
        is_checked = #{isChecked,jdbcType=INTEGER},
      </if>
       <if test="reason != null">
        reason = #{reason,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>

	<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from tbl_anchor_checked
		where id = #{id,jdbcType=INTEGER}
	</select>
	
	<select id="selectByUserId" parameterType="java.lang.Integer"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from tbl_anchor_checked
		where user_id = #{userId,jdbcType=INTEGER}
	</select>

	<select id="selectByUserName" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from tbl_anchor_checked
		where user_name = #{userName,jdbcType=VARCHAR}
	</select>
	<select id="selectByStatus" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from tbl_anchor_checked
		where is_checked =
		#{isChecked,jdbcType=INTEGER}
	</select>

	<select id="getCountBy" resultType="java.lang.Integer"
		parameterType="com.bjivt.entity.showtime.AnchorChecked">
		SELECT
		count(1)
		FROM
		tbl_anchor_checked
		<trim prefix="where" prefixOverrides="and|or">
			<if test="userId != null and userId != ''">
				and tbl_anchor_checked.user_id = #{userId}
			</if>
		</trim>
	</select>


	<select id="findListByMap" resultMap="BaseResultMap"
		parameterType="java.util.Map">
		SELECT
		<include refid="Base_Column_List" />
		FROM
		tbl_anchor_checked
		<trim prefix="where" prefixOverrides="and|or">
			<if test="AnchorChecked.userId != null and AnchorChecked.userId != 0">
				and tbl_anchor_checked.user_id = #{AnchorChecked.userId}
			</if>
			<if test="AnchorChecked.contact != null and AnchorChecked.contact !=''">
				and contact = #{AnchorChecked.contact}
			</if>
			<if test="AnchorChecked.isChecked != null and AnchorChecked.isChecked !=''">
				and is_checked = #{AnchorChecked.isChecked}
			</if>
		</trim>
		order by create_time DESC
		<if test="page != null and page !=''">
			<if test="page.from != null and page.size != null">
				limit #{page.from},#{page.size}
			</if>
		</if>
	</select>
	<select id="findAnchorChecked" resultType="com.bjivt.entity.showtime.AnchorChecked"
		parameterType="com.bjivt.entity.showtime.AnchorChecked">
		select * from tbl_anchor_checked
		<trim prefix="where" prefixOverrides="and|or">
			<if test="userId != null and userId !=''">
				and userId like '%${userId}%'
			</if>
			<if test="userName != null and userName !=''">
				and userName like '%${userName}%'
			</if>
			<if test="contact != null and contact !=''">
				and contact like '%${contact}%'
			</if>
			<if test="idCard != null and idCard !=''">
				and idCard like '%${idCard}%'
			</if>
			<if test="cardFileFront != null and cardFileFront !=''">
				and cardFileFront like '%${cardFileFront}%'
			</if>
			<if test="handCard != null and handCard !=''">
				and handCard like '%${handCard}%'
			</if>
			<if test="isChecked != null and isChecked !=''">
				and is_checked = #{isChecked}
			</if>
			<if test="cardFileBack != null and cardFileBack !=''">
				and cardFileBack like '%${cardFileBack}%'
			</if>
			<if test="reason != null and reason !=''">
				and reason like '%${reason}%'
			</if>
		</trim>
		order by ${orderBy}
		<if test="startRow != null and sizeRow !=''">
			limit #{startRow},#{sizeRow}
		</if>
	</select>
</mapper>