123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <?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.common.mapper.ClientMapper">
- <resultMap id="ClientDtoResultMap" type="com.zhyc.xps.common.dto.ClientDto">
- <result column="client_id" property="clientId" jdbcType="BIGINT" />
- <result column="client_title" property="clientTitle" jdbcType="VARCHAR"/>
- <result column="client_app_id" property="clientAppId" jdbcType="VARCHAR"/>
- <result column="client_app_key" property="clientAppKey" jdbcType="VARCHAR"/>
- <result column="client_app_secret" property="clientAppSecret" jdbcType="VARCHAR"/>
- <result column="client_desc" property="clientDesc" jdbcType="VARCHAR"/>
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- </resultMap>
- <sql id="ClientDto_Cols">
- client_id,
- client_title,
- client_app_id,
- client_app_key,
- client_app_secret,
- client_desc,
- status,
- is_fixed
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="ClientDtoResultMap">
- SELECT
- <include refid="ClientDto_Cols"/>
- FROM client
- WHERE deleted_flag = 0
- <if test="clientId != null">
- AND client_id = #{clientId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--基于Key查询-->
- <select id="getByKey" resultMap="ClientDtoResultMap">
- SELECT
- <include refid="ClientDto_Cols"/>
- FROM client
- WHERE deleted_flag = 0
- <if test="clientAppId != null and clientAppId != ''">
- AND client_app_id = #{clientAppId ,jdbcType=VARCHAR}
- </if>
- <if test="clientAppKey != null and clientAppKey != ''">
- AND client_app_key = #{clientAppKey ,jdbcType=VARCHAR}
- </if>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="ClientDtoResultMap">
- SELECT
- <include refid="ClientDto_Cols"/>
- FROM client
- WHERE deleted_flag = 0
- <if test="clientId != null">
- AND client_id = #{clientId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND client_title like "%"#{keywords}"%"
- </if>
- ORDER BY client_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="ClientDtoResultMap" >
- SELECT
- <include refid="ClientDto_Cols"/>
- FROM client
- WHERE deleted_flag = 0
- <if test="clientId != null">
- AND client_id = #{clientId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND client_title LIKE "%"#{keywords}"%"
- </if>
- </select>
- <!--新增Create-->
- <insert id="create" parameterType="com.zhyc.xps.common.entity.Client">
- INSERT INTO client
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="clientId != null">
- client_id,
- </if>
- <if test="clientTitle != null and clientTitle !=''">
- client_title,
- </if>
- <if test="clientAppId != null and clientAppId !=''">
- client_app_id,
- </if>
- <if test="clientAppKey != null and clientAppKey !=''">
- client_app_key,
- </if>
- <if test="clientAppSecret != null and clientAppSecret !=''">
- client_app_secret,
- </if>
- <if test="clientDesc != null and clientDesc !=''">
- client_desc,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="clientId != null">
- #{clientId ,jdbcType=BIGINT},
- </if>
- <if test="clientTitle != null and clientTitle != ''">
- #{clientTitle ,jdbcType=VARCHAR},
- </if>
- <if test="clientAppId != null and clientAppId !=''">
- #{clientAppId ,jdbcType=VARCHAR},
- </if>
- <if test="clientAppKey != null and clientAppKey !=''">
- #{clientAppKey ,jdbcType=VARCHAR},
- </if>
- <if test="clientAppSecret != null and clientAppSecret !=''">
- #{clientAppSecret ,jdbcType=VARCHAR},
- </if>
- <if test="clientDesc != null and clientDesc != ''">
- #{clientDesc ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新Update-->
- <update id="update" parameterType="com.zhyc.xps.common.entity.Client">
- UPDATE client
- <trim suffixOverrides=",">
- <set>
- <if test="clientTitle != null and clientTitle != ''">
- client_title = #{clientTitle, jdbcType=VARCHAR},
- </if>
- <if test="clientDesc != null and clientDesc != ''">
- client_desc = #{clientDesc, jdbcType=VARCHAR},
- </if>
- <if test="clientAppId != null and clientAppId !=''">
- client_app_id = #{clientAppId ,jdbcType=VARCHAR},
- </if>
- <if test="clientAppKey != null and clientAppKey !=''">
- client_app_key = #{clientAppKey ,jdbcType=VARCHAR},
- </if>
- <if test="clientAppSecret != null and clientAppSecret !=''">
- client_app_secret = #{clientAppSecret ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status ,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 client_id = #{clientId ,jdbcType=BIGINT}
- </update>
- <!--删除Delete-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE client
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedTime != null">
- deleted_time = #{deletedTime,jdbcType=VARCHAR},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE client_id = #{clientId ,jdbcType=BIGINT}
- </update>
- <!--是否存在-->
- <select id="isExist" parameterType="java.util.Map" resultType="java.lang.Long">
- SELECT count(0)
- FROM client AS A
- WHERE A.deleted_flag = 0
- <if test="clientAppId != null and clientAppId != ''">
- AND A.client_app_id = #{clientAppId,jdbcType=VARCHAR}
- </if>
- <if test="clientAppKey != null and clientAppKey != ''">
- AND A.client_app_key = #{clientAppKey,jdbcType=VARCHAR}
- </if>
- <if test="clientAppSecret != null and clientAppSecret != ''">
- AND A.client_app_secret = #{clientAppSecret,jdbcType=VARCHAR}
- </if>
- </select>
- </mapper>
|