123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?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.ZkChecklistMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.aqpt.entity.ZkChecklist">
- <result column="industry_id" property="industryId" jdbcType="BIGINT" />
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT" />
- <result column="created_by" property="createdBy" jdbcType="BIGINT" />
- <result column="created_at" property="createdAt" jdbcType="DATE" />
- <result column="updated_by" property="updatedBy" jdbcType="BIGINT" />
- <result column="updated_at" property="updatedAt" jdbcType="DATE" />
- </resultMap>
- <resultMap id="ZkChecklistDtoResultMap" type="com.zhyc.xps.aqpt.dto.ZkChecklistDto" extends="BaseResultMap">
- <result column="industry_name" property="industryName" 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" />
- <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_by" property="issuedBy" 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" />
- </resultMap>
- <sql id="Base_Column_List">
- industry_id,
- checklist_id,
- created_by,
- created_at,
- updated_by,
- updated_at
- </sql>
- <sql id="ZkChecklistDto_Column_List">
- A.industry_id,
- B.industry_name,
- A.checklist_id,
- C.checklist_cat_id,
- C.checklist_type_id,
- D.checklist_cat_title,
- C.checklist_desc,
- C.checklist_title,
- C.is_fixed,
- C.issued_by,
- C.issued_at,
- C.author
- </sql>
- <!--根据ID获取信息-->
- <select id="getById" resultMap="ZkChecklistDtoResultMap">
- SELECT
- <include refid="ZkChecklistDto_Column_List"/>
- FROM zk_checklist AS A
- LEFT JOIN industry AS B ON (A.industry_id = B.industry_id)
- LEFT JOIN checklist AS C ON (A.checklist_id = C.checklist_id)
- LEFT JOIN checklist_cat D ON (C.checklist_cat_id = D.checklist_cat_id)
- WHERE 1 = 1 AND C.deleted_flag = 0
- <if test="industryId != null">
- AND A.industry_id = #{industryId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--根据ID获取信息-->
- <select id="getByChecklistId" resultMap="ZkChecklistDtoResultMap">
- SELECT
- <include refid="ZkChecklistDto_Column_List"/>
- FROM zk_checklist AS A
- LEFT JOIN industry AS B ON (A.industry_id = B.industry_id)
- LEFT JOIN checklist AS C ON (A.checklist_id = C.checklist_id)
- LEFT JOIN checklist_cat D ON (C.checklist_cat_id = D.checklist_cat_id)
- WHERE 1 = 1 AND C.deleted_flag = 0
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- Limit 0, 1
- </select>
- <!--分页查询信息-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="ZkChecklistDtoResultMap">
- SELECT
- <include refid="ZkChecklistDto_Column_List"/>
- FROM zk_checklist AS A
- LEFT JOIN industry AS B ON (A.industry_id = B.industry_id)
- LEFT JOIN checklist AS C ON (A.checklist_id = C.checklist_id)
- LEFT JOIN checklist_cat D ON (C.checklist_cat_id = D.checklist_cat_id)
- WHERE 1 = 1 AND C.deleted_flag = 0
- <if test="industryId != null">
- AND A.industry_id = #{industryId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND C.checklist_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeLeft != '' and nodeRight != null and nodeRight != ''">
- <![CDATA[
- AND
- B.node_left >= #{nodeLeft, jdbcType=BIGINT}
- AND
- B.node_right <= #{nodeRight, jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY C.issued_at DESC
- </select>
- <!--查询信息列表-->
- <select id="getByList" parameterType="java.util.Map" resultMap="ZkChecklistDtoResultMap">
- SELECT
- <include refid="ZkChecklistDto_Column_List"/>
- FROM zk_checklist AS A
- LEFT JOIN industry AS B ON (A.industry_id = B.industry_id)
- LEFT JOIN checklist AS C ON (A.checklist_id = C.checklist_id)
- LEFT JOIN checklist_cat D ON (C.checklist_cat_id = D.checklist_cat_id)
- WHERE 1 = 1 AND C.deleted_flag = 0
- <if test="industryId != null">
- AND A.industry_id = #{industryId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND C.checklist_title like "%"#{keywords}"%"
- </if>
- <if test="nodeLeft != null and nodeLeft != '' and nodeRight != null and nodeRight != ''">
- <![CDATA[
- AND
- B.node_left >= #{nodeLeft, jdbcType=BIGINT}
- AND
- B.node_right <= #{nodeRight, jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY C.issued_at DESC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.ZkChecklist">
- INSERT INTO zk_checklist
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="industryId != null">
- industry_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="industryId != null">
- #{industryId ,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=DATE},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM zk_checklist
- WHERE 1 = 1
- <if test="industryId != null">
- AND industry_id = #{industryId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|