| | |
| | | select user.department, user.name, user.account from user |
| | | where id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectDataComparisonDtoPageList" resultType="com.yuanchu.mom.dto.DataComparisonDto"> |
| | | select a.account account, |
| | | a.name name, |
| | | a.account_consumption consumption, |
| | | a.create_time createTime, |
| | | b.account comparisonAccount, |
| | | b.name comparisonName, |
| | | b.account_consumption comparisonConsumption, |
| | | b.create_time comparisonCreateTime |
| | | from (select user.account, |
| | | user.name, |
| | | dr1.account_consumption, |
| | | dr1.create_time |
| | | from data_reporting dr1 |
| | | join user on dr1.create_user = user.id |
| | | where date_format(dr1.create_time, '%Y-%m-%d') = date_format(#{dataComparisonDto.createTime}, '%Y-%m-%d') |
| | | and user.name like concat('%', #{dataComparisonDto.name}, '%')) a, |
| | | (select user.account, |
| | | user.name, |
| | | dr2.account_consumption, |
| | | dr2.create_time |
| | | from data_reporting dr2 |
| | | join user on dr2.create_user = user.id |
| | | where date_format(dr2.create_time, '%Y-%m-%d') = date_format(#{dataComparisonDto.createTime}, '%Y-%m-%d') |
| | | and user.name like concat('%', #{dataComparisonDto.comparisonName}, '%')) b |
| | | where a.account_consumption != b.account_consumption |
| | | </select> |
| | | </mapper> |