SopTplMapper.xml 2.83 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.process.modules.mapper.SopTplMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.process.modules.entity.SopTpl">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="tpl_id" jdbcType="VARCHAR" property="tplId" />
    <result column="tpl_name" jdbcType="VARCHAR" property="tplName" />
    <result column="tpl_cron" jdbcType="VARCHAR" property="tplCron" />
    <result column="tpl_remark" jdbcType="VARCHAR" property="tplRemark" />
    <result column="tpl_status" jdbcType="TINYINT" property="tplStatus" />
    <result column="tpl_param_def" jdbcType="VARCHAR" property="tplParamDef" />
    <result column="tpl_result_def" jdbcType="VARCHAR" property="tplResultDef" />
    <result column="tpl_singleton" jdbcType="TINYINT" property="tplSingleton" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <resultMap id="BaseResultDTOMap" extends="BaseResultMap" type="cn.com.glsx.process.modules.model.SopTplDTO">
    <association column="tpl_id" jdbcType="INTEGER" property="grantCount" select="cn.com.glsx.process.modules.mapper.SopTplGrantMapper.countByTplId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    tpl_id, tpl_name, tpl_cron, tpl_remark, tpl_status, tpl_param_def, tpl_result_def, 
    tpl_singleton, create_time, update_time
  </sql>
    <insert id="insertCustom">
      insert into sop_tpl(
        tpl_id, tpl_name, tpl_cron, tpl_remark, tpl_status, tpl_param_def, tpl_result_def, tpl_singleton
      ) values (
        #{tplId}, #{tplName}, #{tplCron}, #{tplRemark}, #{tplStatus}, #{tplParamDef}, #{tplResultDef}, #{tplSingleton}
      )
    </insert>
  <update id="updateByPrimaryKeyCustom">
    update sop_tpl set
      tpl_name = #{tplName},
      tpl_cron = #{tplCron},
      tpl_remark = #{tplRemark},
      tpl_status = #{tplStatus},
      tpl_param_def = #{tplParamDef},
      tpl_result_def = #{tplResultDef},
      tpl_singleton = #{tplSingleton}
    where tpl_id = #{tplId}
  </update>

  <select id="page" resultMap="BaseResultDTOMap">
    select
        <include refid="Base_Column_List" />
    from sop_tpl
    <where>
      <if test="tplId != null and tplId !=''">
        and tpl_id = #{tplId}
      </if>
      <if test="tplName != null and tplName !=''">
        and tpl_name = #{tplName}
      </if>
      <if test="tplStatus != null">
        and tpl_status = #{tplStatus}
      </if>
    </where>
    order by update_time desc
  </select>

  <select id="getById" resultMap="BaseResultDTOMap">
    select <include refid="Base_Column_List" /> from sop_tpl where tpl_id = #{tplId}
  </select>

</mapper>