123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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="PicturesMapper">
-
- <!--表名 -->
- <sql id="tableName">
- TB_PICTURES
- </sql>
-
- <!-- 字段 -->
- <sql id="Field">
- TITLE,
- NAME,
- PATH,
- CREATETIME,
- MASTER_ID,
- BZ,
- PICTURES_ID
- </sql>
-
- <!-- 字段值 -->
- <sql id="FieldValue">
- #{TITLE},
- #{NAME},
- #{PATH},
- #{CREATETIME},
- #{MASTER_ID},
- #{BZ},
- #{PICTURES_ID}
- </sql>
-
- <!-- 列表 -->
- <select id="datalistPage" parameterType="page" resultType="pd">
- select
- a.TITLE,
- a.NAME,
- a.PATH,
- a.CREATETIME,
- a.MASTER_ID,
- a.BZ,
- a.PICTURES_ID
- from
- <include refid="tableName"></include> a
- where 1 = 1
- <if test="pd.KEYW != null and pd.KEYW != ''"><!-- 关键词检索 -->
- and
- (
- a.TITLE LIKE CONCAT(CONCAT('%', #{pd.KEYW}),'%')
- or
- a.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYW}),'%')
- or
- a.PICTURES_ID LIKE CONCAT(CONCAT('%', #{pd.KEYW}),'%')
- or
- a.MASTER_ID LIKE CONCAT(CONCAT('%', #{pd.KEYW}),'%')
- )
- </if>
- </select>
-
- <!-- 新增-->
- <insert id="save" parameterType="pd">
- insert into <include refid="tableName"></include>(
- <include refid="Field"></include>
- ) values (
- <include refid="FieldValue"></include>
- )
- </insert>
-
- <!-- 删除-->
- <delete id="delete" parameterType="pd">
- delete from <include refid="tableName"></include>
- where
- PICTURES_ID = #{PICTURES_ID}
- </delete>
-
- <!-- 修改 -->
- <update id="edit" parameterType="pd">
- update <include refid="tableName"></include>
- set
- TITLE = #{TITLE},
- PATH = #{PATH},
- <if test="NAME != null and NAME != ''">
- NAME = #{NAME},
- </if>
- MASTER_ID = #{MASTER_ID},
- BZ = #{BZ},
- PICTURES_ID = PICTURES_ID
- where
- PICTURES_ID = #{PICTURES_ID}
- </update>
-
- <!-- 通过ID获取数据 -->
- <select id="findById" parameterType="pd" resultType="pd">
- select
- <include refid="Field"></include>
- from
- <include refid="tableName"></include>
- where
- PICTURES_ID = #{PICTURES_ID}
- </select>
-
- <!-- 批量删除 -->
- <delete id="deleteAll" parameterType="String">
- delete from <include refid="tableName"></include>
- where
- PICTURES_ID in
- <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
-
- <!-- 批量获取 -->
- <select id="getAllById" parameterType="String" resultType="pd">
- select PATH from <include refid="tableName"></include>
- where
- PICTURES_ID in
- <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
-
- <!-- 删除图片 -->
- <update id="delTp" parameterType="pd">
- update <include refid="tableName"></include>
- set
- PATH = ''
- where
- PICTURES_ID = #{PICTURES_ID}
- </update>
-
- <!-- fh QQ313596790(青苔) -->
- </mapper>
|