TBlackRuleListSMapper.xml 5.04 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.zteits.bill.mapper.smapper.TBlackRuleListSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.bill.domain.TBlackRuleList">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="rule_no" jdbcType="VARCHAR" property="ruleNo" />
    <result column="car_num" jdbcType="VARCHAR" property="carNum" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="rule_state" jdbcType="INTEGER" property="ruleState" />
    <result column="auditor_status" jdbcType="INTEGER" property="auditorStatus" />
    <result column="rule_type" jdbcType="INTEGER" property="ruleType" />
    <result column="reason" jdbcType="VARCHAR" property="reason" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="eff_date" jdbcType="TIMESTAMP" property="effDate" />
    <result column="exp_date" jdbcType="TIMESTAMP" property="expDate" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_name" jdbcType="VARCHAR" property="createName" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modify_empid" jdbcType="VARCHAR" property="modifyEmpid" />
    <result column="modify_name" jdbcType="VARCHAR" property="modifyName" />
    <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, rule_no, car_num, address, card_no, phone, rule_state, auditor_status, rule_type,
    reason, remark, data_state, eff_date, exp_date, org_id, org_name, create_empid, create_name,
    create_date, modify_empid, modify_name, modify_date
  </sql>


  <select id="queryTBlackRuleList" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_black_rule_list
    where data_state = 1
      and org_id = #{orgId}
    <if test="carNum != null">
      and car_num = #{carNum}
    </if>

    <if test="ruleType != null">
      and rule_type = #{ruleType}
    </if>

    <if test="ruleState != null">
      and rule_state = #{ruleState}
    </if>
    
    <if test="carNums != null and carNums.size > 0">
    	and car_num in 
    	<foreach collection="carNums" item="carNum" open="(" close=")" separator="," index="index">
            #{carNum}
        </foreach>
	</if>

  </select>


</mapper>