2022-02-25 16:39:09 +08:00

279 lines
11 KiB
XML

<?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.xhpc.tenant.mapper.XhpcTenantMapper">
<resultMap id="BaseResultMap" type="com.xhpc.tenant.domain.XhpcTenantDomain">
<id column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="tenant_name" jdbcType="VARCHAR" property="tenantName" />
<result column="domain" jdbcType="VARCHAR" property="domain" />
<result column="background_url" jdbcType="VARCHAR" property="backgroundUrl" />
<result column="linkman" jdbcType="VARCHAR" property="linkman" />
<result column="contact_number" jdbcType="VARCHAR" property="contactNumber" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="station_quote" jdbcType="INTEGER" property="stationQuote" />
<result column="station_pile_quote" jdbcType="INTEGER" property="stationPileQuote" />
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
<result column="create_user" jdbcType="BIGINT" property="createUser" />
<result column="create_dept" jdbcType="BIGINT" property="createDept" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_user" jdbcType="BIGINT" property="updateUser" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
</resultMap>
<sql id="Base_Column_List">
tenant_id, tenant_name, `domain`, background_url, linkman, contact_number, address,
station_quote, station_pile_quote, expire_time, create_user, create_dept, create_time,
update_user, update_time, `status`, is_deleted
</sql>
<select id="getList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
select
<include refid="Base_Column_List" />
from xhpc_tenant where is_deleted=0
<if test="params.status != null and params.status != '' and params.status > -1">
and status = #{params.status}
</if>
<if test="params.tenantId != null and params.tenantId != ''">
and tenant_id like concat('%', #{params.tenantId}, '%')
</if>
<if test="params.tenantName != null and params.tenantName != ''">
and tenant_name like concat('%', #{params.tenantName}, '%')
</if>
<if test="params.contactName != null and params.contactName != ''">
and linkman like concat('%', #{params.contactName}, '%')
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_tenant
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from xhpc_tenant
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</delete>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.String">
update xhpc_tenant set is_deleted = 2
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<insert id="insert" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
insert into xhpc_tenant (tenant_name, `domain`, background_url,
linkman, contact_number, address,
station_quote, station_pile_quote, expire_time,
create_user, create_dept, create_time,
update_user, update_time, `status`,
is_deleted)
values (#{tenantName,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR},
#{linkman,jdbcType=VARCHAR}, #{contactNumber,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{stationQuote,jdbcType=INTEGER}, #{stationPileQuote,jdbcType=INTEGER}, #{expireTime,jdbcType=TIMESTAMP},
#{createUser,jdbcType=BIGINT}, #{createDept,jdbcType=BIGINT}, sysdate(),
#{updateUser,jdbcType=BIGINT}, sysdate(), #{status,jdbcType=INTEGER},
0)
</insert>
<insert id="insertSelective" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
insert into xhpc_tenant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantName != null">
tenant_name,
</if>
<if test="domain != null">
`domain`,
</if>
<if test="backgroundUrl != null">
background_url,
</if>
<if test="linkman != null">
linkman,
</if>
<if test="contactNumber != null">
contact_number,
</if>
<if test="address != null">
address,
</if>
<if test="stationQuote != null">
station_quote,
</if>
<if test="stationPileQuote != null">
station_pile_quote,
</if>
<if test="expireTime != null">
expire_time,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="createDept != null">
create_dept,
</if>
create_time,
<if test="updateUser != null">
update_user,
</if>
update_time,
<if test="status != null">
`status`,
</if>
is_deleted
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantName != null">
#{tenantName,jdbcType=VARCHAR},
</if>
<if test="domain != null">
#{domain,jdbcType=VARCHAR},
</if>
<if test="backgroundUrl != null">
#{backgroundUrl,jdbcType=VARCHAR},
</if>
<if test="linkman != null">
#{linkman,jdbcType=VARCHAR},
</if>
<if test="contactNumber != null">
#{contactNumber,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="stationQuote != null">
#{stationQuote,jdbcType=INTEGER},
</if>
<if test="stationPileQuote != null">
#{stationPileQuote,jdbcType=INTEGER},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null">
#{createUser,jdbcType=BIGINT},
</if>
<if test="createDept != null">
#{createDept,jdbcType=BIGINT},
</if>
sysdate(),
<if test="updateUser != null">
#{updateUser,jdbcType=BIGINT},
</if>
sysdate(),
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
0
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
update xhpc_tenant
<set>
<if test="tenantName != null">
tenant_name = #{tenantName,jdbcType=VARCHAR},
</if>
<if test="domain != null">
`domain` = #{domain,jdbcType=VARCHAR},
</if>
<if test="backgroundUrl != null">
background_url = #{backgroundUrl,jdbcType=VARCHAR},
</if>
<if test="linkman != null">
linkman = #{linkman,jdbcType=VARCHAR},
</if>
<if test="contactNumber != null">
contact_number = #{contactNumber,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="stationQuote != null">
station_quote = #{stationQuote,jdbcType=INTEGER},
</if>
<if test="stationPileQuote != null">
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
</if>
<if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=BIGINT},
</if>
update_time = sysdate(),
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted,jdbcType=INTEGER},
</if>
</set>
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
update xhpc_tenant
set tenant_name = #{tenantName,jdbcType=VARCHAR},
`domain` = #{domain,jdbcType=VARCHAR},
background_url = #{backgroundUrl,jdbcType=VARCHAR},
linkman = #{linkman,jdbcType=VARCHAR},
contact_number = #{contactNumber,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
station_quote = #{stationQuote,jdbcType=INTEGER},
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=BIGINT},
update_time = sysdate(),
`status` = #{status,jdbcType=INTEGER},
is_deleted = #{isDeleted,jdbcType=INTEGER}
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<update id="updateInfoByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
update xhpc_tenant
set tenant_name = #{tenantName,jdbcType=VARCHAR},
`domain` = #{domain,jdbcType=VARCHAR},
background_url = #{backgroundUrl,jdbcType=VARCHAR},
linkman = #{linkman,jdbcType=VARCHAR},
contact_number = #{contactNumber,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
update_user = #{updateUser,jdbcType=BIGINT},
update_time = sysdate()
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
update xhpc_tenant
set update_user = #{updateUser,jdbcType=BIGINT},
update_time = sysdate(),
`status` = #{status,jdbcType=INTEGER}
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<update id="updateTenantConfigByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
update xhpc_tenant
set station_quote = #{stationQuote,jdbcType=INTEGER},
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=BIGINT},
update_time = sysdate(),
where tenant_id = #{tenantId,jdbcType=VARCHAR}
</update>
<select id="selectExpiredList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
select
<include refid="Base_Column_List" />
from xhpc_tenant
where is_deleted = 0 and status = 1 and expire_time is not null and expire_time <![CDATA[ <= ]]> sysdate()
</select>
<select id="selectExpiringList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
select
<include refid="Base_Column_List" />
from xhpc_tenant
where is_deleted = 0 and status = 1 and expire_time is not null and expire_time <![CDATA[ <= ]]> #{expireTime}
</select>
</mapper>