AccessCardMapper.xml 4.38 KB
Newer Older
葛齐林's avatar
葛齐林 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
<?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.devplatform.equipment.modules.accesscard.dao.AccessCardDao">
  <!-- Result Map -->
  <resultMap id="BaseResultMap" type="com.devplatform.equipment.modules.accesscard.bean.AccessCard">
    <result column="id" property="id"/>
    <result column="station_id" property="stationId"/>
    <result column="name" property="name"/>
    <result column="job_number" property="jobNumber"/>
    <result column="serial_number" property="serialNumber"/>
    <result column="department" property="department"/>
    <result column="post" property="post"/>
    <result column="group" property="group"/>
    <result column="phone_number" property="phoneNumber"/>
    <result column="status" property="status"/>
    <result column="create_time" property="createTime"/>
    <result column="activation" property="activation"/>
    <result column="expiration" property="expiration"/>
    <result column="byx1" property="byx1"/>
    <result column="byx2" property="byx2"/>
    <result column="byx3" property="byx3"/>
    <result column="sys_sign" property="sysSign"/>
    <result column="deleted" property="deleted"/>
  </resultMap>

  <!-- access_card table all fields -->
  <sql id="Base_Column_List">
		id,station_id,name,job_number,serial_number,department,post,group,phone_number,status,create_time,activation,expiration,byx1,byx2,byx3,sys_sign,deleted
	</sql>

  <!-- 公共查询条件 -->
  <sql id="Example_Where_Clause">
    where deleted=0
    <if test="id!=null and id!=''">and id = #{id}</if>
    <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
    <if test="name!=null and name!=''">and name = #{name}</if>
    <if test="jobNumber!=null and jobNumber!=''">and job_number = #{jobNumber}</if>
    <if test="serialNumber!=null and serialNumber!=''">and serial_number = #{serialNumber}</if>
    <if test="department!=null and department!=''">and department = #{department}</if>
    <if test="post!=null and post!=''">and post = #{post}</if>
    <if test="group!=null and group!=''">and group = #{group}</if>
    <if test="phoneNumber!=null and phoneNumber!=''">and phone_number = #{phoneNumber}</if>
    <if test="status!=null ">and status = #{status}</if>
    <if test="createTime!=null ">and create_time = #{createTime}</if>
    <if test="activation!=null ">and activation = #{activation}</if>
    <if test="expiration!=null ">and expiration = #{expiration}</if>
    <if test="byx1!=null and byx1!=''">and byx1 = #{byx1}</if>
    <if test="byx2!=null and byx2!=''">and byx2 = #{byx2}</if>
    <if test="byx3!=null and byx3!=''">and byx3 = #{byx3}</if>
    <if test="sysSign!=null and sysSign!=''">and sys_sign = #{sysSign}</if>
    <if test="deleted!=null ">and deleted = #{deleted}</if>
  </sql>

  <!--  同步发卡数据,确认连接成功数据库时,删除现有数据	-->
  <delete id="deleteAll">
		delete from access_card
	</delete>

  <select id="queryPageByCount" parameterType="com.devplatform.equipment.modules.accesscard.model.AccessCardModel"
    resultType="java.lang.Integer">
    select count(1) from access_card
    <include refid="queryPageByListClause"></include>
  </select>
  <select id="queryPageByList" parameterType="com.devplatform.equipment.modules.accesscard.model.AccessCardModel"
    resultType="com.devplatform.equipment.modules.accesscard.bean.AccessCard">
    SELECT * FROM access_card
    <include refid="queryPageByListClause"></include>
    <if test="pager.orderCondition != null and pager.orderCondition != ''">
      ${pager.orderCondition}
    </if>
    <if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
      ${pager.mysqlQueryCondition}
    </if>
  </select>

  <sql id="queryPageByListClause">
    <where>
      <if test="stationId!=null and stationId!=''">and station_id = #{stationId}</if>
      <if test="name!=null and name!=''">and INSTR(name, #{name}) or INSTR(serial_number, #{name})</if>
      <!--			<if test="name!=null and name!=''">and INSTR(name, #{name})</if>-->
      <!--			<if test="jobNumber!=null and jobNumber!=''">and INSTR(job_number, #{jobNumber})</if>-->
      <!--			<if test="serialNumber!=null and serialNumber!=''">and INSTR(serial_number, #{serialNumber})</if>-->
    </where>
  </sql>

</mapper>