SopTplGrantMapper.xml 1.63 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.SopTplGrantMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.process.modules.entity.SopTplGrant">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="grant_id" jdbcType="INTEGER" property="grantId" />
    <result column="group_id" jdbcType="VARCHAR" property="groupId" />
    <result column="group_name" jdbcType="VARCHAR" property="groupName" />
    <result column="tpl_id" jdbcType="VARCHAR" property="tplId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="grant_status" jdbcType="TINYINT" property="grantStatus" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    grant_id, group_id, group_name, tpl_id, create_time, update_time, grant_status
  </sql>

  <select id="countByTplId" resultType="java.lang.Integer">
    SELECT COUNT(DISTINCT group_id) FROM sop_tpl_grant WHERE tpl_id = #{tplId} AND grant_status != -1;
  </select>
  <select id="list" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from sop_tpl_grant
    where tpl_id = #{tplId} and grant_status != -1
  </select>

  <select id="countAllByTplId" resultType="java.lang.Integer">
    SELECT COUNT(0) FROM sop_tpl_grant WHERE tpl_id = #{tplId}
  </select>

  <delete id="del">
    update sop_tpl_grant set grant_status = -1 where grant_id = #{id}
  </delete>
</mapper>