Files
pj_service_cloud/pjcloud-hardware/pjcloud-hardware-biz/src/main/resources/mapper/HardBroadcastMapper.xml
T
2025-04-28 17:32:38 +08:00

90 lines
3.4 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.bsd.pjcloud.hard.mapper.HardBroadcastMapper">
<resultMap id="hardBroadcastMap" type="com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="hardId" column="hard_id"/>
<result property="topic" column="topic"/>
<result property="bizType" column="biz_type"/>
<result property="bizId" column="biz_id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="broadcastCount" column="broadcast_count"/>
<result property="broadcastMaxCount" column="broadcast_max_count"/>
<result property="isBroadcast" column="is_broadcast"/>
<result property="isDone" column="is_done"/>
<result property="isDoneTime" column="is_done_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
<sql id="selectA">
select a.id,
a.user_id,
a.hard_id,
a.topic,
a.biz_type,
a.biz_id,
a.title,
a.content,
a.broadcast_count,
a.broadcast_max_count,
a.is_broadcast,
a.is_done,
a.is_done_time,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
a.del_flag = '0'
<if test="dto.userId != null">
and a.user_id = #{dto.userId}
</if>
<if test="dto.hardId != null">
and a.hard_id = #{dto.hardId}
</if>
<if test="dto.bizType != null">
and a.biz_type = #{dto.bizType}
</if>
<if test="dto.bizId != null">
and a.biz_id = #{dto.bizId}
</if>
<if test="dto.isBroadcast != null">
and a.is_broadcast = #{dto.isBroadcast}
</if>
<if test="dto.isDone != null">
and a.is_done = #{dto.isDone}
</if>
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
</if>
<if test="dto.isDoneTimeList != null and dto.isDoneTimeList.length == 2">
and a.is_done_time between #{dto.isDoneTimeList[0]} and #{dto.isDoneTimeList[1]}
</if>
</sql>
<select id="scopePageJoin" resultType="com.bsd.pjcloud.hard.api.vo.HardBroadcastVo">
<include refid="selectA"/>
o.id as orderId,
o.hour_type as hourType,
o.product_desc as productDesc,
o.pay_price as payPrice
from hard_broadcast a
left join hard_order o on o.id = a.biz_id
<where>
<include refid="whereA"/>
</where>
order by a.create_time desc, a.id desc
</select>
</mapper>