SysCodeValueSMapper.xml 3.9 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.SysCodeValueSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysCodeValue">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="code_kind" jdbcType="VARCHAR" property="codeKind" />
    <result column="code_value" jdbcType="VARCHAR" property="codeValue" />
    <result column="code_value_name" jdbcType="VARCHAR" property="codeValueName" />
    <result column="code_value_alias" jdbcType="VARCHAR" property="codeValueAlias" />
    <result column="code_value_desc" jdbcType="VARCHAR" property="codeValueDesc" />
    <result column="code_value_order" jdbcType="INTEGER" property="codeValueOrder" />
    <result column="code_value_icon" jdbcType="VARCHAR" property="codeValueIcon" />
    <result column="code_value_color" jdbcType="VARCHAR" property="codeValueColor" />
    <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" />
   <result column="parent_code_kind" jdbcType="BIGINT" property="parentCodeKind" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code_kind, code_value, code_value_name, code_value_alias, code_value_desc, 
    code_value_order, code_value_icon, code_value_color, data_state, creator, create_date, 
    modifier, modify_date,parent_code_kind
  </sql>
  <!-- 查询字典表 -->
  <select id="querySysCodeValue" parameterType="com.zteits.sys.domain.SysCodeValue" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_code_value
    <where>
    	<if test="codeKind !=null">
    		and code_kind = #{codeKind}
    	</if>
    	<choose>
    		<when test="dataState!=null">
    			and data_state = #{dataState,jdbcType=INTEGER}
    		</when>
    		<otherwise>
    			and data_state=1
    		</otherwise>
    	</choose>
    </where>
      ORDER BY code_value_order ASC
  </select>
  <!-- 查询满足条件个数 -->
  <select id="queryCount" parameterType="com.zteits.sys.domain.SysCodeValue" resultType="long">
    select 
    count(1)
    from sys_code_value
    <where>
    	<choose>
    		<when test="dataState!=null">
    			and data_state = #{dataState,jdbcType=INTEGER}
    		</when>
    		<otherwise>
    			and data_state=1
    		</otherwise>
    	</choose>
    </where> 
  </select>
  
  <!-- 分页查询数据字典信息 -->
  <select id="getDataDictionaryInfo" parameterType="com.zteits.clouds.api.dto.sys.param.DataDictionaryKindListReuest" 
    resultType="com.zteits.sys.domain.DataDicKindDetailDO">
    select
	    scv.id id,
	    scv.code_kind codeKind,
	    scd.code_name codeName,
	    scv.code_value codeValue,
	    scv.code_value_name codeValueName,
	    scv.code_value_alias codeValueAlias,
	    scv.code_value_desc codeValueDesc,
	    scv.code_value_order codeValueOrder,
	    scv.code_value_icon codeValueIcon,
	    scv.code_value_color codeValueColor,
	    scv.data_state dataState,
	    scv.creator creator,
	    scv.create_date createDate,
	    scv.modifier modifier,
	    scv.modify_date modifyDate 
    from sys_code_def scd right join sys_code_value scv on scd.code_kind=scv.code_kind
    <where>
    	scd.data_state = 1 and scv.data_state = 1
    	and scd.display = 1
    	<if test="codeKind !=null and codeKind !=''">
    		and scd.code_kind LIKE CONCAT(CONCAT('%', #{codeKind, jdbcType=VARCHAR}),'%')
    	</if>
    	<if test="codeName !=null and codeName !=''">
    		and scd.code_name LIKE CONCAT(CONCAT('%', #{codeName, jdbcType=VARCHAR}),'%')
    	</if>
    	order by scv.code_kind,scv.create_date
    </where>
  </select>
  
</mapper>