SopTaskConfigMapper.xml 2.09 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.dj.mindworkplate.mapper.SopTaskConfigMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.sop.SopTaskConfig" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="open_flag" property="openFlag" jdbcType="TINYINT" />
    <result column="store_penetration_weekly" property="storePenetrationWeekly" jdbcType="DECIMAL" />
    <result column="store_penetration_monthly" property="storePenetrationMonthly" jdbcType="DECIMAL" />
    <result column="inspection_score" property="inspectionScore" jdbcType="DECIMAL" />
    <result column="study_day" property="studyDay" jdbcType="INTEGER" />
    <result column="finish_time" property="finishTime" jdbcType="INTEGER" />
    <result column="punish_type" property="punishType" jdbcType="TINYINT" />
    <result column="effective_type" property="effectiveType" jdbcType="TINYINT" />
    <result column="effective_time" property="effectiveTime" jdbcType="TIMESTAMP" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
    <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, open_flag, store_penetration_weekly, store_penetration_monthly, inspection_score, study_day,
    finish_time, punish_type, effective_type, effective_time, created_by, created_date, 
    deleted_flag
  </sql>

  <select id="getCurrentConfig" resultMap="BaseResultMap">
    select * from sop_task_config
    where deleted_flag = "N" and effective_time &lt;= now()
    order by effective_time desc, created_date desc limit 1
  </select>

  <select id="getLatestConfig" resultMap="BaseResultMap">
    select * from sop_task_config
    where deleted_flag = "N"
    order by created_date desc limit 1
  </select>
</mapper>