Helius
2021-11-02 6a9755ef19272956bfedbd0a49756edfc6cef4a1
add numOfPeople rank
4 files modified
61 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml 46 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java
@@ -86,4 +86,14 @@
        achieveNew.setT1(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(achieveNewDao.selectBeauticianConsumeAchieveRanking(achieveNew));
    }
    @ApiOperation(value = "人头数排名", notes = "人头数排名")
    @PostMapping(value = "/findNumOfPeopleRanking")
    public AjaxResult findNumOfPeopleRanking(@RequestBody RankingDto rankingDto) {
        AchieveNew achieveNew = new AchieveNew();
        QueryUtil.setQueryLimitCom(achieveNew);
        achieveNew.setDatatime(new Date());
        achieveNew.setT1(rankingDto.getType());
        return AjaxResult.buildSuccessInstance(achieveNewDao.selectNumOfPeopleAchieveRanking(achieveNew));
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java
@@ -18,11 +18,12 @@
    public static final String DAY = "1";
    public static final String MONTH = "2";
    public static final String YEAR = "3";
    public static final String WEEK = "4";
    @ApiModelProperty(value = "数据类型 1-销售 2-消耗", example = "1")
    private String dataType;
    @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜", example = "1")
    @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜 4-周榜", example = "1")
    private String type;
    public String getDataType() {
zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -91,4 +91,6 @@
    IPage<AchieveNewStatisticsVo> achieveNewStatistics(Page<AchieveNewStatisticsVo> page,  @Param("record")AchieveNewStatisticsDto queryDto);
     void setPayMethod(@Param("paymethod") String paymethod, @Param("list")  ArrayList<Long> ids);
     List<RankingVo> selectNumOfPeopleAchieveRanking(@Param("record") AchieveNew achieveNew);
}
zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -989,6 +989,9 @@
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.shop_id
        order by amount desc, a.shop_id
@@ -1020,6 +1023,9 @@
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.beault_id
@@ -1066,6 +1072,9 @@
            <if test='record.type == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by b.su_id
        order by amount desc, b.su_id
@@ -1092,6 +1101,9 @@
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(a.create_time, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.shop_id
@@ -1193,4 +1205,38 @@
    </update>
    <select id="selectNumOfPeopleAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo">
        select
        b.su_name name,
        b.su_id id,
        b.su_photo photo,
        sum(number_of_people) amount,
        c.shop_short_name shopName
        from achieve_new a
        inner join sys_users b on a.beault_id=b.su_id
        left join sys_shop_info c on a.shop_id=c.ID
        <where>
            <if test="record.companyId != null">
                and a.company_id=#{record.companyId}
            </if>
            <if test="record.shopId != null">
                and a.shop_id=#{record.shopId}
            </if>
            <if test='record.t1 == "1" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d') = date_format(#{record.datatime}, '%Y-%m-%d')
            </if>
            <if test='record.t1 == "2" and record.datatime != null'>
                and date_format(datatime, '%Y-%m') = date_format(#{record.datatime}, '%Y-%m')
            </if>
            <if test='record.t1 == "3" and record.datatime != null'>
                and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
            </if>
            <if test='record.t1 == "4" and record.datatime != null'>
                and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u')
            </if>
        </where>
        group by a.beault_id
        order by amount desc
    </select>
</mapper>