lin
2024-03-14 cae3b043d8a8a08e176839d0c23a4432e5d9f5f4
Merge remote-tracking branch 'origin/master'
6 files modified
96 ■■■■■ changed files
pom.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rotation/entity/RotationEntity.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java 7 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java 23 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/rotation/vo/RotationVO.java 10 ●●●●● patch | view | raw | blame | history
pom.xml
@@ -328,6 +328,13 @@
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>
        </plugins>
    </build>
src/main/java/org/springblade/modules/rotation/entity/RotationEntity.java
@@ -59,10 +59,10 @@
    @ApiModelProperty(value = "名称")
    private String name;
    /**
     * 类型 1:系统  2:社区
     * 类型 3:系统 1:公安 2:综治
     */
    @ApiModelProperty(value = "类型 1:系统  2:社区")
    private String type;
    @ApiModelProperty(value = "类型 3:系统 1:公安 2:综治")
    private Integer type;
    /**
     * 内容
     */
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.java
@@ -36,9 +36,14 @@
     *
     * @param page
     * @param rotation
     * @param isAdministrator
     * @return
     */
    List<RotationVO> selectRotationPage(IPage page,@Param("rotation") RotationVO rotation);
    List<RotationVO> selectRotationPage(IPage page,
                                        @Param("rotation") RotationVO rotation,
                                        @Param("isAdministrator") Integer isAdministrator,
                                        @Param("regionChildCodesList") String regionChildCodesList,
                                        @Param("gridCodeList") String gridCodeList);
}
src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
@@ -34,6 +34,49 @@
        <if test="rotation.regionCode!=null and rotation.regionCode!=''">
            and jr.community_code like concat('%',#{rotation.regionCode},'%')
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="rotation.roleName != null and rotation.roleName != ''">
                    <if test="rotation.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList !=''">
                                and jr.type = 2
                                and jr.community_code REGEXP #{gridCodeList}
                            </when>
                            <otherwise>
                                and jr.type = 2
                                and jr.community_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="rotation.roleName=='mj'">
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList!=''">
                                and jr.type = 1
                                and jr.community_code REGEXP #{regionChildCodesList}
                            </when>
                            <otherwise>
                                and jr.type = 1
                                and jr.community_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="rotation.roleName=='inhabitant'">
                        and jr.type = 3
                    </if>
                </when>
                <otherwise>
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList!=''">
                            and jr.community_code REGEXP #{regionChildCodesList}
                        </when>
                        <otherwise>
                            and jr.community_code in ('')
                        </otherwise>
                    </choose>
                </otherwise>
            </choose>
        </if>
    </select>
src/main/java/org/springblade/modules/rotation/service/impl/RotationServiceImpl.java
@@ -17,6 +17,7 @@
package org.springblade.modules.rotation.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.param.CommonParamSet;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.rotation.entity.RotationEntity;
import org.springblade.modules.rotation.vo.RotationVO;
@@ -28,6 +29,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 轮播图 服务实现类
@@ -51,11 +54,21 @@
     */
    @Override
    public IPage<RotationVO> selectRotationPage(IPage<RotationVO> page, RotationVO rotation) {
//        Dept dept = deptService.getById(AuthUtil.getDeptId());
//        if (null!=dept && !AuthUtil.isAdministrator()){
//            rotation.setRegionCode(dept.getRegionCode());
//        }
        return page.setRecords(baseMapper.selectRotationPage(page, rotation));
        CommonParamSet<Object> commonParamSet = new CommonParamSet<>().invoke(RotationVO.class,rotation);
        List<RotationVO> rotationVOList = baseMapper.selectRotationPage(page, rotation,
            commonParamSet.getIsAdministrator(),
            null==commonParamSet.getRegionChildCodesList()?null:String.join("|",commonParamSet.getRegionChildCodesList()),
            null==commonParamSet.getGridCodeList()?null:String.join("|",commonParamSet.getGridCodeList()));
        if (rotationVOList.size()==0){
            // 如果没有对应的轮播图,则采用系统默认的
            rotation.setType(3);
            rotationVOList = baseMapper.selectRotationPage(page,
                rotation,
                1,
                null==commonParamSet.getRegionChildCodesList()?null:String.join("|",commonParamSet.getRegionChildCodesList()),
                null==commonParamSet.getGridCodeList()?null:String.join("|",commonParamSet.getGridCodeList()));
        }
        return page.setRecords(rotationVOList);
    }
src/main/java/org/springblade/modules/rotation/vo/RotationVO.java
@@ -42,4 +42,14 @@
     */
    private String communityName;
    /**
     * 社区编号
     */
    private String communityCode;
    /**
     * 角色别名
     */
    private String roleName;
}