| | |
| | | *, |
| | | ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn |
| | | FROM t_data |
| | | WHERE county=#{county} or #{county}=0 AND del_flag = 0 |
| | | WHERE del_flag = 0 |
| | | <if test="county!=null and county !=0"> |
| | | and county=#{county} |
| | | </if> |
| | | ) |
| | | SELECT |
| | | create_time, |
| | |
| | | <if test="name!=null and ''!=name"> |
| | | and creator.name like concat('%',#{name},'%') |
| | | </if> |
| | | order by d.create_time desc |
| | | </select> |
| | | <select id="beforeOne" resultType="com.cl.pojo.entity.DataEntity"> |
| | | |
| | |
| | | *, |
| | | ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn |
| | | FROM t_data |
| | | WHERE county=#{county} or #{county}=0 AND del_flag = 0 |
| | | WHERE |
| | | del_flag = 0 |
| | | <if test="county!=null and county!=0"> |
| | | and county=#{county} |
| | | </if> |
| | | |
| | | ) |
| | | SELECT |
| | | create_time, |
| | |
| | | FROM latest_records |
| | | WHERE rn = 1; |
| | | </select> |
| | | <select id="getYearList" resultType="java.lang.Integer"> |
| | | SELECT |
| | | DISTINCT YEAR(create_time) AS year |
| | | FROM |
| | | t_data |
| | | where |
| | | del_flag=0 |
| | | <if test="county!=null and county!=0"> |
| | | and county=#{county} |
| | | </if> |
| | | ORDER BY |
| | | year ASC; |
| | | </select> |
| | | <select id="getAssistiveDeviceTotal" resultType="java.lang.Integer"> |
| | | WITH latest_records AS ( |
| | | SELECT |
| | | assistive_device_total, |
| | | ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn |
| | | FROM t_data |
| | | WHERE |
| | | del_flag = 0 |
| | | AND create_time < #{createTime} |
| | | <if test="county != null and county != 0"> |
| | | AND county = #{county} |
| | | </if> |
| | | ) |
| | | SELECT |
| | | COALESCE(SUM(assistive_device_total), 0) AS total_sum |
| | | FROM latest_records |
| | | WHERE rn = 1 |
| | | </select> |
| | | </mapper> |