ModelMapper.xml 3.03 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="cn.com.glsx.cdp.modules.mapper.ModelMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.Model">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="model_name" jdbcType="VARCHAR" property="modelName" />
    <result column="event_flag" jdbcType="INTEGER" property="eventFlag" />
    <result column="oneid_belong" jdbcType="TINYINT" property="oneidBelong" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  </resultMap>
  <resultMap id="DTOResultMap" type="cn.com.glsx.cdp.modules.model.ModelDTO" extends="BaseResultMap">
    <collection property="modelFieldMappings" ofType="cn.com.glsx.cdp.modules.model.ModelFieldMappingDTO">
      <id column="cmfm_id" jdbcType="INTEGER" property="id" />
      <result column="model_name" jdbcType="VARCHAR" property="modelName" />
      <result column="field_index" jdbcType="INTEGER" property="fieldIndex" />
      <result column="union_rule" jdbcType="INTEGER" property="unionRule" />
      <result column="model_flag" jdbcType="BIT" property="modelFlag" />
      <result column="oneid_flag" jdbcType="BIT" property="oneidFlag" />
      <result column="expand_flag" jdbcType="BIT" property="expandFlag" />
      <result column="unique_flag" jdbcType="BIT" property="uniqueFlag" />
      <result column="field_name" jdbcType="VARCHAR" property="fieldName" />
    </collection>
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    id, model_name, event_flag, oneid_belong, remark, created_time, created_by, updated_time, 
    updated_by, del_flag
  </sql>
  <insert id="insertTable">
    ${sql}
  </insert>
  <update id="updateTable">
    ${sql}
  </update>
  <select id="list" parameterType="cn.com.glsx.cdp.modules.model.ModelDTO" resultMap="DTOResultMap">
      select cm.id, cm.model_name, cm.event_flag, cm.oneid_belong, cm.remark, cm.created_time,
             cm.created_by, cm.updated_time, cm.updated_by, cm.del_flag,
             cmfm.id as cmfm_id, cmfm.field_index, cmfm.union_rule, cmfm.model_flag, cmfm.oneid_flag, cmfm.expand_flag, cmfm.unique_flag,
             cf.field_name
      from cdp_model cm
      left join cdp_model_field_mapping cmfm on cm.model_name = cmfm.model_name and cmfm.del_flag = 0
      left join cdp_field cf on cmfm.field_index = cf.field_index and cf.del_flag = 0
      <where>
        cm.del_flag = 0
      </where>
    </select>
  <select id="listMap" resultType="java.util.Map">
    ${sql}
  </select>
</mapper>