8 changed files with 572 additions and 0 deletions
@ -0,0 +1,54 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.result.StartupPageResultDTO; |
|||
import com.elink.esua.epdc.service.StartupPageService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("startup") |
|||
public class StartupController { |
|||
|
|||
@Autowired |
|||
private StartupPageService startupPageService; |
|||
|
|||
/** |
|||
* @Description 获取欢迎页信息 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/25 |
|||
* @Param [] |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.dto.result.StartupPageResultDTO> |
|||
**/ |
|||
@GetMapping("getStartupPage") |
|||
public Result<StartupPageResultDTO> getStartupPage(){ |
|||
StartupPageResultDTO data = startupPageService.getStartupPage(); |
|||
return new Result<StartupPageResultDTO>().ok(data); |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.StartupPageDTO; |
|||
import com.elink.esua.epdc.service.StartupPageService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("startuppage") |
|||
public class StartupPageController { |
|||
|
|||
@Autowired |
|||
private StartupPageService startupPageService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<StartupPageDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<StartupPageDTO> page = startupPageService.listPage(params); |
|||
return new Result<PageData<StartupPageDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<StartupPageDTO> get(@PathVariable("id") String id){ |
|||
StartupPageDTO data = startupPageService.get(id); |
|||
return new Result<StartupPageDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody StartupPageDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
startupPageService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody StartupPageDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
startupPageService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
startupPageService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.elink.esua.epdc.controller.v2; |
|||
|
|||
import com.elink.esua.epdc.commons.api.version.ApiVersion; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.result.StartupPageResultDTO; |
|||
import com.elink.esua.epdc.service.StartupPageService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author songyunpeng |
|||
* @Description 启动页管理 v2 |
|||
* @create 2020-05-18 |
|||
*/ |
|||
@ApiVersion(2) |
|||
@RestController |
|||
@RequestMapping("startup" + Constant.VERSION_CONTROL) |
|||
public class ApiStartupV2Controller { |
|||
|
|||
@Autowired |
|||
private StartupPageService startupPageService; |
|||
|
|||
/** |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.dto.result.StartupPageResultDTO> |
|||
* @Description 获取欢迎页信息 v2 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/25 |
|||
* @Param [] |
|||
**/ |
|||
@GetMapping("getStartupPage") |
|||
public Result<List<StartupPageResultDTO>> getStartupPage() { |
|||
List<StartupPageResultDTO> data = startupPageService.getStartupPageV2(); |
|||
return new Result<List<StartupPageResultDTO>>().ok(data); |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.StartupPageDTO; |
|||
import com.elink.esua.epdc.dto.result.StartupPageResultDTO; |
|||
import com.elink.esua.epdc.entity.StartupPageEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
@Mapper |
|||
public interface StartupPageDao extends BaseDao<StartupPageEntity> { |
|||
/** |
|||
* @Description pc端获取列表 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [params] |
|||
* @return java.util.List<com.elink.esua.dto.StartupPageDTO> |
|||
**/ |
|||
List<StartupPageDTO> selectListOfStartupPageDTO(Map<String, Object> params); |
|||
/** |
|||
* @Description 获取欢迎页信息 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [] |
|||
* @return com.elink.esua.dto.StartupPageDTO |
|||
**/ |
|||
StartupPageResultDTO getStartupPage(); |
|||
/** |
|||
* @Description 获取欢迎页信息 v2 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [] |
|||
* @return com.elink.esua.dto.StartupPageDTO |
|||
**/ |
|||
List<StartupPageResultDTO> getStartupPageV2(); |
|||
} |
@ -0,0 +1,63 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_startup_page") |
|||
public class StartupPageEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
/** |
|||
* 图片地址 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 停留时长 单位:秒 |
|||
*/ |
|||
private Integer duration; |
|||
|
|||
/** |
|||
* 启用标识 0:否,1:是 |
|||
*/ |
|||
private String enableFlag; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.StartupPageDTO; |
|||
import com.elink.esua.epdc.dto.result.StartupPageResultDTO; |
|||
import com.elink.esua.epdc.entity.StartupPageEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
public interface StartupPageService extends BaseService<StartupPageEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<StartupPageDTO> |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
PageData<StartupPageDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<StartupPageDTO> |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
List<StartupPageDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return StartupPageDTO |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
StartupPageDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
void save(StartupPageDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
void update(StartupPageDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-24 |
|||
*/ |
|||
void delete(String[] ids); |
|||
/** |
|||
* @Description pcd端查看l列表 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [params] |
|||
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.dto.StartupPageDTO> |
|||
**/ |
|||
PageData<StartupPageDTO> listPage(Map<String, Object> params); |
|||
/** |
|||
* @Description 获取欢迎页信息 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [] |
|||
* @return com.elink.esua.dto.StartupPageResultDTO |
|||
**/ |
|||
StartupPageResultDTO getStartupPage(); |
|||
/** |
|||
* @return com.elink.esua.dto.StartupPageResultDTO |
|||
* @Description 获取欢迎页信息 v2 |
|||
* @Author songyunpeng |
|||
* @Date 2020/3/24 |
|||
* @Param [] |
|||
**/ |
|||
List<StartupPageResultDTO> getStartupPageV2(); |
|||
} |
@ -0,0 +1,124 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.dao.StartupPageDao; |
|||
import com.elink.esua.epdc.dto.StartupPageDTO; |
|||
import com.elink.esua.epdc.dto.result.StartupPageResultDTO; |
|||
import com.elink.esua.epdc.entity.StartupPageEntity; |
|||
import com.elink.esua.epdc.service.StartupPageService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 启动页管理 启动页管理 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2020-03-24 |
|||
*/ |
|||
@Service |
|||
public class StartupPageServiceImpl extends BaseServiceImpl<StartupPageDao, StartupPageEntity> implements StartupPageService { |
|||
|
|||
|
|||
@Override |
|||
public PageData<StartupPageDTO> page(Map<String, Object> params) { |
|||
IPage<StartupPageEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, StartupPageDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<StartupPageDTO> list(Map<String, Object> params) { |
|||
List<StartupPageEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, StartupPageDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<StartupPageEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<StartupPageEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public StartupPageDTO get(String id) { |
|||
StartupPageEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, StartupPageDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(StartupPageDTO dto) { |
|||
StartupPageEntity entity = ConvertUtils.sourceToTarget(dto, StartupPageEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(StartupPageDTO dto) { |
|||
StartupPageEntity entity = ConvertUtils.sourceToTarget(dto, StartupPageEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<StartupPageDTO> listPage(Map<String, Object> params) { |
|||
IPage<StartupPageDTO> page = getPage(params); |
|||
List<StartupPageDTO> list = baseDao.selectListOfStartupPageDTO(params); |
|||
//修改图片
|
|||
list.forEach(startupPageDTO -> { |
|||
List<String> imgList = Collections.singletonList(startupPageDTO.getImgUrl()); |
|||
startupPageDTO.setImgUrlList(imgList); |
|||
}); |
|||
return new PageData<>(list, page.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
public StartupPageResultDTO getStartupPage() { |
|||
return baseDao.getStartupPage(); |
|||
} |
|||
|
|||
@Override |
|||
public List<StartupPageResultDTO> getStartupPageV2() { |
|||
return baseDao.getStartupPageV2(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.StartupPageDao"> |
|||
|
|||
<select id="selectListOfStartupPageDTO" resultType="com.elink.esua.epdc.dto.StartupPageDTO"> |
|||
select ID,IMG_URL,DURATION,ENABLE_FLAG,REMARK,CREATED_TIME,UPDATED_TIME |
|||
from epdc_startup_page |
|||
where DEL_FLAG = '0' |
|||
order by CREATED_TIME desc |
|||
</select> |
|||
|
|||
<select id="getStartupPage" resultType="com.elink.esua.epdc.dto.result.StartupPageResultDTO"> |
|||
select ID,IMG_URL,DURATION |
|||
from epdc_startup_page |
|||
where ENABLE_FLAG = '1' and DEL_FLAG = '0' |
|||
order by UPDATED_TIME desc |
|||
limit 1 |
|||
</select> |
|||
<select id="getStartupPageV2" resultType="com.elink.esua.epdc.dto.result.StartupPageResultDTO"> |
|||
select ID,IMG_URL,DURATION |
|||
from epdc_startup_page |
|||
where ENABLE_FLAG = '1' and DEL_FLAG = '0' |
|||
order by SORT asc, UPDATED_TIME desc |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue