BUGFIX:便利查询

This commit is contained in:
2024-04-22 13:09:44 +08:00
parent 540d2a4e28
commit a749c5dd2e
3 changed files with 60 additions and 22 deletions

View File

@@ -4,30 +4,45 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ai.da.mapper.primary.entity.Design">
<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" />
<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"/>
</resultMap>
<insert id="insertDesign" parameterType="com.ai.da.mapper.primary.entity.Design" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
<insert id="insertDesign" parameterType="com.ai.da.mapper.primary.entity.Design" useGeneratedKeys="true"
keyProperty="id" keyColumn="id">
insert into t_design
(account_id,collection_id,system_scale,single_overall,switch_category,create_date)
values(
#{accountId},
#{collectionId},
#{systemScale},
#{singleOverall},
#{switchCategory},
#{createDate});
(account_id, collection_id, system_scale, single_overall, switch_category, create_date)
values (#{accountId},
#{collectionId},
#{systemScale},
#{singleOverall},
#{switchCategory},
#{createDate});
</insert>
<select id="getDesignStatistic" resultType="com.ai.da.model.dto.UserDesignStatisticDTO" parameterType="String">
select a.account_id,count(a.account_id) use_design_times,b.user_email,b.user_name,b.is_trial
select d.*,c.id trialOrderId, c.title,c.surname,c.given_name,c.country,c.occupation,c.create_time
from (
select b.account_id,count(b.account_id) design_times,a.user_name,a.user_email,a.is_trial
from t_account a
left join t_design b on a.id = b.account_id
<where>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
b.create_date between #{startTime} and #{endTime}
</if>
</where>
and b.create_date not like '%:01'
and b.create_date not like '%:02'
GROUP BY b.account_id
ORDER BY b.account_id asc) d
left join trial_order c on d.user_email = c.email
<!--select a.account_id,count(a.account_id) use_design_times,b.user_email,b.user_name,b.is_trial
from `t_account` b
left join t_design a
on a.account_id = b.id
@@ -37,7 +52,7 @@
</if>
</where>
GROUP BY a.account_id
ORDER BY a.account_id ASC;
ORDER BY a.account_id ASC;-->
</select>
</mapper>