v1.0.3
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
CREATE TABLE IF NOT EXISTS `gao_customer` (
|
||||
`id` VARCHAR(36) NOT NULL,
|
||||
`code` VARCHAR(64) NOT NULL COMMENT '客户编码',
|
||||
`code` VARCHAR(64) NULL COMMENT '客户编码',
|
||||
`name` VARCHAR(64) NOT NULL COMMENT '姓名',
|
||||
`gender` VARCHAR(16) NULL COMMENT '性别代码,MALE 男,FEMALE 女',
|
||||
`age` INT NULL COMMENT '年龄',
|
||||
|
||||
@@ -1,29 +1,51 @@
|
||||
<?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.imyeyu.api.modules.gao.mapper.GaoCustomerMapper">
|
||||
<sql id="searchWhere">
|
||||
1 = 1
|
||||
AND `deleted_at` IS NULL
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
`code` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `name` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `telephone` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `address` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `disease` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR CAST(`conditioning_part` AS CHAR) LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="introducerCustomerId != null and introducerCustomerId != ''">
|
||||
AND `introducer_customer_id` = #{introducerCustomerId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="search" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT
|
||||
*
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
1 = 1
|
||||
AND `deleted_at` IS NULL
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
`code` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `name` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `telephone` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `address` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `disease` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR CAST(`conditioning_part` AS CHAR) LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="introducerCustomerId != null and introducerCustomerId != ''">
|
||||
AND `introducer_customer_id` = #{introducerCustomerId}
|
||||
</if>
|
||||
<include refid="searchWhere"/>
|
||||
ORDER BY `created_at` DESC
|
||||
</select>
|
||||
|
||||
<select id="countSearch" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
<include refid="searchWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="searchPage" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT
|
||||
*
|
||||
FROM `gao_customer`
|
||||
WHERE
|
||||
<include refid="searchWhere"/>
|
||||
ORDER BY `created_at` DESC
|
||||
LIMIT #{offset}, #{size}
|
||||
</select>
|
||||
|
||||
<select id="selectInvitedList" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomer">
|
||||
SELECT
|
||||
*
|
||||
|
||||
@@ -214,20 +214,66 @@
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
</select>
|
||||
|
||||
<sql id="rangeWhere">
|
||||
r.`registered_at` >= #{req.beginRegisteredAt}
|
||||
AND r.`registered_at` <= #{req.endRegisteredAt}
|
||||
AND r.`deleted_at` IS NULL
|
||||
<if test="req.customerId != null and req.customerId != ''">
|
||||
AND r.`customer_id` = #{req.customerId}
|
||||
</if>
|
||||
<if test="req.registrationEventId != null and req.registrationEventId != ''">
|
||||
AND r.`registration_event_id` = #{req.registrationEventId}
|
||||
</if>
|
||||
<if test="req.registrationEventIdList != null and req.registrationEventIdList.size() > 0">
|
||||
AND r.`registration_event_id` IN
|
||||
<foreach collection="req.registrationEventIdList" item="registrationEventId" open="(" separator="," close=")">
|
||||
#{registrationEventId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.keyword != null and req.keyword != ''">
|
||||
AND (
|
||||
c.`code` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR c.`name` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR e.`name` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR r.`remark` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR u.`name` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR u.`nick` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
OR r.`operator_user_id` LIKE CONCAT('%', #{req.keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="rangeFrom">
|
||||
FROM `gao_registration_event_record` r
|
||||
LEFT JOIN `gao_customer` c ON r.`customer_id` = c.`id`
|
||||
LEFT JOIN `gao_registration_event` e ON r.`registration_event_id` = e.`id`
|
||||
LEFT JOIN `user` u ON r.`operator_user_id` = u.`id`
|
||||
</sql>
|
||||
|
||||
<select id="selectByRange" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEventRecord">
|
||||
SELECT
|
||||
*
|
||||
FROM `gao_registration_event_record`
|
||||
r.*
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
`registered_at` >= #{req.beginRegisteredAt}
|
||||
AND `registered_at` <= #{req.endRegisteredAt}
|
||||
AND `deleted_at` IS NULL
|
||||
<if test="req.customerId != null and req.customerId != ''">
|
||||
AND `customer_id` = #{req.customerId}
|
||||
</if>
|
||||
<if test="req.registrationEventId != null and req.registrationEventId != ''">
|
||||
AND `registration_event_id` = #{req.registrationEventId}
|
||||
</if>
|
||||
ORDER BY `registered_at` DESC, `created_at` DESC
|
||||
<include refid="rangeWhere"/>
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
</select>
|
||||
|
||||
<select id="countByRange" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
<include refid="rangeWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectPageByRange" resultType="com.imyeyu.api.modules.gao.entity.GaoRegistrationEventRecord">
|
||||
SELECT
|
||||
r.*
|
||||
<include refid="rangeFrom"/>
|
||||
WHERE
|
||||
<include refid="rangeWhere"/>
|
||||
ORDER BY r.`registered_at` DESC, r.`created_at` DESC
|
||||
LIMIT #{offset}, #{size}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user