2025-05-30 08:27:52 +00: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.ruoyi.sip.mapper.ProjectOrderInfoMapper" >
<resultMap type= "ProjectOrderInfo" id= "ProjectOrderInfoResult" >
<result property= "id" column= "id" />
<result property= "projectId" column= "project_id" />
<result property= "city" column= "city" />
<result property= "businessPerson" column= "business_person" />
<result property= "businessEmail" column= "business_email" />
<result property= "businessPhone" column= "business_phone" />
<result property= "orderCode" column= "order_code" />
<result property= "currencyType" column= "currencyType" />
<result property= "shipmentAmount" column= "shipment_amount" />
<result property= "actualPurchaseAmount" column= "actual_purchase_amount" />
<result property= "orderEndTime" column= "order_end_time" />
<result property= "deliveryTime" column= "delivery_time" />
<result property= "companyDelivery" column= "company_delivery" />
<result property= "notifier" column= "notifier" />
<result property= "notifierEmail" column= "notifier_email" />
<result property= "notifierPhone" column= "notifier_phone" />
<result property= "duty" column= "duty" />
<result property= "dutyEmail" column= "duty_email" />
<result property= "dutyPhone" column= "duty_phone" />
<result property= "orderChannel" column= "order_channel" />
<result property= "partnerCode" column= "partner_code" />
<result property= "supplier" column= "supplier" />
<result property= "remark" column= "remark" />
<result property= "orderStatus" column= "order_status" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
</resultMap>
<sql id= "selectProjectOrderInfoVo" >
2025-06-04 03:25:20 +00:00
select id, project_id,province, city, business_person, business_email, business_phone, order_code, currencyType,
2025-05-30 08:27:52 +00:00
shipment_amount, actual_purchase_amount, order_end_time, delivery_time, company_delivery, notifier,
notifier_email, notifier_phone, duty, duty_email, duty_phone, order_channel, partner_code, supplier,
2025-06-19 02:22:36 +00:00
remark, order_status, create_by, create_time, update_by, update_time,version_code from project_order_info t1
2025-05-30 08:27:52 +00:00
</sql>
<sql id= "selectProjectOrderInfoRelationVo" >
2025-06-04 03:25:20 +00:00
select t1.id, t1.project_id,t1.province, t1.city, t1.business_person, t1.business_email, t1.business_phone, t1.order_code, t1.currencyType,
2025-05-30 08:27:52 +00:00
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
2025-06-19 02:22:36 +00:00
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code
2025-06-12 03:26:43 +00:00
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
2025-06-19 02:22:36 +00:00
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code
2025-05-30 08:27:52 +00:00
,t3.partner_name,t3.level
2025-06-09 01:37:11 +00:00
,t4.agent_name
,t5.user_name as duty_name
2025-05-30 08:27:52 +00:00
from project_order_info t1
left join project_info t2 on t1.project_id = t2.id
left join partner_info t3 on t1.partner_code=t3.partner_code
2025-06-09 01:37:11 +00:00
left join agent_info t4 on t2.agent_code=t4.agent_code
left join sys_user t5 on t1.duty=t5.user_id
2025-05-30 08:27:52 +00:00
</sql>
<select id= "selectProjectOrderInfoList" parameterType= "ProjectOrderInfo" resultMap= "ProjectOrderInfoResult" >
<include refid= "selectProjectOrderInfoRelationVo" />
<where >
<if test= "projectId != null " > and t1.project_id = #{projectId}</if>
2025-06-10 08:44:04 +00:00
<if test= "projectCode != null and projectCode!='' " > and t2.project_code like concat('%',#{projectCode},'%')</if>
<if test= "projectName != null and projectName!=''" > and t2.project_name like concat('%', #{projectName},'%')</if>
<if test= "customerName != null and customerName!=''" > and t2.customer_name like concat('%',#{customerName},'%')</if>
<if test= "agentName != null and agentName!=''" > and t4.agent_name like concat('%',#{agentName},'%')</if>
2025-06-04 03:25:20 +00:00
<if test= "province != null and province != ''" > and t1.province = #{province}</if>
2025-05-30 08:27:52 +00:00
<if test= "city != null and city != ''" > and t1.city = #{city}</if>
<if test= "businessPerson != null and businessPerson != ''" > and t1.business_person = #{businessPerson}</if>
<if test= "businessEmail != null and businessEmail != ''" > and t1.business_email = #{businessEmail}</if>
<if test= "businessPhone != null and businessPhone != ''" > and t1.business_phone = #{businessPhone}</if>
<if test= "orderCode != null and orderCode != ''" > and t1.order_code = #{orderCode}</if>
<if test= "currencyType != null and currencyType != ''" > and t1.currencyType = #{currencyType}</if>
<if test= "shipmentAmount != null " > and t1.shipment_amount = #{shipmentAmount}</if>
<if test= "actualPurchaseAmount != null " > and t1.actual_purchase_amount = #{actualPurchaseAmount}</if>
<if test= "orderEndTime != null " > and t1.order_end_time = #{orderEndTime}</if>
<if test= "deliveryTime != null " > and t1.delivery_time = #{deliveryTime}</if>
<if test= "companyDelivery != null and companyDelivery != ''" > and t1.company_delivery = #{companyDelivery}</if>
<if test= "notifier != null and notifier != ''" > and t1.notifier = #{notifier}</if>
<if test= "notifierEmail != null and notifierEmail != ''" > and t1.notifier_email = #{notifierEmail}</if>
<if test= "notifierPhone != null and notifierPhone != ''" > and t1.notifier_phone = #{notifierPhone}</if>
<if test= "duty != null and duty != ''" > and t1.duty = #{duty}</if>
2025-06-09 02:47:22 +00:00
<if test= "dutyName != null and dutyName != ''" > and t5.user_name like concat('%', #{dutyName}, '%')</if>
2025-05-30 08:27:52 +00:00
<if test= "dutyEmail != null and dutyEmail != ''" > and t1.duty_email = #{dutyEmail}</if>
<if test= "dutyPhone != null and dutyPhone != ''" > and t1.duty_phone = #{dutyPhone}</if>
<if test= "orderChannel != null and orderChannel != ''" > and t1.order_channel = #{orderChannel}</if>
<if test= "partnerCode != null and partnerCode != ''" > and t1.partner_code = #{partnerCode}</if>
2025-06-10 08:44:04 +00:00
<if test= "partnerName != null and partnerName != ''" > and t3.partner_name like concat('%', #{partnerName}, '%')</if>
2025-05-30 08:27:52 +00:00
<if test= "supplier != null and supplier != ''" > and t1.supplier = #{supplier}</if>
2025-06-09 02:47:22 +00:00
<if test= "supplier != null and supplier != ''" > and t1.supplier = #{supplier}</if>
2025-05-30 08:27:52 +00:00
<if test= "orderStatus != null and orderStatus != ''" > and t1.order_status = #{orderStatus}</if>
2025-06-12 03:26:43 +00:00
<if test= "deliveryTimeStart != null or deliveryTimeEnd != null" >
<choose >
<when test= "deliveryTimeStart != null and deliveryTimeEnd != null" >
and t1.delivery_time between date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test= "deliveryTimeStart != null" >
and t1.delivery_time <![CDATA[ >= ]]> date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test= "deliveryTimeEnd != null" >
and t1.delivery_time <![CDATA[ <= ]]> date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test= "estimatedOrderTimeStart != null or estimatedOrderTimeEnd != null" >
<choose >
<when test= "estimatedOrderTimeStart != null and estimatedOrderTimeEnd != null" >
and t2.estimated_order_time between date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test= "estimatedOrderTimeStart != null" >
and t2.estimated_order_time <![CDATA[ >= ]]> date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test= "estimatedOrderTimeEnd != null" >
and t2.estimated_order_time <![CDATA[ <= ]]> date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test= "orderEndTimeStart != null or orderEndTimeEnd != null" >
<choose >
<when test= "orderEndTimeStart != null and orderEndTimeEnd != null" >
and t1.order_end_time between date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test= "orderEndTimeStart != null" >
and t1.order_end_time <![CDATA[ >= ]]> date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test= "orderEndTimeEnd != null" >
and t1.order_end_time <![CDATA[ <= ]]> date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
2025-05-30 08:27:52 +00:00
</where>
</select>
<select id= "selectProjectOrderInfoById" parameterType= "Long" resultMap= "ProjectOrderInfoResult" >
<include refid= "selectProjectOrderInfoRelationVo" />
where t1.id = #{id}
</select>
<select id= "selectProjectOrderInfoByProjectId" resultType= "com.ruoyi.sip.domain.ProjectOrderInfo" >
<include refid= "selectProjectOrderInfoVo" />
where t1.project_id in (
<foreach item= "item" collection= "list" separator= "," >
#{item}
</foreach>
)
2025-06-04 03:25:20 +00:00
</select>
<select id= "selectMaxOrderCode" resultType= "java.lang.Integer" >
2025-06-06 09:47:34 +00:00
select ifnull( max(SUBSTR( order_code FROM LENGTH(#{province})+1 FOR 3 )), 0 )
2025-06-04 03:25:20 +00:00
from project_order_info
where order_code like concat(#{province}, '%')
2025-06-06 06:33:33 +00:00
</select>
<select id= "selectAgentProvinceByProjectId" resultType= "java.lang.String" >
select t2.province
from project_info t1
inner join agent_info t2 on t1.agent_code = t2.agent_code
where t1.id = #{projectId}
limit 1
2025-05-30 08:27:52 +00:00
</select>
2025-06-18 06:12:27 +00:00
<select id= "listHomePageData" resultType= "com.ruoyi.sip.dto.StatisticsDetailDto" >
select count(1) value,date_format(create_time,'%Y-%m-%d') statistics_str from project_order_info
where create_time >=DATE_SUB(CURDATE(), INTERVAL ${day} DAY)
group by date_format(create_time,'%Y-%m-%d')
</select>
2025-05-30 08:27:52 +00:00
<insert id= "insertProjectOrderInfo" parameterType= "ProjectOrderInfo" useGeneratedKeys= "true" keyProperty= "id" >
insert into project_order_info
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "projectId != null" > project_id,</if>
2025-06-04 03:25:20 +00:00
<if test= "province != null" > province,</if>
2025-05-30 08:27:52 +00:00
<if test= "city != null" > city,</if>
<if test= "businessPerson != null" > business_person,</if>
<if test= "businessEmail != null" > business_email,</if>
<if test= "businessPhone != null" > business_phone,</if>
<if test= "orderCode != null" > order_code,</if>
2025-06-19 02:22:36 +00:00
<if test= "versionCode != null" > version_code,</if>
2025-05-30 08:27:52 +00:00
<if test= "currencyType != null" > currencyType,</if>
<if test= "shipmentAmount != null" > shipment_amount,</if>
<if test= "actualPurchaseAmount != null" > actual_purchase_amount,</if>
<if test= "orderEndTime != null" > order_end_time,</if>
<if test= "deliveryTime != null" > delivery_time,</if>
<if test= "companyDelivery != null" > company_delivery,</if>
<if test= "notifier != null" > notifier,</if>
<if test= "notifierEmail != null" > notifier_email,</if>
<if test= "notifierPhone != null" > notifier_phone,</if>
<if test= "duty != null" > duty,</if>
<if test= "dutyEmail != null" > duty_email,</if>
<if test= "dutyPhone != null" > duty_phone,</if>
<if test= "orderChannel != null" > order_channel,</if>
<if test= "partnerCode != null" > partner_code,</if>
2025-06-09 01:37:11 +00:00
<if test= "partnerEmail != null" > partner_email,</if>
<if test= "partnerUserName != null" > partner_user_name,</if>
<if test= "partnerPhone != null" > partner_phone,</if>
2025-05-30 08:27:52 +00:00
<if test= "supplier != null" > supplier,</if>
<if test= "remark != null" > remark,</if>
<if test= "orderStatus != null" > order_status,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "projectId != null" > #{projectId},</if>
2025-06-04 03:25:20 +00:00
<if test= "province != null" > #{province},</if>
2025-05-30 08:27:52 +00:00
<if test= "city != null" > #{city},</if>
<if test= "businessPerson != null" > #{businessPerson},</if>
<if test= "businessEmail != null" > #{businessEmail},</if>
<if test= "businessPhone != null" > #{businessPhone},</if>
<if test= "orderCode != null" > #{orderCode},</if>
2025-06-19 02:22:36 +00:00
<if test= "versionCode != null" > #{versionCode},</if>
2025-05-30 08:27:52 +00:00
<if test= "currencyType != null" > #{currencyType},</if>
<if test= "shipmentAmount != null" > #{shipmentAmount},</if>
<if test= "actualPurchaseAmount != null" > #{actualPurchaseAmount},</if>
<if test= "orderEndTime != null" > #{orderEndTime},</if>
<if test= "deliveryTime != null" > #{deliveryTime},</if>
<if test= "companyDelivery != null" > #{companyDelivery},</if>
<if test= "notifier != null" > #{notifier},</if>
<if test= "notifierEmail != null" > #{notifierEmail},</if>
<if test= "notifierPhone != null" > #{notifierPhone},</if>
<if test= "duty != null" > #{duty},</if>
<if test= "dutyEmail != null" > #{dutyEmail},</if>
<if test= "dutyPhone != null" > #{dutyPhone},</if>
<if test= "orderChannel != null" > #{orderChannel},</if>
<if test= "partnerCode != null" > #{partnerCode},</if>
2025-06-09 01:37:11 +00:00
<if test= "partnerEmail != null" > #{partnerEmail},</if>
<if test= "partnerUserName != null" > #{partnerUserName},</if>
<if test= "partnerPhone != null" > #{partnerPhone},</if>
2025-05-30 08:27:52 +00:00
<if test= "supplier != null" > #{supplier},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "orderStatus != null" > #{orderStatus},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
</trim>
</insert>
<update id= "updateProjectOrderInfo" parameterType= "ProjectOrderInfo" >
update project_order_info
<trim prefix= "SET" suffixOverrides= "," >
<if test= "projectId != null" > project_id = #{projectId},</if>
2025-06-04 03:25:20 +00:00
<if test= "province != null" > province = #{province},</if>
2025-05-30 08:27:52 +00:00
<if test= "city != null" > city = #{city},</if>
<if test= "businessPerson != null" > business_person = #{businessPerson},</if>
<if test= "businessEmail != null" > business_email = #{businessEmail},</if>
<if test= "businessPhone != null" > business_phone = #{businessPhone},</if>
<if test= "orderCode != null" > order_code = #{orderCode},</if>
2025-06-19 02:22:36 +00:00
<if test= "versionCode != null" > version_code=#{versionCode},</if>
2025-05-30 08:27:52 +00:00
<if test= "currencyType != null" > currencyType = #{currencyType},</if>
<if test= "shipmentAmount != null" > shipment_amount = #{shipmentAmount},</if>
<if test= "actualPurchaseAmount != null" > actual_purchase_amount = #{actualPurchaseAmount},</if>
<if test= "orderEndTime != null" > order_end_time = #{orderEndTime},</if>
<if test= "deliveryTime != null" > delivery_time = #{deliveryTime},</if>
<if test= "companyDelivery != null" > company_delivery = #{companyDelivery},</if>
<if test= "notifier != null" > notifier = #{notifier},</if>
<if test= "notifierEmail != null" > notifier_email = #{notifierEmail},</if>
<if test= "notifierPhone != null" > notifier_phone = #{notifierPhone},</if>
<if test= "duty != null" > duty = #{duty},</if>
<if test= "dutyEmail != null" > duty_email = #{dutyEmail},</if>
<if test= "dutyPhone != null" > duty_phone = #{dutyPhone},</if>
<if test= "orderChannel != null" > order_channel = #{orderChannel},</if>
<if test= "partnerCode != null" > partner_code = #{partnerCode},</if>
2025-06-09 01:37:11 +00:00
<if test= "partnerEmail != null" > partner_email=#{partnerEmail},</if>
<if test= "partnerUserName != null" > partner_user_name=#{partnerUserName},</if>
<if test= "partnerPhone != null" > partner_phone=#{partnerPhone},</if>
2025-05-30 08:27:52 +00:00
<if test= "supplier != null" > supplier = #{supplier},</if>
<if test= "remark != null" > remark = #{remark},</if>
<if test= "orderStatus != null" > order_status = #{orderStatus},</if>
<if test= "createBy != null" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id= "deleteProjectOrderInfoById" parameterType= "Long" >
delete from project_order_info where id = #{id}
</delete>
<delete id= "deleteProjectOrderInfoByIds" parameterType= "String" >
delete from project_order_info where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>