Files
aida_back/src/main/resources/mapper/primary/DesignMapper.xml

76 lines
3.2 KiB
XML
Raw Normal View History

2024-01-19 16:36:34 +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.ai.da.mapper.primary.DesignMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ai.da.mapper.primary.entity.Design">
2024-04-22 13:09:44 +08:00
<id column="id" property="id"/>
<result column="account_id" property="accountId"/>
<result column="collection_id" property="collectionId"/>
<result column="system_scale" property="systemScale"/>
<result column="single_overall" property="singleOverall"/>
<result column="switch_category" property="switchCategory"/>
<result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate"/>
2024-01-19 16:36:34 +08:00
</resultMap>
2024-04-22 13:09:44 +08:00
<insert id="insertDesign" parameterType="com.ai.da.mapper.primary.entity.Design" useGeneratedKeys="true"
keyProperty="id" keyColumn="id">
2024-01-19 16:36:34 +08:00
insert into t_design
2024-04-22 13:09:44 +08:00
(account_id, collection_id, system_scale, single_overall, switch_category, create_date)
values (#{accountId},
#{collectionId},
#{systemScale},
#{singleOverall},
#{switchCategory},
#{createDate});
2024-01-19 16:36:34 +08:00
</insert>
<select id="getDesignStatistic" resultType="com.ai.da.model.dto.UserDesignStatisticDTO" parameterType="String">
select d.*,c.id trialOrderId
2024-04-22 13:09:44 +08:00
from (
select b.account_id,count(b.account_id) design_times,a.user_name,a.user_email,a.is_trial,a.credits,
a.title,a.surname,a.given_name,a.country,a.occupation,a.create_date
2024-04-22 13:09:44 +08:00
from t_account a
left join t_design b on a.id = b.account_id
<where>
<choose>
<when test="role == 'corp'">
a.system_user IN (5, 6)
</when>
<when test="role == 'edu'">
a.system_user IN (7, 8)
</when>
<when test="role == 'prsn'">
a.system_user IN (0, 1, 2, 3, 4)
</when>
</choose>
2024-04-22 13:09:44 +08:00
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND b.create_date between #{startTime} and #{endTime}
2024-04-22 13:09:44 +08:00
</if>
</where>
and b.create_date not like '%:01'
and b.create_date not like '%:02'
<if test="ids != null and ids.size() > 0">
and a.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="email != null and email != '' ">
and a.user_email like CONCAT('%', #{email}, '%')
</if>
2024-04-22 13:09:44 +08:00
GROUP BY b.account_id
ORDER BY b.account_id asc) d
left join trial_order c on d.user_email = c.email
</select>
2025-03-16 13:09:50 +08:00
<select id="selectDeleteList" resultType="com.ai.da.mapper.primary.entity.Design">
SELECT * FROM t_design
WHERE collection_id not IN
(SELECT collection_id FROM t_user_like_group
WHERE collection_id != 0
GROUP BY collection_id)
</select>
2024-01-19 16:36:34 +08:00
</mapper>