SysCodeDefSMapper.xml 1.91 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.sys.mapper.smapper.SysCodeDefSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysCodeDef">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="code_kind" jdbcType="VARCHAR" property="codeKind" />
    <result column="code_name" jdbcType="VARCHAR" property="codeName" />
    <result column="code_desc" jdbcType="VARCHAR" property="codeDesc" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="creator" jdbcType="BIGINT" property="creator" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modifier" jdbcType="BIGINT" property="modifier" />
    <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code_kind, code_name, code_desc, data_state, creator, create_date, modifier, 
    modify_date
  </sql>
  <!-- 查询字典表 -->
  <select id="querySysCodeDef" parameterType="com.zteits.sys.domain.SysCodeDef" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_code_def
    <where>
    	<choose>
    		<when test="dataState!=null">
    			and data_state = #{dataState,jdbcType=INTEGER}
    		</when>
    		<otherwise>
    			and data_state=1
    		</otherwise>
    	</choose>
    </where> 
  </select>
  <!-- 查询满足条件个数 -->
  <select id="queryCount" parameterType="com.zteits.sys.domain.SysCodeDef" resultType="long">
    select 
    count(1)
    from sys_code_def
    <where>
    	<choose>
    		<when test="dataState!=null">
    			and data_state = #{dataState,jdbcType=INTEGER}
    		</when>
    		<otherwise>
    			and data_state=1
    		</otherwise>
    	</choose>
    </where> 
  </select>
</mapper>