219 lines
8.5 KiB
XML
219 lines
8.5 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.bonus.sharedstation.app.mapper.CleaningServicesMapper">
|
||
|
|
|
||
|
|
<resultMap type="com.bonus.sharedstation.app.entity.CleaningServicesEntity" id="CleaningServicesMap">
|
||
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||
|
|
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
|
||
|
|
<result property="price" column="price" jdbcType="NUMERIC"/>
|
||
|
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
||
|
|
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||
|
|
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||
|
|
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||
|
|
<result property="updatedTime" column="updated_time" jdbcType="TIMESTAMP"/>
|
||
|
|
<result property="updatedBy" column="updated_by" jdbcType="VARCHAR"/>
|
||
|
|
<result property="isDeleted" column="is_deleted" jdbcType="VARCHAR"/>
|
||
|
|
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
|
||
|
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!--查询单个-->
|
||
|
|
<select id="queryById" resultMap="CleaningServicesMap">
|
||
|
|
select id,
|
||
|
|
service_name,
|
||
|
|
type,
|
||
|
|
price,
|
||
|
|
unit,
|
||
|
|
description,
|
||
|
|
created_by,
|
||
|
|
created_time,
|
||
|
|
updated_time,
|
||
|
|
updated_by,
|
||
|
|
is_deleted,
|
||
|
|
tenant_id
|
||
|
|
from yz_cleaning_services
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--查询指定行数据-->
|
||
|
|
<select id="queryAllByLimit" resultMap="CleaningServicesMap">
|
||
|
|
select
|
||
|
|
id, service_name,type, price, unit, description, created_by, created_time, updated_time, updated_by, is_deleted,
|
||
|
|
tenant_id
|
||
|
|
from yz_cleaning_services
|
||
|
|
<where>
|
||
|
|
<if test="id != null">
|
||
|
|
and id = #{id}
|
||
|
|
</if>
|
||
|
|
<if test="serviceName != null and serviceName != ''">
|
||
|
|
and service_name = #{serviceName}
|
||
|
|
</if>
|
||
|
|
<if test="price != null">
|
||
|
|
and price = #{price}
|
||
|
|
</if>
|
||
|
|
<if test="unit != null and unit != ''">
|
||
|
|
and unit = #{unit}
|
||
|
|
</if>
|
||
|
|
<if test="description != null and description != ''">
|
||
|
|
and description = #{description}
|
||
|
|
</if>
|
||
|
|
<if test="createdBy != null and createdBy != ''">
|
||
|
|
and created_by = #{createdBy}
|
||
|
|
</if>
|
||
|
|
<if test="createdTime != null">
|
||
|
|
and created_time = #{createdTime}
|
||
|
|
</if>
|
||
|
|
<if test="updatedTime != null">
|
||
|
|
and updated_time = #{updatedTime}
|
||
|
|
</if>
|
||
|
|
<if test="updatedBy != null and updatedBy != ''">
|
||
|
|
and updated_by = #{updatedBy}
|
||
|
|
</if>
|
||
|
|
<if test="isDeleted != null and isDeleted != ''">
|
||
|
|
and is_deleted = #{isDeleted}
|
||
|
|
</if>
|
||
|
|
<if test="type != null and type != ''">
|
||
|
|
and type = #{type}
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
and tenant_id = #{tenantId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
limit #{pageable.offset}, #{pageable.pageSize}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--统计总行数-->
|
||
|
|
<select id="count" resultType="java.lang.Long">
|
||
|
|
select count(1)
|
||
|
|
from yz_cleaning_services
|
||
|
|
<where>
|
||
|
|
<if test="id != null">
|
||
|
|
and id = #{id}
|
||
|
|
</if>
|
||
|
|
<if test="serviceName != null and serviceName != ''">
|
||
|
|
and service_name = #{serviceName}
|
||
|
|
</if>
|
||
|
|
<if test="price != null">
|
||
|
|
and price = #{price}
|
||
|
|
</if>
|
||
|
|
<if test="unit != null and unit != ''">
|
||
|
|
and unit = #{unit}
|
||
|
|
</if>
|
||
|
|
<if test="description != null and description != ''">
|
||
|
|
and description = #{description}
|
||
|
|
</if>
|
||
|
|
<if test="createdBy != null and createdBy != ''">
|
||
|
|
and created_by = #{createdBy}
|
||
|
|
</if>
|
||
|
|
<if test="createdTime != null">
|
||
|
|
and created_time = #{createdTime}
|
||
|
|
</if>
|
||
|
|
<if test="updatedTime != null">
|
||
|
|
and updated_time = #{updatedTime}
|
||
|
|
</if>
|
||
|
|
<if test="updatedBy != null and updatedBy != ''">
|
||
|
|
and updated_by = #{updatedBy}
|
||
|
|
</if>
|
||
|
|
<if test="isDeleted != null and isDeleted != ''">
|
||
|
|
and is_deleted = #{isDeleted}
|
||
|
|
</if>
|
||
|
|
<if test="type != null and type != ''">
|
||
|
|
and type = #{type}
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
and tenant_id = #{tenantId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<!--新增所有列-->
|
||
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into yz_cleaning_services(service_name,type, price, unit, description, created_by, created_time, updated_time,
|
||
|
|
updated_by, is_deleted, tenant_id)
|
||
|
|
values (#{serviceName},#{type}, #{price}, #{unit}, #{description}, #{createdBy}, #{createdTime}, #{updatedTime},
|
||
|
|
#{updatedBy}, #{isDeleted}, #{tenantId})
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into yz_cleaning_services(service_name,type,price, unit, description, created_by, created_time, updated_time,
|
||
|
|
updated_by, is_deleted, tenant_id)
|
||
|
|
values
|
||
|
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
|
(#{entity.serviceName}, #{entity.type},#{entity.price}, #{entity.unit}, #{entity.description}, #{entity.createdBy},
|
||
|
|
#{entity.createdTime}, #{entity.updatedTime}, #{entity.updatedBy}, #{entity.isDeleted}, #{entity.tenantId})
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||
|
|
insert into yz_cleaning_services(service_name, type,price, unit, description, created_by, created_time, updated_time,
|
||
|
|
updated_by, is_deleted, tenant_id)
|
||
|
|
values
|
||
|
|
<foreach collection="entities" item="entity" separator=",">
|
||
|
|
(#{entity.serviceName}, #{entity.type}, #{entity.price}, #{entity.unit}, #{entity.description}, #{entity.createdBy},
|
||
|
|
#{entity.createdTime}, #{entity.updatedTime}, #{entity.updatedBy}, #{entity.isDeleted}, #{entity.tenantId})
|
||
|
|
</foreach>
|
||
|
|
on duplicate key update
|
||
|
|
service_name = values(service_name),
|
||
|
|
price = values(price),
|
||
|
|
unit = values(unit),
|
||
|
|
description = values(description),
|
||
|
|
created_by = values(created_by),
|
||
|
|
created_time = values(created_time),
|
||
|
|
updated_time = values(updated_time),
|
||
|
|
updated_by = values(updated_by),
|
||
|
|
is_deleted = values(is_deleted),
|
||
|
|
type = values(type),
|
||
|
|
tenant_id = values(tenant_id)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<!--通过主键修改数据-->
|
||
|
|
<update id="update">
|
||
|
|
update yz_cleaning_services
|
||
|
|
<set>
|
||
|
|
<if test="serviceName != null and serviceName != ''">
|
||
|
|
service_name = #{serviceName},
|
||
|
|
</if>
|
||
|
|
<if test="price != null">
|
||
|
|
price = #{price},
|
||
|
|
</if>
|
||
|
|
<if test="unit != null and unit != ''">
|
||
|
|
unit = #{unit},
|
||
|
|
</if>
|
||
|
|
<if test="description != null and description != ''">
|
||
|
|
description = #{description},
|
||
|
|
</if>
|
||
|
|
<if test="createdBy != null and createdBy != ''">
|
||
|
|
created_by = #{createdBy},
|
||
|
|
</if>
|
||
|
|
<if test="createdTime != null">
|
||
|
|
created_time = #{createdTime},
|
||
|
|
</if>
|
||
|
|
<if test="updatedTime != null">
|
||
|
|
updated_time = #{updatedTime},
|
||
|
|
</if>
|
||
|
|
<if test="updatedBy != null and updatedBy != ''">
|
||
|
|
updated_by = #{updatedBy},
|
||
|
|
</if>
|
||
|
|
<if test="isDeleted != null and isDeleted != ''">
|
||
|
|
is_deleted = #{isDeleted},
|
||
|
|
</if>
|
||
|
|
<if test="type != null and type != ''">
|
||
|
|
type = #{type},
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
tenant_id = #{tenantId},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<!--通过主键删除-->
|
||
|
|
<delete id="deleteById">
|
||
|
|
delete
|
||
|
|
from yz_cleaning_services
|
||
|
|
where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
</mapper>
|
||
|
|
|