add point account list api
This commit is contained in:
@@ -10,6 +10,53 @@
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectByIdAndStoreId" resultType="com.imyeyu.api.modules.gao.entity.GaoPointAccount">
|
||||
SELECT *
|
||||
FROM `gao_point_account`
|
||||
WHERE `id` = #{id}
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND `store_id` = #{storeId}
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<sql id="queryWhere">
|
||||
`a`.`deleted_at` IS NULL
|
||||
AND `c`.`deleted_at` IS NULL
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND `a`.`store_id` = #{storeId}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
`c`.`code` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `c`.`name` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `c`.`telephone` LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR `c`.`name_pinyin_full` LIKE CONCAT(#{keyword}, '%')
|
||||
OR `c`.`name_pinyin_initial` LIKE CONCAT(#{keyword}, '%')
|
||||
OR `c`.`name_pinyin_mixed` LIKE CONCAT(#{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="countByQuery" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM `gao_point_account` `a`
|
||||
INNER JOIN `gao_customer` `c` ON `c`.`id` = `a`.`customer_id` AND `c`.`store_id` = `a`.`store_id`
|
||||
WHERE
|
||||
<include refid="queryWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoPointAccount">
|
||||
SELECT `a`.*
|
||||
FROM `gao_point_account` `a`
|
||||
INNER JOIN `gao_customer` `c` ON `c`.`id` = `a`.`customer_id` AND `c`.`store_id` = `a`.`store_id`
|
||||
WHERE
|
||||
<include refid="queryWhere"/>
|
||||
ORDER BY `a`.`created_at` DESC, `a`.`id` DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<insert id="insertIfAbsent">
|
||||
INSERT INTO `gao_point_account` (
|
||||
`id`, `store_id`, `customer_id`, `balance`, `total_earned`, `total_consumed`, `total_revoked`, `total_adjusted`, `version`, `created_at`, `updated_at`, `deleted_at`
|
||||
|
||||
Reference in New Issue
Block a user