郑永安
2023-06-19 2fcd97552d16718cc7997629fd637a73a5a4483f
src/main/java/com/gk/firework/Mapper/mybatis/HiddenDangerCheckContentMapper.xml
对比新文件
@@ -0,0 +1,256 @@
<?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.gk.firework.Mapper.HiddenDangerCheckContentMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.HiddenDangerCheckContent" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="checkcontent" property="checkcontent" jdbcType="VARCHAR" />
    <result column="createtime" property="createtime" jdbcType="TIMESTAMP" />
    <result column="createby" property="createby" jdbcType="VARCHAR" />
    <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
    <result column="updateby" property="updateby" jdbcType="VARCHAR" />
    <result column="validflag" property="validflag" jdbcType="BIT" />
    <result column="belongid" property="belongid" jdbcType="BIGINT" />
    <result column="belongname" property="belongname" jdbcType="VARCHAR" />
    <collection property="criteriaList"
                ofType="com.gk.firework.Domain.HiddenDangerCheckCriteria" select="get-criteria"
                column="id">
    </collection>
  </resultMap>
  <resultMap id="criteria" type="com.gk.firework.Domain.HiddenDangerCheckCriteria" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="checkcriteria" property="checkcriteria" jdbcType="VARCHAR" />
    <result column="basis" property="basis" jdbcType="VARCHAR" />
    <result column="belongid" property="belongid" jdbcType="VARCHAR" />
    <result column="validflag" property="validflag" jdbcType="BIT" />
    <collection property="typeList"
                ofType="com.gk.firework.Domain.HiddenDangerCheckType" select="get-type"
                column="id">
    </collection>
  </resultMap>
  <resultMap id="type" type="com.gk.firework.Domain.HiddenDangerCheckType" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="checktype" property="checktype" jdbcType="VARCHAR" />
    <result column="belongid" property="belongid" jdbcType="VARCHAR" />
    <result column="validflag" property="validflag" jdbcType="BIT" />
    <collection property="checkResultList"
                ofType="com.gk.firework.Domain.HiddenDangerCheckResult" select="get-result"
                column="id">
    </collection>
  </resultMap>
  <select id="get-criteria"  resultMap="criteria">
    select
    id ,
    checkcriteria,
    basis,
    belongid
    from hiddendangercheckcriteria
    where belongid = #{id}
    and validflag = 1
  </select>
  <select id="get-type"  resultMap="type">
    select
    id ,
    checktype,
    belongid
    from hiddendangerchecktype
    where belongid = #{id}
    and validflag = 1
  </select>
  <select id="get-result"  resultType="com.gk.firework.Domain.HiddenDangerCheckResult">
    select
    id ,
    checkresult,
    isqualified,
    belongid
    from hiddendangercheckresult
    where belongid = #{id}
    and validflag = 1
  </select>
  <select id="selectContent" parameterType="java.util.Map" resultMap="BaseResultMap">
    select
    id,
    checkcontent,
    belongid
    from hiddendangercheckcontent
    where belongid= #{menu}
    and validflag = 1
  </select>
  <select id="selectRow" parameterType="java.util.Map" resultType="com.gk.firework.Domain.Vo.HiddenDangerTableRow">
    select
    hdcct.checkcontent checkcontent,
    hdcct.belongid parentmenuid,
    hdcca.checkcriteria ,
    hdct.id  checktypeid,
    hdct.checktype ,
    hdcca.basis ,
    hdcr1.checkresult checkresult1,
    hdcr2.checkresult checkresult0,
    hdcr1.id result1,
    hdcr2.id result0
    from hiddendangercheckcontent hdcct
    left join hiddendangercheckcriteria hdcca on hdcca.belongid = hdcct.id and hdcct.validflag = 1
    left join hiddendangerchecktype hdct on  hdct.belongid = hdcca.id and hdcca.validflag = 1
    left join hiddendangercheckresult hdcr1 on hdcr1.belongid =  hdct.id and hdcr1.isqualified = 1 and hdcr1.validflag = 1
    left join hiddendangercheckresult hdcr2 on hdcr2.belongid =  hdct.id and hdcr2.isqualified = 0 and hdcr2.validflag = 1
    <if test="level == 1 " >
    left join  hiddendangermenu hdm on hdm.id = hdcct.belongid
    </if>
    where hdcct.validflag = 1
    <if test="level != null and level != '' and menu != null and menu != ''">
      <if test="level == 2 ">
        and hdcct.belongid = #{menu}
      </if>
      <if test="level == 1">
        and hdm.parentid = #{menu}
      </if>
    </if>
  </select>
  <sql id="Base_Column_List" >
    <!--          -->
    id, checkcontent, createtime, createby, updatetime, updateby, validflag, belongid,
    belongname
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from hiddendangercheckcontent
    where id = #{id,jdbcType=BIGINT}
  </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from hiddendangercheckcontent
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.gk.firework.Domain.HiddenDangerCheckContent" >
    <!--          -->
    insert into hiddendangercheckcontent (id, checkcontent, createtime,
      createby, updatetime, updateby,
      validflag, belongid, belongname
      )
    values (#{id,jdbcType=BIGINT}, #{checkcontent,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP},
      #{createby,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, #{updateby,jdbcType=VARCHAR},
      #{validflag,jdbcType=BIT}, #{belongid,jdbcType=BIGINT}, #{belongname,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.gk.firework.Domain.HiddenDangerCheckContent" >
    <!--          -->
    insert into hiddendangercheckcontent
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="checkcontent != null" >
        checkcontent,
      </if>
      <if test="createtime != null" >
        createtime,
      </if>
      <if test="createby != null" >
        createby,
      </if>
      <if test="updatetime != null" >
        updatetime,
      </if>
      <if test="updateby != null" >
        updateby,
      </if>
      <if test="validflag != null" >
        validflag,
      </if>
      <if test="belongid != null" >
        belongid,
      </if>
      <if test="belongname != null" >
        belongname,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="checkcontent != null" >
        #{checkcontent,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null" >
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="createby != null" >
        #{createby,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateby != null" >
        #{updateby,jdbcType=VARCHAR},
      </if>
      <if test="validflag != null" >
        #{validflag,jdbcType=BIT},
      </if>
      <if test="belongid != null" >
        #{belongid,jdbcType=BIGINT},
      </if>
      <if test="belongname != null" >
        #{belongname,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.HiddenDangerCheckContent" >
    <!--          -->
    update hiddendangercheckcontent
    <set >
      <if test="checkcontent != null" >
        checkcontent = #{checkcontent,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null" >
        createtime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="createby != null" >
        createby = #{createby,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        updatetime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateby != null" >
        updateby = #{updateby,jdbcType=VARCHAR},
      </if>
      <if test="validflag != null" >
        validflag = #{validflag,jdbcType=BIT},
      </if>
      <if test="belongid != null" >
        belongid = #{belongid,jdbcType=BIGINT},
      </if>
      <if test="belongname != null" >
        belongname = #{belongname,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.HiddenDangerCheckContent" >
    <!--          -->
    update hiddendangercheckcontent
    set checkcontent = #{checkcontent,jdbcType=VARCHAR},
      createtime = #{createtime,jdbcType=TIMESTAMP},
      createby = #{createby,jdbcType=VARCHAR},
      updatetime = #{updatetime,jdbcType=TIMESTAMP},
      updateby = #{updateby,jdbcType=VARCHAR},
      validflag = #{validflag,jdbcType=BIT},
      belongid = #{belongid,jdbcType=BIGINT},
      belongname = #{belongname,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>