123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?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.EntRiskPointArtMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.aqpt.entity.EntRiskPointArt">
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT"/>
- <result column="art_id" property="artId" jdbcType="BIGINT"/>
- </resultMap>
- <resultMap id="RiskPointArtDtoMap" type="com.zhyc.xps.aqpt.dto.EntRiskPointArtDto" extends="BaseResultMap">
- <result column="art_title" property="artTitle" jdbcType="VARCHAR"/>
- <result column="art_author" property="artAuthor" jdbcType="VARCHAR"/>
- <result column="editor_id" property="editorId" jdbcType="BIGINT"/>
- <result column="editor_name" property="editorName" jdbcType="VARCHAR"/>
- <result column="art_cat_id" property="artCatId" jdbcType="BIGINT"/>
- <result column="art_cat_title" property="artCatTitle" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="ArtDtoResultMap" type="com.zhyc.xps.sys.dto.ArtDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/><!--ID-->
- <result column="art_id" property="artId" jdbcType="BIGINT"/><!--群组ID-->
- <result column="art_cat_id" property="artCatId" jdbcType="BIGINT"/>
- <result column="art_author" property="artAuthor" jdbcType="VARCHAR"/>
- <result column="art_title" property="artTitle" jdbcType="VARCHAR"/>
- <result column="art_source" property="artSource" jdbcType="VARCHAR"/>
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT"/>
- <result column="editor_id" property="editorId" jdbcType="BIGINT"/>
- <result column="issued_at" property="issuedAt" jdbcType="DATE"/>
- <result column="status" property="status" jdbcType="BIGINT"/>
- <result column="art_cat_title" property="artCatTitle" jdbcType="VARCHAR"/>
- <result column="editor_name" property="editorName" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="RiskPointArtDto_Cols">
- A.oc_id,
- A.risk_point_id,
- A.art_id,
- B.art_title,
- B.art_author,
- B.issued_at,
- B.editor_id,
- C.account_name as editor_name,
- B.art_cat_id,
- D.art_cat_title
- </sql>
- <!--分页查询ART信息-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="RiskPointArtDtoMap">
- SELECT
- <include refid="RiskPointArtDto_Cols"/>
- FROM ent_risk_point_art AS A
- LEFT JOIN art AS B ON(A.oc_id = B.oc_id AND A.art_id = B.art_id)
- LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.editor_id = C.account_id)
- LEFT JOIN art_cat AS D ON(B.oc_id = D.oc_id AND B.art_cat_id= D.art_cat_id)
- WHERE 1 = 1 AND B.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}
- </if>
- <if test="keywords != null and keywords != ''">
- AND B.art_title like "%"#{keywords}"%"
- </if>
- ORDER BY B.issued_at DESC
- </select>
- <select id="getByList" parameterType="java.util.Map" resultMap="RiskPointArtDtoMap">
- SELECT
- <include refid="RiskPointArtDto_Cols"/>
- FROM ent_risk_point_art AS A
- LEFT JOIN art AS B ON(A.oc_id = B.oc_id AND A.art_id = B.art_id)
- LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.editor_id = C.account_id)
- LEFT JOIN art_cat AS D ON(B.oc_id = D.oc_id AND B.art_cat_id= D.art_cat_id)
- WHERE B.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}
- </if>
- <if test="artId != null">
- AND A.art_id = #{artId}
- </if>
- <if test="keywords != null and keywords != ''">
- AND B.art_title like "%"#{keywords}"%"
- </if>
- ORDER BY B.issued_at DESC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.EntRiskPointArt">
- INSERT INTO ent_risk_point_art
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="riskPointId != null">
- risk_point_id,
- </if>
- <if test="artId != null">
- art_id,
- </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="artId != null">
- #{artId ,jdbcType=BIGINT},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM ent_risk_point_art
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="riskPointId != null">
- AND risk_point_id = #{riskPointId ,jdbcType=BIGINT}
- </if>
- <if test="artId != null">
- AND art_id = #{artId ,jdbcType=BIGINT}
- </if>
- </delete>
- <!--选择-->
- <select id="getSelectByPage" parameterType="java.util.Map" resultMap="ArtDtoResultMap">
- SELECT
- A.oc_id,
- A.art_id,
- A.art_cat_id,
- B.art_cat_title,
- B.root_id,
- B.node_left,
- B.node_right,
- B.node_level,
- A.art_title,
- A.art_author,
- A.art_content,
- A.art_source,
- A.is_fixed,
- A.issued_at,
- A.editor_id,
- C.account_real_name AS editor_name,
- A.status
- FROM art AS A
- LEFT JOIN art_cat AS B ON(A.oc_id = B.oc_id AND A.art_cat_id= B.art_cat_id)
- LEFT JOIN account AS C ON(A.oc_id = C.oc_id AND A.editor_id = C.account_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- AND NOT EXISTS (
- SELECT
- *
- FROM ent_risk_point_art AS D
- WHERE A.oc_id = D.oc_id AND A.art_id = D.art_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.art_title like "%"#{keywords}"%"
- </if>
- <if test="artCatId != null ">
- AND B.art_cat_id = #{artCatId ,jdbcType=BIGINT}
- </if>
- <if test="nodeLeft != null and nodeRight != null">
- <![CDATA[
- AND B.node_left >= #{nodeLeft ,jdbcType=BIGINT}
- AND B.node_right <= #{nodeRight ,jdbcType=BIGINT}
- ]]>
- </if>
- ORDER BY A.issued_at DESC
- </select>
- </mapper>
|