123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?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.sys.mapper.BannerMapper">
- <resultMap id="BannerDtoResultMap" type="com.zhyc.xps.sys.dto.BannerDto" >
- <result column="banner_id" property="bannerId" jdbcType="BIGINT" /><!--Banner ID-->
- <result column="banner_title" property="bannerTitle" jdbcType="VARCHAR"/>
- <result column="banner_type_id" property="bannerTypeId" jdbcType="BIGINT" />
- <result column="banner_type_title" property="bannerTypeTitle" jdbcType="VARCHAR"/>
- <result column="order" property="order" jdbcType="BIGINT" />
- <result column="is_visible" property="isVisible" jdbcType="BIGINT" />
- <result column="url" property="url" jdbcType="VARCHAR"/>
- <result column="image_path" property="imagePath" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="BannerDto_Cols">
- A.banner_id,
- A.banner_title,
- A.banner_type_id,
- B.banner_type_title,
- A.order,
- A.is_visible,
- A.url,
- A.image_path
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="BannerDtoResultMap">
- SELECT
- <include refid="BannerDto_Cols"/>
- FROM banner AS A
- LEFT JOIN banner_type AS B ON (A.banner_type_id = B.banner_type_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="bannerId !=null">
- AND A.banner_id = #{bannerId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--列表查询-->
- <select id="getByList" resultMap="BannerDtoResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="BannerDto_Cols"/>
- FROM banner AS A
- LEFT JOIN banner_type AS B ON (A.banner_type_id = B.banner_type_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="bannerId !=null">
- AND A.banner_id = #{bannerId ,jdbcType=BIGINT}
- </if>
- <if test="bannerTypeId != null">
- AND A.banner_type_id = #{bannerTypeId ,jdbcType=BIGINT}
- </if>
- <if test="isVisible != null">
- AND A.is_visible = #{isVisible ,jdbcType=BIGINT}
- </if>
- ORDER BY A.banner_id ASC
- </select>
- <!--分页查询-->
- <select id="getByPage" resultMap="BannerDtoResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="BannerDto_Cols"/>
- FROM banner AS A
- LEFT JOIN banner_type AS B ON (A.banner_type_id = B.banner_type_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="bannerId !=null">
- AND A.banner_id = #{bannerId ,jdbcType=BIGINT}
- </if>
- <if test="bannerTypeId != null">
- AND A.banner_type_id = #{bannerTypeId ,jdbcType=BIGINT}
- </if>
- <if test="isVisible != null">
- AND A.is_visible = #{isVisible ,jdbcType=BIGINT}
- </if>
- ORDER BY A.banner_id ASC
- </select>
- <!--新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.Banner" keyProperty="bannerId">
- INSERT INTO banner
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="bannerId != null">
- banner_id,
- </if>
- <if test="bannerTypeId != null">
- banner_type_id,
- </if>
- <if test="bannerTitle != null and bannerTitle!=''">
- banner_title,
- </if>
- <if test="imagePath != null and imagePath != ''">
- image_path,
- </if>
- <if test="url != null and url != ''">
- url,
- </if>
- <if test="order != null">
- order,
- </if>
- <if test="isVisible != null">
- is_visible,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="bannerId != null">
- #{bannerId ,jdbcType=BIGINT},
- </if>
- <if test="bannerTypeId != null">
- #{bannerTypeId ,jdbcType=BIGINT},
- </if>
- <if test="bannerTitle != null and bannerTitle!=''">
- #{bannerTitle ,jdbcType=VARCHAR},
- </if>
- <if test="imagePath != null and imagePath != ''">
- #{imagePath,jdbcType=VARCHAR},
- </if>
- <if test="url != null and url != ''">
- #{url ,jdbcType=VARCHAR},
- </if>
- <if test="order != null">
- #{order ,jdbcType=BIGINT},
- </if>
- <if test="isVisible != null">
- #{isVisible ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.Banner">
- UPDATE banner
- <trim suffixOverrides=",">
- <set>
- <if test="bannerTypeId != null">
- banner_type_id = #{bannerTypeId ,jdbcType=BIGINT},
- </if>
- <if test="bannerTitle != null">
- banner_title =#{bannerTitle ,jdbcType=VARCHAR},
- </if>
- <if test="imagePath != null and imagePath != ''">
- image_path = #{imagePath ,jdbcType=VARCHAR},
- </if>
- <if test="url != null and url != ''">
- url = #{url ,jdbcType=VARCHAR},
- </if>
- <if test="order != null">
- order = #{order ,jdbcType=BIGINT},
- </if>
- <if test="isVisible != null">
- is_visible = #{isVisible ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="bannerId != null">
- AND banner_id = #{bannerId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE banner
- <trim suffixOverrides=",">
- <set>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="bannerId != null">
- AND banner_id = #{bannerId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|