轮播图及专题资讯

This commit is contained in:
mashuai 2023-12-04 11:09:25 +08:00
parent ab59198455
commit cb2627e375
22 changed files with 809 additions and 39 deletions

View File

@ -7,10 +7,7 @@ import com.bonus.zlpt.bigscreen.service.BmCompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 企业信息表(BmCompanyInfo)表控制层
@ -64,31 +61,57 @@ public class BmCompanyInfoController extends BaseController {
List<ColtdTypeVo> list = bmCompanyInfoService.selectColtdList();
Map<String, Map<String, ColtdVo>> map = new HashMap<>();
List<TestVo> voList = new ArrayList<>();
for (ColtdTypeVo coltdTypeVo : list) {
String companyType = coltdTypeVo.getCompanyType();
map.put(companyType, map.getOrDefault(companyType, new HashMap<>()));
map.get(companyType).putIfAbsent("自有", new ColtdVo());
map.get(companyType).putIfAbsent("在租", new ColtdVo());
map.get(companyType).putIfAbsent("待租", new ColtdVo());
ColtdVo coltdVo = map.get(companyType).get(coltdTypeVo.getMaStatus());
TestVo testVo;
String maStatus = coltdTypeVo.getMaStatus();
testVo = isExsit(companyType, voList);
if(testVo == null){
testVo = new TestVo();
voList.add(testVo);
testVo.setCompanyName(companyType);
}
ColtdVo coltdVo = getColtdVoByStatus(testVo.getColtdVo(),maStatus);
coltdVo.setCount(coltdVo.getCount()+1);
coltdVo.getList().add(new LonVo(coltdTypeVo.getMaId(), coltdTypeVo.getLon(), coltdTypeVo.getLat()));
}
return success(map);
return success(voList);
}
private ColtdVo getColtdVoByStatus(List<ColtdVo> coltdVos, String maStatus) {
for (ColtdVo coltdVo : coltdVos) {
if(maStatus.equals(coltdVo.getStatus())){
return coltdVo;
}
}
return null;
}
private TestVo isExsit(String companyType,List<TestVo> testVos) {
for (TestVo testVo : testVos) {
if(companyType.equals(testVo.getCompanyName())){
return testVo;
}
}
return null;
}
/**
* 根据时间查询设备历史经纬度
* @param time
* @param
* @return
*/
@GetMapping("/time-list/{time}")
public AjaxResult timeList(@PathVariable("time") String time) {
List<LatVo> list = bmCompanyInfoService.selectTimeList(time);
@GetMapping("/time-list/{beginTime}/{endTime}/{maId}")
public AjaxResult timeList(@PathVariable("beginTime") String beginTime,
@PathVariable("endTime") String endTime,@PathVariable("maId") String maId)
{
List<LatVo> list = bmCompanyInfoService.selectTimeList(beginTime, endTime, maId);
return success(list);
}
}

View File

@ -15,7 +15,8 @@ public class ColtdVo {
this.count = 0;
this.list = new ArrayList<>();
}
//状态
private String status;
//总数
private int count;
//经纬度

View File

@ -2,15 +2,12 @@ package com.bonus.zlpt.bigscreen.domain.vo;
import lombok.Data;
/**
* 经纬度返回类
*/
@Data
public class LatVo {
//经度
private String lon;
//
//
private String lat;
}

View File

@ -0,0 +1,38 @@
package com.bonus.zlpt.bigscreen.domain.vo;
import lombok.Data;
import java.util.*;
@Data
public class TestVo {
//企业类型
private String companyName;
private List<ColtdVo> coltdVo;
private static Set<String> set = new TreeSet<>();
static {
set.add("自有");
set.add("待租");
set.add("在租");
}
public TestVo(){
this.coltdVo = new ArrayList<>();
for (String s : set) {
ColtdVo coltdVo = new ColtdVo();
coltdVo.setStatus(s);
this.coltdVo.add(coltdVo);
}
}
public void addColtdVo(ColtdVo coltdVo){
this.coltdVo.add(coltdVo);
}
}

View File

@ -3,7 +3,9 @@ package com.bonus.zlpt.bigscreen.mapper;
import com.bonus.zlpt.bigscreen.domain.vo.CoTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.ColtdTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.LatVo;
import com.bonus.zlpt.bigscreen.domain.vo.LonVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -31,9 +33,9 @@ public interface BmCompanyInfoMapper {
/**
* 根据时间查询设备历史经纬度
* @param time
* @param
* @return
*/
List<LatVo> selectTimeList(String time);
List<LatVo> selectTimeList(@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("maId") String maId);
}

View File

@ -29,9 +29,9 @@ public interface BmCompanyInfoService {
/**
* 根据时间查询设备历史经纬度
* @param time
* @param
* @return
*/
List<LatVo> selectTimeList(String time);
List<LatVo> selectTimeList(String beginTime, String endTime, String maId);
}

View File

@ -3,6 +3,7 @@ package com.bonus.zlpt.bigscreen.service.impl;
import com.bonus.zlpt.bigscreen.domain.vo.CoTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.ColtdTypeVo;
import com.bonus.zlpt.bigscreen.domain.vo.LatVo;
import com.bonus.zlpt.bigscreen.domain.vo.LonVo;
import com.bonus.zlpt.bigscreen.mapper.BmCompanyInfoMapper;
import com.bonus.zlpt.bigscreen.service.BmCompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,12 +44,12 @@ public class BmCompanyInfoServiceImpl implements BmCompanyInfoService {
/**
* 根据时间查询设备历史经纬度
* @param time
* @param
* @return
*/
@Override
public List<LatVo> selectTimeList(String time) {
return bmCompanyInfoMapper.selectTimeList(time);
public List<LatVo> selectTimeList(String beginTime, String endTime, String maId) {
return bmCompanyInfoMapper.selectTimeList(beginTime, endTime, maId);
}
}

View File

@ -34,6 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT gh.lon AS lon, gh.lat AS lat
FROM ma_dev_info md
LEFT JOIN gps_his_info gh ON md.gps_code = gh.gps_code
WHERE gh.time = STR_TO_DATE(#{time}, '%Y.%m.%d')
<where>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and date_format( gh.time, '%Y-%m-%d' )
BETWEEN date_format( #{beginTime}, '%Y-%m-%d' )
and date_format( #{endTime}, '%Y-%m-%d' )
</if>
<if test="maId != null and maId != '' ">
and md.ma_id = #{maId}
</if>
</where>
</select>
</mapper>

View File

@ -19,6 +19,12 @@
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.bonus.zlpt</groupId>
<artifactId>zlpt-modules-file</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>

View File

@ -1,11 +1,16 @@
package com.bonus.zlpt.home.controller;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.domain.AjaxResult;
import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.file.service.FileUploadTencentService;
import com.bonus.zlpt.home.pojo.BmCarouselSet;
import com.bonus.zlpt.home.service.BmCarouselSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 轮播图配置(BmCarouselSet)表控制层
@ -15,14 +20,71 @@ import javax.annotation.Resource;
*/
@RestController
@RequestMapping("bmCarouselSet")
public class BmCarouselSetController {
public class BmCarouselSetController extends BaseController {
/**
* 服务对象
*/
@Resource
private BmCarouselSetService bmCarouselSetService;
@Resource
private FileUploadTencentService fileUploadTencentService;
/**
* 获取轮播图列表
* @param
* @return
*/
@GetMapping("/list/{carName}/{beginTime}/{endTime}")
public TableDataInfo getCarouselChartList(@PathVariable("carName") String carName, @PathVariable("beginTime") String beginTime, @PathVariable("endTime") String endTime)
{
startPage();
List<BmCarouselSet> list = bmCarouselSetService.selectBmCarouseList(carName, beginTime, endTime);
return getDataTable(list);
}
/**
* 新增轮播图信息
* @param bmCarouselSet
* @return
*/
@PostMapping
public AjaxResult addCarouselChartInfo(@RequestBody BmCarouselSet bmCarouselSet)
{
return toAjax(bmCarouselSetService.insertConfig(bmCarouselSet));
}
/**
* 根据id查询轮播图信息
* @param id
* @return
*/
@GetMapping("/{id}")
public AjaxResult getCarouselChartInfo(@PathVariable("id") String id)
{
return toAjax(bmCarouselSetService.selectListById(id));
}
/**
* 编辑轮播图信息
* @param bmCarouselSet
* @return
*/
@PutMapping
public AjaxResult updateCarouselChartInfo(@RequestBody BmCarouselSet bmCarouselSet)
{
return toAjax(bmCarouselSetService.update(bmCarouselSet));
}
/**
* 删除轮播图信息
* @param id
* @return
*/
@DeleteMapping("/{id}")
public AjaxResult delCarouselChartInfo(@PathVariable("id") String id)
{
return toAjax(bmCarouselSetService.deleteById(id));
}
}

View File

@ -0,0 +1,104 @@
package com.bonus.zlpt.home.controller;
import com.bonus.zlpt.common.core.utils.poi.ExcelUtil;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.domain.AjaxResult;
import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.common.security.utils.SecurityUtils;
import com.bonus.zlpt.home.pojo.BmCarouselSet;
import com.bonus.zlpt.home.pojo.BmTopicDto;
import com.bonus.zlpt.home.pojo.BmTopicInfo;
import com.bonus.zlpt.home.service.BmTopicInfoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 专题资讯表(BmTopicInfo)表控制层
*
* @author makejava
* @since 2023-12-04 09:48:36
*/
@RestController
@RequestMapping("bmTopicInfo")
public class BmTopicInfoController extends BaseController {
/**
* 服务对象
*/
@Resource
private BmTopicInfoService bmTopicInfoService;
/**
* 获取专题资讯列表
* @param bmTopicDto
* @return
*/
@GetMapping("/list")
public TableDataInfo getSpecialInfoList(@RequestBody BmTopicDto bmTopicDto)
{
startPage();
List<BmTopicInfo> list = bmTopicInfoService.selectSpecialInfoList(bmTopicDto);
return getDataTable(list);
}
/**
* 新增专题资讯信息
* @param bmTopicInfo
* @return
*/
@PostMapping
public AjaxResult addCarouselChartInfo(@RequestBody BmTopicInfo bmTopicInfo)
{
return toAjax(bmTopicInfoService.insertConfig(bmTopicInfo));
}
/**
* 根据id查询资讯信息
* @param id
* @return
*/
@GetMapping("/{id}")
public AjaxResult getSpecialInfo(@PathVariable("id") String id)
{
return toAjax(bmTopicInfoService.selectListById(id));
}
/**
* 编辑专题资讯信息
* @param bmTopicInfo
* @return
*/
@PutMapping
public AjaxResult updateCarouselChartInfo(@RequestBody BmTopicInfo bmTopicInfo)
{
return toAjax(bmTopicInfoService.update(bmTopicInfo));
}
/**
* 删除专题资讯信息
* @param id
* @return
*/
@DeleteMapping("/{id}")
public AjaxResult delSpecialInfo(@PathVariable("id") String id)
{
return toAjax(bmTopicInfoService.deleteById(id));
}
/**
* 导出专题资讯信息
* @param response
* @param bmTopicDto
*/
@PostMapping("/export")
public void expSpecialInfo(HttpServletResponse response, BmTopicDto bmTopicDto)
{
List<BmTopicInfo> list = bmTopicInfoService.selectSpecialInfoList(bmTopicDto);
ExcelUtil<BmTopicInfo> util = new ExcelUtil<BmTopicInfo>(BmTopicInfo.class);
util.exportExcel(response, list, "专题资讯信息");
}
}

View File

@ -1,5 +1,10 @@
package com.bonus.zlpt.home.mapper;
import com.bonus.zlpt.home.pojo.BmCarouselSet;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 轮播图配置(BmCarouselSet)表数据库访问层
*
@ -8,5 +13,39 @@ package com.bonus.zlpt.home.mapper;
*/
public interface BmCarouselSetMapper {
/**
* 获取轮播图列表
* @param
* @return
*/
List<BmCarouselSet> selectBmCarouseList(@Param("carName") String carName, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
/**
* 新增轮播图信息
* @param bmCarouselSet
* @return
*/
int insertConfig(BmCarouselSet bmCarouselSet);
/**
* 根据id查询轮播图信息
* @param id
* @return
*/
int selectListById(String id);
/**
* 编辑轮播图信息
* @param bmCarouselSet
* @return
*/
int update(BmCarouselSet bmCarouselSet);
/**
* 删除轮播图信息
* @param id
* @return
*/
int deleteById(String id);
}

View File

@ -0,0 +1,51 @@
package com.bonus.zlpt.home.mapper;
import com.bonus.zlpt.home.pojo.BmTopicDto;
import com.bonus.zlpt.home.pojo.BmTopicInfo;
import java.util.List;
/**
* 专题资讯表(BmTopicInfo)表数据库访问层
*
* @author makejava
* @since 2023-12-04 09:48:36
*/
public interface BmTopicInfoMapper {
/**
* 获取专题资讯列表
* @param bmTopicDto
* @return
*/
List<BmTopicInfo> selectSpecialInfoList(BmTopicDto bmTopicDto);
/**
* 新增专题资讯信息
* @param bmTopicInfo
* @return
*/
int insertConfig(BmTopicInfo bmTopicInfo);
/**
* 根据id查询资讯信息
* @param id
* @return
*/
int selectListById(String id);
/**
* 编辑专题资讯信息
* @param bmTopicInfo
* @return
*/
int update(BmTopicInfo bmTopicInfo);
/**
* 删除专题资讯信息
* @param id
* @return
*/
int deleteById(String id);
}

View File

@ -1,6 +1,6 @@
package pojo;
package com.bonus.zlpt.home.pojo;
import java.io.Serializable;
import com.bonus.zlpt.common.core.annotation.Excel;
import lombok.Data;
/**
@ -12,25 +12,44 @@ import lombok.Data;
@Data
@SuppressWarnings("serial")
public class BmCarouselSet {
//轮播图id
@Excel(name = "轮播图id")
private Integer id;
//轮播图名称
@Excel(name = "轮播图名称")
private String carName;
//轮播图图片地址
@Excel(name = "轮播图图片地址")
private String carUrl;
//配置类型0资讯1跳转地址考虑用数据字典管理配置轮播图类型
@Excel(name = "配置类型0资讯1跳转地址考虑用数据字典管理配置轮播图类型")
private String type;
//配置跳转地址
@Excel(name = "配置跳转地址")
private String openUrl;
//是否启用0不启用1启用
@Excel(name = "是否启用0不启用1启用")
private String status;
//创建时间
@Excel(name = "创建时间")
private String createTime;
//创建人
@Excel(name = "创建人")
private String creator;
//排序
@Excel(name = "排序")
private String sort;
//是否删除
//是否删除(0 , 1 )
@Excel(name = "是否删除(0 是, 1 否)")
private String isActive;
}

View File

@ -0,0 +1,21 @@
package com.bonus.zlpt.home.pojo;
import lombok.Data;
@Data
public class BmTopicDto {
//名称
private String topicName;
//考虑数据字典管理专题资讯类型
private Integer type;
//开始时间
private String beginTime;
//结束时间
private String endTime;
}

View File

@ -0,0 +1,50 @@
package com.bonus.zlpt.home.pojo;
import java.io.Serializable;
import com.bonus.zlpt.common.core.annotation.Excel;
import lombok.Data;
/**
* 专题资讯表(BmTopicInfo)表实体类
*
* @author makejava
* @since 2023-12-04 09:48:36
*/
@Data
@SuppressWarnings("serial")
public class BmTopicInfo {
//专题资讯id
private Integer id;
//名称
@Excel(name = "名称")
private String topicName;
//考虑数据字典管理专题资讯类型
@Excel(name = "考虑数据字典管理专题资讯类型")
private Integer type;
//浏览次数
@Excel(name = "浏览次数")
private Integer viewNum;
//内容
@Excel(name = "内容")
private String content;
//是否删除
@Excel(name = "是否删除(0 是, 1 否)")
private String isActive;
//创建人
@Excel(name = "创建人")
private Integer creator;
//创建时间
@Excel(name = "创建时间")
private String createTime;
}

View File

@ -1,5 +1,9 @@
package com.bonus.zlpt.home.service;
import com.bonus.zlpt.home.pojo.BmCarouselSet;
import java.util.List;
/**
* 轮播图配置(BmCarouselSet)表服务接口
*
@ -8,5 +12,39 @@ package com.bonus.zlpt.home.service;
*/
public interface BmCarouselSetService {
/**
* 获取轮播图列表
* @param
* @return
*/
List<BmCarouselSet> selectBmCarouseList(String carName, String beginTime, String endTime);
/**
* 新增轮播图信息
* @param bmCarouselSet
* @return
*/
int insertConfig(BmCarouselSet bmCarouselSet);
/**
* 根据id查询轮播图信息
* @param id
* @return
*/
int selectListById(String id);
/**
* 编辑轮播图信息
* @param bmCarouselSet
* @return
*/
int update(BmCarouselSet bmCarouselSet);
/**
* 删除轮播图信息
* @param id
* @return
*/
int deleteById(String id);
}

View File

@ -0,0 +1,51 @@
package com.bonus.zlpt.home.service;
import com.bonus.zlpt.home.pojo.BmTopicDto;
import com.bonus.zlpt.home.pojo.BmTopicInfo;
import java.util.List;
/**
* 专题资讯表(BmTopicInfo)表服务接口
*
* @author makejava
* @since 2023-12-04 09:48:36
*/
public interface BmTopicInfoService {
/**
* 获取专题资讯列表
* @param bmTopicDto
* @return
*/
List<BmTopicInfo> selectSpecialInfoList(BmTopicDto bmTopicDto);
/**
* 新增专题资讯信息
* @param bmTopicInfo
* @return
*/
int insertConfig(BmTopicInfo bmTopicInfo);
/**
* 根据id查询资讯信息
* @param id
* @return
*/
int selectListById(String id);
/**
* 编辑专题资讯信息
* @param bmTopicInfo
* @return
*/
int update(BmTopicInfo bmTopicInfo);
/**
* 删除专题资讯信息
* @param id
* @return
*/
int deleteById(String id);
}

View File

@ -1,8 +1,13 @@
package com.bonus.zlpt.home.service.impl;
import com.bonus.zlpt.home.mapper.BmCarouselSetMapper;
import com.bonus.zlpt.home.pojo.BmCarouselSet;
import com.bonus.zlpt.home.service.BmCarouselSetService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 轮播图配置(BmCarouselSet)表服务实现类
*
@ -12,5 +17,57 @@ import org.springframework.stereotype.Service;
@Service("bmCarouselSetService")
public class BmCarouselSetServiceImpl implements BmCarouselSetService {
@Resource
private BmCarouselSetMapper bmCarouselSetMapper;
/**
* 获取轮播图列表
* @param
* @return
*/
@Override
public List<BmCarouselSet> selectBmCarouseList(String carName, String beginTime, String endTime) {
return bmCarouselSetMapper.selectBmCarouseList(carName, beginTime, endTime);
}
/**
* 新增轮播图信息
* @param bmCarouselSet
* @return
*/
@Override
public int insertConfig(BmCarouselSet bmCarouselSet) {
return bmCarouselSetMapper.insertConfig(bmCarouselSet);
}
/**
* 根据id查询轮播图信息
* @param id
* @return
*/
@Override
public int selectListById(String id) {
return bmCarouselSetMapper.selectListById(id);
}
/**
* 编辑轮播图信息
* @param bmCarouselSet
* @return
*/
@Override
public int update(BmCarouselSet bmCarouselSet) {
return bmCarouselSetMapper.update(bmCarouselSet);
}
/**
* 删除轮播图信息
* @param id
* @return
*/
@Override
public int deleteById(String id) {
return bmCarouselSetMapper.deleteById(id);
}
}

View File

@ -0,0 +1,73 @@
package com.bonus.zlpt.home.service.impl;
import com.bonus.zlpt.home.mapper.BmTopicInfoMapper;
import com.bonus.zlpt.home.pojo.BmTopicDto;
import com.bonus.zlpt.home.pojo.BmTopicInfo;
import com.bonus.zlpt.home.service.BmTopicInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 专题资讯表(BmTopicInfo)表服务实现类
*
* @author makejava
* @since 2023-12-04 09:48:36
*/
@Service("bmTopicInfoService")
public class BmTopicInfoServiceImpl implements BmTopicInfoService {
@Resource
private BmTopicInfoMapper bmTopicInfoMapper;
/**
* 获取专题资讯列表
* @param bmTopicDto
* @return
*/
@Override
public List<BmTopicInfo> selectSpecialInfoList(BmTopicDto bmTopicDto) {
return bmTopicInfoMapper.selectSpecialInfoList(bmTopicDto);
}
/**
* 新增专题资讯信息
* @param bmTopicInfo
* @return
*/
@Override
public int insertConfig(BmTopicInfo bmTopicInfo) {
return bmTopicInfoMapper.insertConfig(bmTopicInfo);
}
/**
* 根据id查询资讯信息
* @param id
* @return
*/
@Override
public int selectListById(String id) {
return bmTopicInfoMapper.selectListById(id);
}
/**
* 编辑专题资讯信息
* @param bmTopicInfo
* @return
*/
@Override
public int update(BmTopicInfo bmTopicInfo) {
return bmTopicInfoMapper.update(bmTopicInfo);
}
/**
* 删除专题资讯信息
* @param id
* @return
*/
@Override
public int deleteById(String id) {
return bmTopicInfoMapper.deleteById(id);
}
}

View File

@ -0,0 +1,65 @@
<?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.bonus.zlpt.home.mapper.BmCarouselSetMapper">
<sql id="selectBmCarouseVo">
select id, car_name, car_url, type, open_url, status, create_time, creator, sort, is_active
from bm_carousel_set
</sql>
<insert id="insertConfig">
insert into bm_carousel_set (
<if test="carName != null and carName != '' ">car_name,</if>
<if test="carUrl != null and carUrl != '' ">car_url,</if>
<if test="openUrl != null and openUrl != '' ">open_url,</if>
<if test="status != null and status != '' ">status,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="sort != null and sort != ''">sort,</if>
create_time
)values(
<if test="carName != null and carName != ''">#{carName},</if>
<if test="carUrl != null and carUrl != ''">#{carUrl},</if>
<if test="openUrl != null and openUrl != ''">#{openUrl},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="sort != null and sort != ''">#{sort},</if>
sysdate()
)
</insert>
<update id="update">
update bm_carousel_set
<set>
<if test="id != null and id != ''">id = #{id},</if>
<if test="carName != null and carName != ''">car_name = #{carName},</if>
<if test="carUrl != null and carUrl != ''">car_url = #{carUrl},</if>
<if test="openUrl != null and openUrl != ''">open_url = #{openUrl},</if>
<if test="status != null and status != ''">status = #{status},</if>
</set>
</update>
<delete id="deleteById">
update bm_carousel_set set is_active = '0' where id = #{id}
</delete>
<select id="selectBmCarouseList" resultType="com.bonus.zlpt.home.pojo.BmCarouselSet">
<include refid="selectBmCarouseVo"/>
<where>
<if test="carName != null and carName != ''">
AND car_name like concat('%', #{carName}, '%')
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and date_format( create_time, '%Y-%m-%d' )
BETWEEN date_format( #{beginTime}, '%Y-%m-%d' )
and date_format( #{endTime}, '%Y-%m-%d' )
</if>
</where>
</select>
<select id="selectListById" resultType="java.lang.Integer">
<include refid="selectBmCarouseVo"/>
where id = #{id}
</select>
</mapper>

View File

@ -0,0 +1,63 @@
<?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.bonus.zlpt.home.mapper.BmTopicInfoMapper">
<sql id="selectBmTopicVo">
select id, topic_name, type, view_num, content, is_active, creator, create_time
from bm_topic_info
</sql>
<insert id="insertConfig">
insert into bm_topic_info (
<if test="topicName != null and topicName != '' ">topic_name,</if>
<if test="type != null and type != '' ">type,</if>
<if test="viewNum != null and viewNum != '' ">view_num,</if>
<if test="content != null and content != '' ">content,</if>
<if test="creator != null and creator != ''">creator,</if>
create_time
)values(
<if test="topicName != null and topicName != ''">#{topicName},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="viewNum != null and viewNum != ''">#{openUrl},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="creator != null and creator != ''">#{creator},</if>
sysdate()
)
</insert>
<update id="update">
update bm_topic_info
<set>
<if test="id != null and id != ''">id = #{id},</if>
<if test="topicName != null and topicName != ''">topic_name = #{topicName},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="viewNum != null and viewNum != ''">view_num = #{viewNum},</if>
<if test="content != null and content != ''">content = #{content},</if>
</set>
</update>
<delete id="deleteById">
update bm_topic_info set is_active = '0' where id = #{id}
</delete>
<select id="selectListById" resultType="java.lang.Integer">
<include refid="selectBmTopicVo"/>
where id = #{id}
</select>
<select id="selectSpecialInfoList" resultType="com.bonus.zlpt.home.pojo.BmTopicInfo">
<include refid="selectBmTopicVo"/>
<where>
<if test="topicName != null and topicName != ''">
AND topic_name like concat('%', #{topicName}, '%')
</if>
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
and date_format( create_time, '%Y-%m-%d' )
BETWEEN date_format( #{beginTime}, '%Y-%m-%d' )
and date_format( #{endTime}, '%Y-%m-%d' )
</if>
</where>
</select>
</mapper>