Bonus-ProtectionSetting-Manage/bonus-modules/bonus-shared-station/target/classes/mapper/app/GreenOrderMapper.xml

331 lines
13 KiB
XML
Raw Normal View History

2025-10-20 13:37:56 +08:00
<?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.GreenOrderMapper">
<resultMap type="com.bonus.sharedstation.app.entity.GreenOrder" id="GreenOrderMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="usePrice" column="use_price" jdbcType="NUMERIC"/>
<result property="deliveryFee" column="delivery_fee" jdbcType="NUMERIC"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="unit" column="unit" jdbcType="VARCHAR"/>
<result property="orderTime" column="order_time" jdbcType="TIMESTAMP"/>
<result property="remarks" column="remarks" 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="ordno" column="ordno" jdbcType="VARCHAR"/>
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="GreenOrderMap">
select id,
name,
ordno,
use_price,
delivery_fee,
user_id,
phone,
unit,
order_time,
remarks,
created_by,
created_time,
updated_time,
updated_by,
is_deleted,
tenant_id,
status
from green_order
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="GreenOrderMap">
select
id, name, use_price,ordno, delivery_fee,user_id, phone, unit, order_time, remarks, created_by, created_time,
updated_time, updated_by, is_deleted, tenant_id, status
from green_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="usePrice != null">
and use_price = #{usePrice}
</if>
<if test="deliveryFee != null">
and delivery_fee = #{deliveryFee}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="unit != null and unit != ''">
and unit = #{unit}
</if>
<if test="orderTime != null">
and order_time = #{orderTime}
</if>
<if test="remarks != null and remarks != ''">
and remarks = #{remarks}
</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="ordno != null and ordno != ''">
and ordno = #{ordno}
</if>
<if test="tenantId != null">
and tenant_id = #{tenantId}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from green_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="usePrice != null">
and use_price = #{usePrice}
</if>
<if test="deliveryFee != null">
and delivery_fee = #{deliveryFee}
</if>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="unit != null and unit != ''">
and unit = #{unit}
</if>
<if test="orderTime != null">
and order_time = #{orderTime}
</if>
<if test="remarks != null and remarks != ''">
and remarks = #{remarks}
</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="ordno != null and ordno != ''">
and ordno = #{ordno}
</if>
<if test="tenantId != null">
and tenant_id = #{tenantId}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into green_order(name, use_price, ordno, delivery_fee, user_id, phone, unit, order_time, remarks,
created_by,
created_time,
updated_time, updated_by, is_deleted, tenant_id, status)
values (#{name}, #{usePrice}, #{ordno}, #{deliveryFee}, #{userId}, #{phone}, #{unit}, #{orderTime}, #{remarks},
#{createdBy},
#{createdTime}, #{updatedTime}, #{updatedBy}, #{isDeleted}, #{tenantId}, #{status})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into green_order(name, use_price,ordno,delivery_fee, user_id, phone, unit, order_time, remarks,
created_by,
created_time,
updated_time, updated_by, is_deleted, tenant_id, status)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.usePrice},#{entity.ordno},#{entity.deliveryFee}, #{entity.userId},
#{entity.phone},
#{entity.unit}, #{entity.orderTime},
#{entity.remarks}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedTime}, #{entity.updatedBy},
#{entity.isDeleted}, #{entity.tenantId}, #{entity.status})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into green_order(name,ordno, use_price,delivery_fee, user_id, phone, unit, order_time, remarks,
created_by,
created_time,
updated_time, updated_by, is_deleted, tenant_id, status)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.ordno},#{entity.usePrice}, #{entity.deliveryFee}, #{entity.userId},
#{entity.phone},
#{entity.unit}, #{entity.orderTime},
#{entity.remarks}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedTime}, #{entity.updatedBy},
#{entity.isDeleted}, #{entity.tenantId}, #{entity.status})
</foreach>
on duplicate key update
name = values(name),
use_price = values(use_price),
delivery_fee = values(delivery_fee),
user_id = values(user_id),
phone = values(phone),
unit = values(unit),
order_time = values(order_time),
remarks = values(remarks),
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),
ordno = values(ordno),
tenant_id = values(tenant_id),
status = values(status)
</insert>
<!-- 其他映射定义 -->
<!-- 动态插入字段 -->
<insert id="addWashClothingOrder" parameterType="com.bonus.sharedstation.app.entity.GreenOrder">
insert into wash_clothing_order (
<if test="name != null and name != ''">name,</if>
<if test="usePrice != null">use_price,</if>
<if test="deliveryFee != null">delivery_fee,</if>
<if test="userId != null and userId != ''">user_id,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="orderTime != null">order_time,</if>
<if test="remarks != null and remarks != ''">remarks,</if>
<if test="createdBy != null and createdBy != ''">created_by,</if>
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
<if test="isDeleted != null and isDeleted != ''">is_deleted,</if>
<if test="ordno != null and ordno != ''">ordno,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="status != null and status != ''">status,</if>
created_time
)values(
<if test="name != null and name != ''">#{name},</if>
<if test="usePrice != null">#{usePrice},</if>
<if test="deliveryFee != null">#{deliveryFee},</if>
<if test="userId != null and userId != ''">#{userId},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="orderTime != null">#{orderTime},</if>
<if test="remarks != null and remarks != ''">#{remarks},</if>
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
<if test="ordno != null and ordno != ''">#{ordno},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="status != null and status != ''">#{status},</if>
NOW()
)
</insert>
<!--通过主键修改数据-->
<update id="update">
update green_order
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="usePrice != null">
use_price = #{usePrice},
</if>
<if test="deliveryFee != null">
delivery_fee = #{deliveryFee},
</if>
<if test="userId != null and userId != ''">
user_id = #{userId},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="unit != null and unit != ''">
unit = #{unit},
</if>
<if test="orderTime != null">
order_time = #{orderTime},
</if>
<if test="remarks != null and remarks != ''">
remarks = #{remarks},
</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="ordno != null and ordno != ''">
ordno = #{ordno},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId},
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from green_order
where id = #{id}
</delete>
</mapper>