标签:info mes att sdn stat content ogr user create
<!--查按年询某个开发者下已上线的应用-->
<select id="selectAppByYearAndDevId" resultType="java.util.Map">
SELECT
app_name AS appName,
app_id As appId,
DATE_FORMAT(create_time, ‘%Y‘) AS date
FROM
aisv_g_app_info
WHERE
DATE_FORMAT(create_time, ‘%Y‘) = #{year}
AND is_del = 0
AND app_state = 5
AND developer_id = #{developerId}
</select>
<!--查按月询某个开发者下已上线的应用-->
<select id="selectAppByMonthAndDevId" resultType="java.util.Map">
SELECT
app_name AS appName,
app_id As appId,
DATE_FORMAT(create_time, ‘%Y-%m‘) AS date
FROM
aisv_g_app_info
WHERE
DATE_FORMAT(create_time, ‘%Y-%m‘) = #{month}
AND is_del = 0
AND app_state = 5
AND developer_id = #{developerId}
</select>
<!--查按周询某个开发者下已上线的应用-->
<select id="selectAppByWeekAndDevId" resultType="java.util.Map">
SELECT
app_name AS appName,
app_id As appId,
DATE_FORMAT(create_time, ‘%Y-%m-%d‘) AS date
FROM
aisv_g_app_info
WHERE
DATE_FORMAT(create_time,‘%Y-%m-%d‘) <![CDATA[ <= ]]>#{todayStr} AND
DATE_FORMAT(create_time,‘%Y-%m-%d‘)<![CDATA[ >= ]]>#{sevenDayBeforeStr}
AND is_del = 0
AND app_state = 5
AND developer_id = #{developerId}
</select>
<select id="selectListByUserOperationLogPage" resultMap="userOperationLogResult">
SELECT *
FROM
aisv_g_user_operation_log
<where>
1=1
<if test="param.userName!= null and param.userName !=‘‘">
and
user_name =#{param.userName}
</if>
<if test="param.userIp != null and param.userIp !=‘‘">
and
USER_IP =#{param.userIp }
</if>
<if test="param.operationType != null and param.operationType !=‘‘">
and
OPERATION_TYPE =#{param.operationType}
</if>
<if test="param.startdate != null and param.startdate !=‘‘">
and
OPERATION_TIME >=#{param.startdate}
</if>
<if test="param.enddate != null and param.enddate !=‘‘">
and
OPERATION_TIME <=#{param.enddate}
</if>
</where>
order by OPERATION_TIME DESC
limit #{page.begin},#{page.pageSize}
</select>
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionDate;
由于在mybatis框架的xml中<= , >=解析会出现问题,编译报错,所以需要转译
第一种写法:
原符号 < <= > >= & ’ "
替换符号 < <= > >= & ' "
例如:sql如下:
unix_timestamp(target.mc_end_date)<= unix_timestamp(#{MonthEndTime});unix_timestamp(target.mc_start_date) >= unix_timestamp(#{MonthBeginTime})
第二种写法:
大于等于
小于等于
<![CDATA[ <= ]]>例如:sql如下:
mc_end_date <![CDATA[ >= ]]> #{endTime} and mc_start_date <![CDATA[ <= ]]> #{startTime}
标签:info mes att sdn stat content ogr user create
原文地址:https://www.cnblogs.com/gavin-yao/p/10531698.html