2026-06-09 21:44:31 +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.ruoyi.system.mapper.bid.BizClientMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap id="BaseRM" type="com.ruoyi.system.domain.bid.BizClient">
|
|
|
|
|
<id property="clientId" column="client_id"/>
|
|
|
|
|
<result property="tenantId" column="tenant_id"/>
|
|
|
|
|
<result property="clientNo" column="client_no"/>
|
|
|
|
|
<result property="clientName" column="client_name"/>
|
|
|
|
|
<result property="contact" column="contact"/>
|
|
|
|
|
<result property="phone" column="phone"/>
|
|
|
|
|
<result property="email" column="email"/>
|
|
|
|
|
<result property="city" column="city"/>
|
|
|
|
|
<result property="address" column="address"/>
|
|
|
|
|
<result property="grade" column="grade"/>
|
|
|
|
|
<result property="source" column="source"/>
|
|
|
|
|
<result property="status" column="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"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="selectBizClientList" resultMap="BaseRM">
|
|
|
|
|
SELECT * FROM biz_client
|
|
|
|
|
<where>
|
|
|
|
|
<if test="tenantId != null"> AND tenant_id=#{tenantId}</if>
|
|
|
|
|
<if test="clientName != null and clientName != ''">
|
|
|
|
|
AND (client_name LIKE CONCAT('%',#{clientName},'%')
|
|
|
|
|
OR client_no LIKE CONCAT('%',#{clientName},'%')
|
|
|
|
|
OR contact LIKE CONCAT('%',#{clientName},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="status != null and status != ''"> AND status=#{status}</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY client_id DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectBizClientById" resultMap="BaseRM">
|
|
|
|
|
SELECT * FROM biz_client WHERE client_id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-06-18 11:10:36 +08:00
|
|
|
<!-- 按客户编号查询(导入时判重用) -->
|
|
|
|
|
<select id="selectBizClientByNo" resultMap="BaseRM">
|
|
|
|
|
SELECT * FROM biz_client WHERE tenant_id=#{tenantId} AND client_no=#{clientNo} LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-06-09 21:44:31 +08:00
|
|
|
<insert id="insertBizClient" useGeneratedKeys="true" keyProperty="clientId">
|
|
|
|
|
INSERT INTO biz_client(tenant_id,client_no,client_name,contact,phone,email,city,address,grade,source,status,create_by,create_time)
|
|
|
|
|
VALUES(#{tenantId},#{clientNo},#{clientName},#{contact},#{phone},#{email},#{city},#{address},#{grade},#{source},#{status},#{createBy},NOW())
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateBizClient">
|
|
|
|
|
UPDATE biz_client
|
|
|
|
|
<set>
|
|
|
|
|
<if test="clientNo != null">client_no=#{clientNo},</if>
|
|
|
|
|
<if test="clientName != null">client_name=#{clientName},</if>
|
|
|
|
|
<if test="contact != null">contact=#{contact},</if>
|
|
|
|
|
<if test="phone != null">phone=#{phone},</if>
|
|
|
|
|
<if test="email != null">email=#{email},</if>
|
|
|
|
|
<if test="city != null">city=#{city},</if>
|
|
|
|
|
<if test="address != null">address=#{address},</if>
|
|
|
|
|
<if test="grade != null">grade=#{grade},</if>
|
|
|
|
|
<if test="source != null">source=#{source},</if>
|
|
|
|
|
<if test="status != null">status=#{status},</if>
|
|
|
|
|
update_by=#{updateBy}, update_time=NOW()
|
|
|
|
|
</set>
|
|
|
|
|
WHERE client_id=#{clientId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBizClientById">DELETE FROM biz_client WHERE client_id=#{id}</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBizClientByIds">
|
|
|
|
|
DELETE FROM biz_client WHERE client_id IN
|
|
|
|
|
<foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectClientDeliveryOrders" resultType="java.util.Map">
|
2026-06-18 20:17:02 +08:00
|
|
|
SELECT d.do_id AS doId,
|
|
|
|
|
d.do_no AS doNo,
|
|
|
|
|
d.delivery_date AS deliveryDate,
|
|
|
|
|
d.delay_date AS delayDate,
|
|
|
|
|
d.actual_close_date AS actualCloseDate,
|
|
|
|
|
d.delivery_status AS deliveryStatus,
|
|
|
|
|
d.total_amount AS totalAmount,
|
|
|
|
|
d.remark,
|
|
|
|
|
s.supplier_name AS supplierName,
|
|
|
|
|
(SELECT COUNT(*) FROM biz_delivery_order_item WHERE do_id = d.do_id) AS itemCount
|
|
|
|
|
FROM biz_delivery_order d
|
2026-06-09 21:44:31 +08:00
|
|
|
LEFT JOIN biz_supplier s ON d.supplier_id = s.supplier_id
|
2026-06-18 20:17:02 +08:00
|
|
|
WHERE d.client_quote_id IN (
|
|
|
|
|
SELECT cq.quote_id FROM biz_client_quote cq WHERE cq.client_id = #{clientId}
|
|
|
|
|
)
|
2026-06-09 21:44:31 +08:00
|
|
|
ORDER BY d.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|