123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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="codeConvertSqlMapper">
-
- <sql id="base_column">
- id,
- advertiser_id as advertiserId,
- name as convertName,
- type as convertType,
- script_code as script,
- pic_code as picture,
- updated
-
- </sql>
-
- <select id="selectByName" parameterType="string" resultType="com.cloudcross.ssp.model.CodeConvert">
- select
- <include refid="base_column" />
- from t_code_convert
- <where>
- name = #{convertName}
- </where>
- order by id desc
- </select>
-
-
- <select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.CodeConvert">
- select
- <include refid="base_column" />
- from t_code_convert
- <where>
- id = #{id}
- </where>
- </select>
-
- <!-- 搜索用-->
- <select id="selectByParamsadvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.CodeConvert">
- select
- <include refid="base_column" />
- from t_code_convert
- <where>
- <if test="advertiserId!=null and advertiserId != '' and advertiserId!=-1 ">
- advertiser_id=#{advertiserId}
- </if>
-
- <if test="convertName!=null">
- and name like #{convertName}
- </if>
- <!--
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='convertName'">
- and name like #{convertName}
- </when>
-
- </choose>
- </if>
- -->
- </where>
-
- limit #{pager.offset}, #{pager.limit}
-
- </select>
- <select id="selectByParamsoperator" parameterType="map" resultType="com.cloudcross.ssp.model.CodeConvert">
- select
- <include refid="base_column" />
- from t_code_convert where id>0
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='convertName'">
- and name like #{value}
- </when>
- <when test="key=='id'">
- and id like #{value}
- </when>
- </choose>
- </if>
-
- order by id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
-
-
- <select id="countByParamsadvertiser" parameterType="map" resultType="int">
- select count(id)
- from t_code_convert
- <where>
- <if test="advertiserId!=null and advertiserId != '' and advertiserId!=-1 ">
- advertiser_id=#{advertiserId}
- </if>
-
- <if test="convertName!=null">
- and name like #{convertName}
- </if>
- </where>
- <!-- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='id'">
- and id like #{value}
- </when>
- <when test="key=='convertName'">
- and name like #{value}
- </when>
- </choose>
- </if>
- -->
- </select>
-
- <select id="countByParamsoperator" parameterType="map" resultType="int">
- select count(id)
- from t_code_convert where id>0
- <if test="key!=null and value!=null">
- <choose>
- <when test="key=='id'">
- and id like #{value}
- </when>
- <when test="key=='convertName'">
- and name like #{value}
- </when>
- </choose>
- </if>
- </select>
-
-
- <insert id="addCodeConvert" parameterType="com.cloudcross.ssp.model.CodeConvert">
- insert into t_code_convert(advertiser_Id, name, type, updated )
- values(#{advertiserId},#{convertName},#{convertType},#{updated})
- </insert>
-
-
- <update id="editCodeConvert" parameterType="com.cloudcross.ssp.model.CodeConvert">
- update t_code_convert
- set name=#{convertName}, type=#{convertType}, updated=#{updated}, script_code=#{script}, pic_code=#{picture}
- where id = #{id}
- </update>
-
- <!-- 根据id查询代码值 -->
- <select id="getScriptById" parameterType="int" resultType="String">
- select
- script_code
- from t_code_convert where id = #{id}
- </select>
- <!-- 根据id查询图片值 -->
- <select id="getPicyureById" parameterType="int" resultType="String">
- select
- pic_code
- from t_code_convert where id = #{id}
- </select>
-
- </mapper>
|