123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <?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.zhyc.xps.aqpt.mapper.EntRiskPointChecklistMapper">
- <resultMap id="RiskPointChecklistDtoMap" type="com.zhyc.xps.aqpt.dto.EntRiskPointChecklistDto" >
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT" />
- <result column="remark" property="remark" jdbcType="VARCHAR" />
- <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR" />
- <result column="checklist_cat_id" property="checklistCatId" jdbcType="BIGINT" />
- <result column="checklist_cat_title" property="checklistCatTitle" jdbcType="VARCHAR" />
- <result column="checklist_type_id" property="checklistTypeId" jdbcType="BIGINT" />
- </resultMap>
- <resultMap id="ChecklistDtoMap" type="com.zhyc.xps.common.dto.ChecklistDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--单位ID-->
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT" /><!--清单ID-->
- <result column="checklist_cat_id" property="checklistCatId" jdbcType="BIGINT" />
- <result column="checklist_type_id" property="checklistTypeId" jdbcType="BIGINT" />
- <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR" />
- <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- <result column="issued_at" property="issuedAt" jdbcType="TIMESTAMP"/>
- <result column="author" property="author" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="version" property="version" jdbcType="VARCHAR" />
- <result column="checklist_cat_title" property="checklistCatTitle" jdbcType="VARCHAR" />
- <result column="issued_account_id" property="issuedAccountId" jdbcType="BIGINT" />
- <result column="issued_account_name" property="issuedAccountName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="RiskPointChecklistDto_Cols">
- A.oc_id,
- A.risk_point_id,
- A.checklist_id,
- B.checklist_title,
- B.checklist_type_id,
- B.checklist_cat_id,
- C.checklist_cat_title,
- A.remark
- </sql>
- <!--分页查询信息-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="RiskPointChecklistDtoMap">
- SELECT
- <include refid="RiskPointChecklistDto_Cols"/>
- FROM ent_risk_point_checklist AS A
- LEFT JOIN checklist AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id)
- LEFT JOIN checklist_cat AS C ON (B.oc_id = C.oc_id AND B.checklist_cat_id = C.checklist_cat_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and B.checklist_title like "%"#{keywords}"%"
- </if>
- ORDER BY checklist_id ASC
- </select>
- <!--基于ID获取信息-->
- <select id="getById" parameterType="java.util.Map" resultMap="RiskPointChecklistDtoMap">
- SELECT
- <include refid="RiskPointChecklistDto_Cols"/>
- FROM ent_risk_point_checklist AS A
- LEFT JOIN checklist AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id)
- LEFT JOIN checklist_cat AS C ON (B.oc_id = C.oc_id AND B.checklist_cat_id = C.checklist_cat_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--查询信息-->
- <select id="getByList" parameterType="java.util.Map" resultMap="RiskPointChecklistDtoMap">
- SELECT
- <include refid="RiskPointChecklistDto_Cols"/>
- FROM ent_risk_point_checklist AS A
- LEFT JOIN checklist AS B ON (A.oc_id = B.oc_id AND A.checklist_id = B.checklist_id)
- LEFT JOIN checklist_cat AS C ON (B.oc_id = C.oc_id AND B.checklist_cat_id = C.checklist_cat_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and B.checklist_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.checklist_id ASC
- </select>
- <!--INSERT-->
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.EntRiskPointChecklist">
- INSERT INTO ent_risk_point_checklist
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="riskPointId != null">
- risk_point_id,
- </if>
- <if test="checklistId != null">
- checklist_id,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="riskPointId != null">
- #{riskPointId ,jdbcType=BIGINT},
- </if>
- <if test="checklistId != null">
- #{checklistId ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM ent_risk_point_checklist
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointCatId != null">
- AND risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </delete>
- <!--查询信息-->
- <select id="getSelectByPage" parameterType="java.util.Map" resultMap="ChecklistDtoMap">
- SELECT
- A.oc_id,
- A.checklist_id,
- A.checklist_cat_id,
- A.checklist_type_id,
- B.checklist_cat_title,
- A.checklist_desc,
- A.checklist_title,
- A.is_fixed,
- C.account_name AS issued_account_name,
- A.issued_by AS issued_account_id,
- A.issued_at,
- A.author,
- A.status,
- A.version
- FROM checklist AS A
- LEFT JOIN checklist_cat AS B ON (A.oc_id = B.oc_id AND A.checklist_cat_id = B.checklist_cat_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.issued_by = C.account_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- AND NOT EXISTS (
- SELECT
- *
- FROM ent_risk_point_checklist AS D
- WHERE A.oc_id = D.oc_id AND A.checklist_id = D.checklist_id AND D.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- )
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and A.checklist_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.checklist_id ASC
- </select>
- </mapper>
|