Commit 74da8c69 authored by 冷玲鹏's avatar 冷玲鹏

修改(新建):banner管理、活动管理、公告管理

parent f22e2cf6
package org.rcisoft.business.syscontentnewsinformation.controller; package org.rcisoft.business.cmsActivity.controller;
/*固定导入*/ /*固定导入*/
...@@ -6,8 +6,8 @@ package org.rcisoft.business.syscontentnewsinformation.controller; ...@@ -6,8 +6,8 @@ package org.rcisoft.business.syscontentnewsinformation.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation; import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.syscontentnewsinformation.service.SysContentNewsInformationService; import org.rcisoft.business.cmsActivity.service.CmsActivityService;
import org.rcisoft.core.anno.CyOpeLogAnno; import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons; import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController; import org.rcisoft.core.controller.CyPaginationController;
...@@ -31,23 +31,23 @@ import java.util.List; ...@@ -31,23 +31,23 @@ import java.util.List;
* @date 2024年3月25日 下午1:42:40 * @date 2024年3月25日 下午1:42:40
*/ */
@RestController @RestController
@RequestMapping("/syscontentnewsinformation") @RequestMapping("/cmsActivity")
public class SysContentNewsInformationController extends CyPaginationController<SysContentNewsInformation> { public class CmsActivityController extends CyPaginationController<CmsActivity> {
@Autowired @Autowired
private SysContentNewsInformationService sysContentNewsInformationServiceImpl; private CmsActivityService cmsActivityServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:increase')") @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:increase')")
@CyOpeLogAnno(title = "system-新闻资讯管理-新增新闻资讯", businessType = CyLogTypeEnum.INSERT) @CyOpeLogAnno(title = "system-新闻资讯管理-新增新闻资讯", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value = "添加新闻资讯", notes = "添加新闻资讯") @ApiOperation(value = "添加新闻资讯", notes = "添加新闻资讯")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public CyResult add(@Valid SysContentNewsInformation sysContentNewsInformation, BindingResult bindingResult) { public CyResult add(@Valid CmsActivity cmsActivity, BindingResult bindingResult) {
CyPersistModel data = sysContentNewsInformationServiceImpl.persist(sysContentNewsInformation); CyPersistModel data = cmsActivityServiceImpl.persist(cmsActivity);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
sysContentNewsInformation); cmsActivity);
} }
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:removing')") @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:removing')")
...@@ -55,9 +55,9 @@ public class SysContentNewsInformationController extends CyPaginationController< ...@@ -55,9 +55,9 @@ public class SysContentNewsInformationController extends CyPaginationController<
@ApiOperation(value = "删除新闻资讯", notes = "删除新闻资讯") @ApiOperation(value = "删除新闻资讯", notes = "删除新闻资讯")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}") @DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable Integer businessId, SysContentNewsInformation sysContentNewsInformation) { public CyResult delete(@PathVariable Integer businessId, CmsActivity cmsActivity) {
sysContentNewsInformation.setBusinessId(businessId); cmsActivity.setBusinessId(businessId);
CyPersistModel data = sysContentNewsInformationServiceImpl.remove(sysContentNewsInformation); CyPersistModel data = cmsActivityServiceImpl.remove(cmsActivity);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
...@@ -69,13 +69,13 @@ public class SysContentNewsInformationController extends CyPaginationController< ...@@ -69,13 +69,13 @@ public class SysContentNewsInformationController extends CyPaginationController<
@ApiOperation(value = "修改新闻资讯", notes = "修改新闻资讯") @ApiOperation(value = "修改新闻资讯", notes = "修改新闻资讯")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping("/update/{businessId:\\w+}") @PostMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable Integer businessId, @Valid SysContentNewsInformation sysContentNewsInformation, BindingResult bindingResult) { public CyResult update(@PathVariable Integer businessId, @Valid CmsActivity cmsActivity, BindingResult bindingResult) {
sysContentNewsInformation.setBusinessId(businessId); cmsActivity.setBusinessId(businessId);
CyPersistModel data = sysContentNewsInformationServiceImpl.merge(sysContentNewsInformation); CyPersistModel data = cmsActivityServiceImpl.merge(cmsActivity);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
sysContentNewsInformation); cmsActivity);
} }
// @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:singleSearch')") // @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:singleSearch')")
...@@ -87,27 +87,27 @@ public class SysContentNewsInformationController extends CyPaginationController< ...@@ -87,27 +87,27 @@ public class SysContentNewsInformationController extends CyPaginationController<
return CyResultGenUtil.builder(new CyPersistModel(1), return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
sysContentNewsInformationServiceImpl.findById(businessId)); cmsActivityServiceImpl.findById(businessId));
} }
//@PreAuthorize("@cyPerm.hasPerm('sys:contentNewsInformation:list')") //@PreAuthorize("@cyPerm.hasPerm('sys:contentNewsInformation:list')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY) @CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "查询新闻资讯集合", notes = "查询新闻资讯集合") @ApiOperation(value = "查询新闻资讯集合", notes = "查询新闻资讯集合")
@GetMapping(value = "/querySysContentNewsInformations") @GetMapping(value = "/queryCmsActivity")
public CyResult querySysContentNewsInformations(SysContentNewsInformation sysContentNewsInformation) { public CyResult querySysContentNewsInformations(CmsActivity cmsActivity) {
return CyResultGenUtil.builder(new CyPersistModel(1), return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
sysContentNewsInformationServiceImpl.findAll(sysContentNewsInformation)); cmsActivityServiceImpl.findAll(cmsActivity));
} }
// @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:pageSearch')") // @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:pageSearch')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY) @CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "分页查询新闻资讯集合", notes = "分页查询新闻资讯集合") @ApiOperation(value = "分页查询新闻资讯集合", notes = "分页查询新闻资讯集合")
@GetMapping(value = "/querySysContentNewsInformationByPagination") @GetMapping(value = "/queryCmsActivityByPagination")
public CyGridModel listByPagination(SysContentNewsInformation sysContentNewsInformation) { public CyGridModel listByPagination(CmsActivity cmsActivity) {
sysContentNewsInformationServiceImpl.findAllByPagination(getPaginationUtility(), sysContentNewsInformation); cmsActivityServiceImpl.findAllByPagination(getPaginationUtility(), cmsActivity);
return getGridModelResponse(); return getGridModelResponse();
} }
...@@ -117,18 +117,18 @@ public class SysContentNewsInformationController extends CyPaginationController< ...@@ -117,18 +117,18 @@ public class SysContentNewsInformationController extends CyPaginationController<
@ApiOperation(value = "修改新闻资讯状态", notes = "修改新闻资讯状态") @ApiOperation(value = "修改新闻资讯状态", notes = "修改新闻资讯状态")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@PostMapping("/updateStatus/{businessId:\\w+}") @PostMapping("/updateStatus/{businessId:\\w+}")
public CyResult updateStatus(SysContentNewsInformation sysContentNewsInformation) { public CyResult updateStatus(CmsActivity cmsActivity) {
CyPersistModel data = sysContentNewsInformationServiceImpl.updateStatus(sysContentNewsInformation); CyPersistModel data = cmsActivityServiceImpl.updateStatus(cmsActivity);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
sysContentNewsInformation); cmsActivity);
} }
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:derive')") @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:derive')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.EXPORT) @CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出新闻资讯信息", notes = "导出新闻资讯信息") @ApiOperation(value = "导出新闻资讯信息", notes = "导出新闻资讯信息")
@GetMapping(value = "/export") @GetMapping(value = "/export")
public void outSysContentNewsInformation(HttpServletResponse response, SysContentNewsInformation sysContentNewsInformation, @PathVariable @RequestParam(defaultValue = "0") String excelId) { public void outSysContentNewsInformation(HttpServletResponse response, CmsActivity cmsActivity, @PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName = ""; String excelName = "";
switch (excelId) { switch (excelId) {
case "0": case "0":
...@@ -141,7 +141,7 @@ public class SysContentNewsInformationController extends CyPaginationController< ...@@ -141,7 +141,7 @@ public class SysContentNewsInformationController extends CyPaginationController<
excelName = "新闻资讯信息.csv"; excelName = "新闻资讯信息.csv";
break; break;
} }
List<SysContentNewsInformation> sysContentNewsInformationList = sysContentNewsInformationServiceImpl.export(sysContentNewsInformation); List<CmsActivity> cmsActivityList = cmsActivityServiceImpl.export(cmsActivity);
CyEpExcelUtil.exportExcel(sysContentNewsInformationList, "新闻资讯信息", "新闻资讯信息", SysContentNewsInformation.class, excelName, response); CyEpExcelUtil.exportExcel(cmsActivityList, "新闻资讯信息", "新闻资讯信息", CmsActivity.class, excelName, response);
} }
} }
package org.rcisoft.business.cmsActivity.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created with cy on 2024年3月25日 下午1:42:40.
* @author wangFeilong
*/
public interface CmsActivityRepository extends CyBaseMapper<CmsActivity> {
List<CmsActivity> queryCmsActivity(@Param("entity") CmsActivity cmsActivity);
/**
* 分页查询 cmsActivity
*
*/
IPage<CmsActivity> queryCmsActivityPaged(CyPageInfo cyPageInfo, @Param("entity") CmsActivity cmsActivity);
//根据id逻辑删除
int deleteCmsActivity(@Param("businessId")Integer businessId);
//修改状态
int updateStatus(@Param("entity") CmsActivity cmsActivity);
CmsActivity selectById(@Param("businessId")Integer businessId);
//权重验重
CmsActivity checkWeight(@Param("weight")Integer weight);
}
package org.rcisoft.business.syscontentnewsinformation.entity; package org.rcisoft.business.cmsActivity.entity;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
...@@ -17,8 +17,8 @@ import java.util.Date; ...@@ -17,8 +17,8 @@ import java.util.Date;
* @author wangFeilong * @author wangFeilong
*/ */
@Data @Data
@TableName("cms_news") @TableName("cms_activity")
public class SysContentNewsInformation extends CyIdIncreEntity<SysContentNewsInformation> { public class CmsActivity extends CyIdIncreEntity<CmsActivity> {
/** /**
......
package org.rcisoft.business.syscontentnewsinformation.service; package org.rcisoft.business.cmsActivity.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation; import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
...@@ -10,61 +10,61 @@ import java.util.List; ...@@ -10,61 +10,61 @@ import java.util.List;
/** /**
* Created by cy on 2024年3月25日 下午1:42:40. * Created by cy on 2024年3月25日 下午1:42:40.
*/ */
public interface SysContentNewsInformationService { public interface CmsActivityService {
/** /**
* 保存 新闻资讯 * 保存 新闻资讯
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
CyPersistModel persist(SysContentNewsInformation sysContentNewsInformation); CyPersistModel persist(CmsActivity cmsActivity);
/** /**
* 删除 新闻资讯 * 删除 新闻资讯
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
CyPersistModel remove(SysContentNewsInformation sysContentNewsInformation); CyPersistModel remove(CmsActivity cmsActivity);
/** /**
* 修改 新闻资讯 * 修改 新闻资讯
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
CyPersistModel merge(SysContentNewsInformation sysContentNewsInformation); CyPersistModel merge(CmsActivity cmsActivity);
/** /**
* 根据id查询 新闻资讯 * 根据id查询 新闻资讯
* @param id * @param id
* @return * @return
*/ */
SysContentNewsInformation findById(Integer id); CmsActivity findById(Integer id);
/** /**
* 分页查询 新闻资讯 * 分页查询 新闻资讯
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
IPage<SysContentNewsInformation> findAllByPagination(CyPageInfo<SysContentNewsInformation> paginationUtility, IPage<CmsActivity> findAllByPagination(CyPageInfo<CmsActivity> paginationUtility,
SysContentNewsInformation sysContentNewsInformation); CmsActivity cmsActivity);
/** /**
* 查询list 新闻资讯 * 查询list 新闻资讯
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
List<SysContentNewsInformation> findAll(SysContentNewsInformation sysContentNewsInformation); List<CmsActivity> findAll(CmsActivity cmsActivity);
/** /**
* 导出新闻资讯 * 导出新闻资讯
* @return * @return
*/ */
List<SysContentNewsInformation> export(SysContentNewsInformation sysContentNewsInformation); List<CmsActivity> export(CmsActivity cmsActivity);
/** /**
* 修改状态 * 修改状态
*/ */
CyPersistModel updateStatus(SysContentNewsInformation sysContentNewsInformation); CyPersistModel updateStatus(CmsActivity cmsActivity);
} }
package org.rcisoft.business.syscontentnewsinformation.service.impl; package org.rcisoft.business.cmsActivity.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.syscontentnewsinformation.dao.SysContentNewsInformationRepository; import org.rcisoft.business.cmsActivity.dao.CmsActivityRepository;
import org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation; import org.rcisoft.business.cmsActivity.entity.CmsActivity;
import org.rcisoft.business.syscontentnewsinformation.service.SysContentNewsInformationService; import org.rcisoft.business.cmsActivity.service.CmsActivityService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.CyServiceException; import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
...@@ -27,7 +27,7 @@ import java.util.List; ...@@ -27,7 +27,7 @@ import java.util.List;
@Service @Service
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
@Slf4j @Slf4j
public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContentNewsInformationRepository, SysContentNewsInformation> implements SysContentNewsInformationService { public class CmsActivityServiceImpl extends ServiceImpl<CmsActivityRepository, CmsActivity> implements CmsActivityService {
@Autowired @Autowired
private Global global; private Global global;
...@@ -40,20 +40,20 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent ...@@ -40,20 +40,20 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent
*/ */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel persist(SysContentNewsInformation sysContentNewsInformation) { public CyPersistModel persist(CmsActivity cmsActivity) {
//增加操作 //增加操作
sysContentNewsInformation.setDelFlag("0"); cmsActivity.setDelFlag("0");
//当图片字段没有时增加默认1 //当图片字段没有时增加默认1
if (ObjectUtil.isNull(sysContentNewsInformation.getPictureId())) { if (ObjectUtil.isNull(cmsActivity.getPictureId())) {
sysContentNewsInformation.setPictureId(global.getDEFAULT_NEWS_LOCATION()); cmsActivity.setPictureId(global.getDEFAULT_NEWS_LOCATION());
} }
SysContentNewsInformation check = baseMapper.checkWeight(sysContentNewsInformation.getWeight()); CmsActivity check = baseMapper.checkWeight(cmsActivity.getWeight());
if (ObjectUtil.isNotNull(check)) { if (ObjectUtil.isNotNull(check)) {
throw new CyServiceException(500, "权重已存在"); throw new CyServiceException(500, "权重已存在");
} else { } else {
int line = baseMapper.insert(sysContentNewsInformation); int line = baseMapper.insert(cmsActivity);
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" + log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
sysContentNewsInformation.getBusinessId() + "的新闻资讯信息"); cmsActivity.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
} }
...@@ -61,36 +61,36 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent ...@@ -61,36 +61,36 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent
/** /**
* 删除 新闻资讯 * 删除 新闻资讯
* *
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel remove(SysContentNewsInformation sysContentNewsInformation) { public CyPersistModel remove(CmsActivity cmsActivity) {
int line = baseMapper.deleteSysContentNewsInformation(sysContentNewsInformation.getBusinessId()); int line = baseMapper.deleteCmsActivity(cmsActivity.getBusinessId());
log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" + log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
sysContentNewsInformation.getBusinessId() + "的新闻资讯信息"); cmsActivity.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 修改 新闻资讯 * 修改 新闻资讯
* *
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel merge(SysContentNewsInformation sysContentNewsInformation) { public CyPersistModel merge(CmsActivity cmsActivity) {
//修改文本中的#image //修改文本中的#image
String details = sysContentNewsInformation.getDetails().replace("#image", "data:image"); String details = cmsActivity.getDetails().replace("#image", "data:image");
sysContentNewsInformation.setDetails(details); cmsActivity.setDetails(details);
SysContentNewsInformation check = baseMapper.checkWeight(sysContentNewsInformation.getWeight()); CmsActivity check = baseMapper.checkWeight(cmsActivity.getWeight());
if (ObjectUtil.isNotNull(check) && !check.getBusinessId().equals(sysContentNewsInformation.getBusinessId())) { if (ObjectUtil.isNotNull(check) && !check.getBusinessId().equals(cmsActivity.getBusinessId())) {
throw new CyServiceException(500, "权重已存在"); throw new CyServiceException(500, "权重已存在");
} else { } else {
int line = baseMapper.updateById(sysContentNewsInformation); int line = baseMapper.updateById(cmsActivity);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + sysContentNewsInformation.getBusinessId() + "的新闻资讯信息"); log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + cmsActivity.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
} }
...@@ -102,8 +102,8 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent ...@@ -102,8 +102,8 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent
* @return * @return
*/ */
@Override @Override
public SysContentNewsInformation findById(Integer id) { public CmsActivity findById(Integer id) {
SysContentNewsInformation newsInformation = baseMapper.selectById(id); CmsActivity newsInformation = baseMapper.selectById(id);
if (newsInformation.getPath() != null) { if (newsInformation.getPath() != null) {
newsInformation.setPath(global.getBase_Discovery() + newsInformation.getPath()); newsInformation.setPath(global.getBase_Discovery() + newsInformation.getPath());
} }
...@@ -113,33 +113,33 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent ...@@ -113,33 +113,33 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent
/** /**
* 分页查询 新闻资讯 * 分页查询 新闻资讯
* *
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
@Override @Override
public IPage<SysContentNewsInformation> findAllByPagination(CyPageInfo<SysContentNewsInformation> paginationUtility, public IPage<CmsActivity> findAllByPagination(CyPageInfo<CmsActivity> paginationUtility,
SysContentNewsInformation sysContentNewsInformation) { CmsActivity cmsActivity) {
IPage<SysContentNewsInformation> sysContentNewsInformationIPage = baseMapper.querySysContentNewsInformationsPaged(paginationUtility, sysContentNewsInformation); IPage<CmsActivity> cmsActivityIPage = baseMapper.queryCmsActivityPaged(paginationUtility, cmsActivity);
List<SysContentNewsInformation> newsInformation = sysContentNewsInformationIPage.getRecords(); List<CmsActivity> newsInformation = cmsActivityIPage.getRecords();
for (SysContentNewsInformation news : newsInformation) { for (CmsActivity news : newsInformation) {
if (news.getPath() != null) { if (news.getPath() != null) {
news.setPath(global.getBase_Discovery() + news.getPath()); news.setPath(global.getBase_Discovery() + news.getPath());
} }
} }
sysContentNewsInformationIPage.setRecords(newsInformation); cmsActivityIPage.setRecords(newsInformation);
return sysContentNewsInformationIPage; return cmsActivityIPage;
} }
/** /**
* 查询list 新闻资讯 * 查询list 新闻资讯
* *
* @param sysContentNewsInformation * @param cmsActivity
* @return * @return
*/ */
@Override @Override
public List<SysContentNewsInformation> findAll(SysContentNewsInformation sysContentNewsInformation) { public List<CmsActivity> findAll(CmsActivity cmsActivity) {
return baseMapper.querySysContentNewsInformations(sysContentNewsInformation); return baseMapper.queryCmsActivity(cmsActivity);
} }
...@@ -149,15 +149,15 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent ...@@ -149,15 +149,15 @@ public class SysContentNewsInformationServiceImpl extends ServiceImpl<SysContent
* @return * @return
*/ */
@Override @Override
public List<SysContentNewsInformation> export(SysContentNewsInformation sysContentNewsInformation) { public List<CmsActivity> export(CmsActivity cmsActivity) {
List<SysContentNewsInformation> sysContentNewsInformationList = baseMapper.querySysContentNewsInformations(sysContentNewsInformation); List<CmsActivity> cmsActivityList = baseMapper.queryCmsActivity(cmsActivity);
return sysContentNewsInformationList; return cmsActivityList;
} }
@Override @Override
public CyPersistModel updateStatus(SysContentNewsInformation sysContentNewsInformation) { public CyPersistModel updateStatus(CmsActivity cmsActivity) {
int line = baseMapper.updateStatus(sysContentNewsInformation); int line = baseMapper.updateStatus(cmsActivity);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + sysContentNewsInformation.getBusinessId() + "的新闻资讯信息状态"); log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + cmsActivity.getBusinessId() + "的新闻资讯信息状态");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
......
package org.rcisoft.business.cmsbanner.controller; package org.rcisoft.business.cmsBanner.controller;
/*固定导入*/ /*固定导入*/
...@@ -6,8 +6,8 @@ package org.rcisoft.business.cmsbanner.controller; ...@@ -6,8 +6,8 @@ package org.rcisoft.business.cmsbanner.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.cmsbanner.entity.CmsBanner; import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.business.cmsbanner.service.CmsBannerService; import org.rcisoft.business.cmsBanner.service.CmsBannerService;
import org.rcisoft.core.anno.CyOpeLogAnno; import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons; import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController; import org.rcisoft.core.controller.CyPaginationController;
......
package org.rcisoft.business.cmsbanner.dao; package org.rcisoft.business.cmsBanner.dao;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.cmsbanner.entity.CmsBanner; import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.core.mapper.CyBaseMapper; import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
......
package org.rcisoft.business.cmsbanner.entity; package org.rcisoft.business.cmsBanner.entity;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
......
package org.rcisoft.business.cmsbanner.service; package org.rcisoft.business.cmsBanner.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.business.cmsbanner.entity.CmsBanner; import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
......
package org.rcisoft.business.cmsbanner.service.impl; package org.rcisoft.business.cmsBanner.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.cmsbanner.dao.CmsBannerRepository; import org.rcisoft.business.cmsBanner.dao.CmsBannerRepository;
import org.rcisoft.business.cmsbanner.entity.CmsBanner; import org.rcisoft.business.cmsBanner.entity.CmsBanner;
import org.rcisoft.business.cmsbanner.service.CmsBannerService; import org.rcisoft.business.cmsBanner.service.CmsBannerService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.model.CyPageInfo; import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
......
package org.rcisoft.business.cmsNotice.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.cmsNotice.entity.CmsNotice;
import org.rcisoft.business.cmsNotice.service.CmsNoticeService;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
/**
* @author cy
* @date 2024年3月25日 下午1:42:40
*/
@RestController
@RequestMapping("/cmsNotice")
public class CmsNoticeController extends CyPaginationController<CmsNotice> {
@Autowired
private CmsNoticeService cmsNoticeServiceImpl;
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:increase')")
@CyOpeLogAnno(title = "system-新闻资讯管理-新增新闻资讯", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value = "添加新闻资讯", notes = "添加新闻资讯")
@PostMapping(value = "/add")
public CyResult add(@Valid CmsNotice cmsNotice, BindingResult bindingResult) {
CyPersistModel data = cmsNoticeServiceImpl.persist(cmsNotice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNotice);
}
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:removing')")
@CyOpeLogAnno(title = "system-新闻资讯管理-删除新闻资讯", businessType = CyLogTypeEnum.DELETE)
@ApiOperation(value = "删除新闻资讯", notes = "删除新闻资讯")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable Integer businessId, CmsNotice cmsNotice) {
cmsNotice.setBusinessId(businessId);
CyPersistModel data = cmsNoticeServiceImpl.remove(cmsNotice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:modifications')")
@CyOpeLogAnno(title = "system-新闻资讯管理-修改新闻资讯", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value = "修改新闻资讯", notes = "修改新闻资讯")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable Integer businessId, @Valid CmsNotice cmsNotice, BindingResult bindingResult) {
cmsNotice.setBusinessId(businessId);
CyPersistModel data = cmsNoticeServiceImpl.merge(cmsNotice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNotice);
}
// @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:singleSearch')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "查询单一新闻资讯", notes = "查询单一新闻资讯")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable Integer businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNoticeServiceImpl.findById(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:contentNewsInformation:list')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "查询新闻资讯集合", notes = "查询新闻资讯集合")
@GetMapping(value = "/queryCmsNotice")
public CyResult querySysContentNewsInformations(CmsNotice cmsNotice) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNoticeServiceImpl.findAll(cmsNotice));
}
// @PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:pageSearch')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "分页查询新闻资讯集合", notes = "分页查询新闻资讯集合")
@GetMapping(value = "/queryCmsNoticeByPagination")
public CyGridModel listByPagination(CmsNotice cmsNotice) {
cmsNoticeServiceImpl.findAllByPagination(getPaginationUtility(), cmsNotice);
return getGridModelResponse();
}
//修改状态
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:modificationsStatus')")
@CyOpeLogAnno(title = "system-新闻资讯管理-修改新闻资讯状态", businessType = CyLogTypeEnum.UPDATE)
@ApiOperation(value = "修改新闻资讯状态", notes = "修改新闻资讯状态")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@PostMapping("/updateStatus/{businessId:\\w+}")
public CyResult updateStatus(CmsNotice cmsNotice) {
CyPersistModel data = cmsNoticeServiceImpl.updateStatus(cmsNotice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
cmsNotice);
}
@PreAuthorize("@cyPerm.hasPerm('cms:newsmanagement:derive')")
@CyOpeLogAnno(title = "system-新闻资讯管理-查询新闻资讯", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出新闻资讯信息", notes = "导出新闻资讯信息")
@GetMapping(value = "/export")
public void outSysContentNewsInformation(HttpServletResponse response, CmsNotice cmsNotice, @PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName = "";
switch (excelId) {
case "0":
excelName = "新闻资讯信息.xls";
break;
case "1":
excelName = "新闻资讯信息.xlsx";
break;
case "2":
excelName = "新闻资讯信息.csv";
break;
}
List<CmsNotice> cmsNoticeList = cmsNoticeServiceImpl.export(cmsNotice);
CyEpExcelUtil.exportExcel(cmsNoticeList, "新闻资讯信息", "新闻资讯信息", CmsNotice.class, excelName, response);
}
}
package org.rcisoft.business.cmsNotice.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.cmsNotice.entity.CmsNotice;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created with cy on 2024年3月25日 下午1:42:40.
* @author wangFeilong
*/
public interface CmsNoticeRepository extends CyBaseMapper<CmsNotice> {
List<CmsNotice> queryCmsNotice(@Param("entity") CmsNotice cmsNotice);
/**
* 分页查询 cmsActivity
*
*/
IPage<CmsNotice> queryCmsNoticePaged(CyPageInfo cyPageInfo, @Param("entity") CmsNotice cmsActivity);
//根据id逻辑删除
int deleteCmsNotice(@Param("businessId")Integer businessId);
//修改状态
int updateStatus(@Param("entity") CmsNotice cmsActivity);
CmsNotice selectById(@Param("businessId")Integer businessId);
//权重验重
CmsNotice checkWeight(@Param("weight")Integer weight);
}
package org.rcisoft.business.cmsNotice.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* Created with cy on 2024年3月25日 下午1:42:40.
*
* @author wangFeilong
*/
@Data
@TableName("cms_notice")
public class CmsNotice extends CyIdIncreEntity<CmsNotice> {
/**
* @desc 发布日期
* @column release_date
* @default
*/
@Excel(name = "发布日期", orderNum = "1", width = 20, format = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date releaseDate;
/**
* @desc 板块
* @column plate
* @default
*/
@Excel(name = "板块", orderNum = "2", width = 20)
private String plate;
/**
* @desc 标题
* @column title
* @default
*/
@Excel(name = "标题", orderNum = "9", width = 20)
private String title;
/**
* @desc 单位
* @column unit
* @default
*/
@Excel(name = "单位", orderNum = "10", width = 20)
private String unit;
/**
* @desc 内容
* @column details
* @default
*/
@Excel(name = "内容", orderNum = "11", width = 20)
private String details;
/**
* @desc 排序
* @column weight
* @default
*/
@Excel(name = "排序", orderNum = "12", width = 20)
private Integer weight;
/**
* @desc 封面
* @column picture_id
* @default
*/
@Excel(name = "封面", orderNum = "13", width = 20)
private String pictureId;
/**
* 开始时间
*/
@JsonIgnore
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@JsonIgnore
@TableField(exist = false)
private String endTime;
@TableField(exist = false)
private String nickName;
@TableField(exist = false)
private String path;
//是否为头条新闻
private Integer isForntPage;
//是否为推荐新闻
private Integer isRecommended;
//是否为置顶新闻
private Integer isTop;
}
package org.rcisoft.business.cmsNotice.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.business.cmsNotice.entity.CmsNotice;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import java.util.List;
/**
* Created by cy on 2024年3月25日 下午1:42:40.
*/
public interface CmsNoticeService {
/**
* 保存 新闻资讯
* @param cmsNotice
* @return
*/
CyPersistModel persist(CmsNotice cmsNotice);
/**
* 删除 新闻资讯
* @param cmsNotice
* @return
*/
CyPersistModel remove(CmsNotice cmsNotice);
/**
* 修改 新闻资讯
* @param cmsNotice
* @return
*/
CyPersistModel merge(CmsNotice cmsNotice);
/**
* 根据id查询 新闻资讯
* @param id
* @return
*/
CmsNotice findById(Integer id);
/**
* 分页查询 新闻资讯
* @param cmsNotice
* @return
*/
IPage<CmsNotice> findAllByPagination(CyPageInfo<CmsNotice> paginationUtility,
CmsNotice cmsNotice);
/**
* 查询list 新闻资讯
* @param cmsNotice
* @return
*/
List<CmsNotice> findAll(CmsNotice cmsNotice);
/**
* 导出新闻资讯
* @return
*/
List<CmsNotice> export(CmsNotice cmsNotice);
/**
* 修改状态
*/
CyPersistModel updateStatus(CmsNotice cmsNotice);
}
package org.rcisoft.business.cmsNotice.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.cmsNotice.dao.CmsNoticeRepository;
import org.rcisoft.business.cmsNotice.entity.CmsNotice;
import org.rcisoft.business.cmsNotice.service.CmsNoticeService;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyUserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author cy
* @date 2024年3月25日 下午1:42:40
*/
@Service
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class CmsNoticeServiceImpl extends ServiceImpl<CmsNoticeRepository, CmsNotice> implements CmsNoticeService {
@Autowired
private Global global;
/**
* 保存 新闻资讯
*
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(CmsNotice cmsNotice) {
//增加操作
cmsNotice.setDelFlag("0");
//当图片字段没有时增加默认1
if (ObjectUtil.isNull(cmsNotice.getPictureId())) {
cmsNotice.setPictureId(global.getDEFAULT_NEWS_LOCATION());
}
CmsNotice check = baseMapper.checkWeight(cmsNotice.getWeight());
if (ObjectUtil.isNotNull(check)) {
throw new CyServiceException(500, "权重已存在");
} else {
int line = baseMapper.insert(cmsNotice);
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
cmsNotice.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line);
}
}
/**
* 删除 新闻资讯
*
* @param cmsNotice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(CmsNotice cmsNotice) {
int line = baseMapper.deleteCmsNotice(cmsNotice.getBusinessId());
log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
cmsNotice.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line);
}
/**
* 修改 新闻资讯
*
* @param cmsNotice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(CmsNotice cmsNotice) {
//修改文本中的#image
String details = cmsNotice.getDetails().replace("#image", "data:image");
cmsNotice.setDetails(details);
CmsNotice check = baseMapper.checkWeight(cmsNotice.getWeight());
if (ObjectUtil.isNotNull(check) && !check.getBusinessId().equals(cmsNotice.getBusinessId())) {
throw new CyServiceException(500, "权重已存在");
} else {
int line = baseMapper.updateById(cmsNotice);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + cmsNotice.getBusinessId() + "的新闻资讯信息");
return new CyPersistModel(line);
}
}
/**
* 根据id查询 新闻资讯
*
* @param id
* @return
*/
@Override
public CmsNotice findById(Integer id) {
CmsNotice newsInformation = baseMapper.selectById(id);
if (newsInformation.getPath() != null) {
newsInformation.setPath(global.getBase_Discovery() + newsInformation.getPath());
}
return newsInformation;
}
/**
* 分页查询 新闻资讯
*
* @param cmsNotice
* @return
*/
@Override
public IPage<CmsNotice> findAllByPagination(CyPageInfo<CmsNotice> paginationUtility,
CmsNotice cmsNotice) {
IPage<CmsNotice> cmsNoticeIPage = baseMapper.queryCmsNoticePaged(paginationUtility, cmsNotice);
List<CmsNotice> newsInformation = cmsNoticeIPage.getRecords();
for (CmsNotice news : newsInformation) {
if (news.getPath() != null) {
news.setPath(global.getBase_Discovery() + news.getPath());
}
}
cmsNoticeIPage.setRecords(newsInformation);
return cmsNoticeIPage;
}
/**
* 查询list 新闻资讯
*
* @param cmsNotice
* @return
*/
@Override
public List<CmsNotice> findAll(CmsNotice cmsNotice) {
return baseMapper.queryCmsNotice(cmsNotice);
}
/**
* 导出新闻资讯
*
* @return
*/
@Override
public List<CmsNotice> export(CmsNotice cmsNotice) {
List<CmsNotice> cmsNoticeList = baseMapper.queryCmsNotice(cmsNotice);
return cmsNoticeList;
}
@Override
public CyPersistModel updateStatus(CmsNotice cmsNotice) {
int line = baseMapper.updateStatus(cmsNotice);
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + cmsNotice.getBusinessId() + "的新闻资讯信息状态");
return new CyPersistModel(line);
}
}
package org.rcisoft.business.syscontentnewsinformation.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created with cy on 2024年3月25日 下午1:42:40.
* @author wangFeilong
*/
public interface SysContentNewsInformationRepository extends CyBaseMapper<SysContentNewsInformation> {
List<SysContentNewsInformation> querySysContentNewsInformations(@Param("entity") SysContentNewsInformation sysContentNewsInformation);
/**
* 分页查询 sysContentNewsInformation
*
*/
IPage<SysContentNewsInformation> querySysContentNewsInformationsPaged(CyPageInfo cyPageInfo,@Param("entity") SysContentNewsInformation sysContentNewsInformation);
//根据id逻辑删除
int deleteSysContentNewsInformation(@Param("businessId")Integer businessId);
//修改状态
int updateStatus(@Param("entity") SysContentNewsInformation sysContentNewsInformation);
SysContentNewsInformation selectById(@Param("businessId")Integer businessId);
//权重验重
SysContentNewsInformation checkWeight(@Param("weight")Integer weight);
}
...@@ -56,7 +56,7 @@ cy_db: ...@@ -56,7 +56,7 @@ cy_db:
# port: 20072 # port: 20072
# username: root # username: root
# password: root # password: root
db: cust db: cy
cy: cy:
......
<?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="org.rcisoft.business.cmsActivity.dao.CmsActivityRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.cmsActivity.entity.CmsActivity">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="release_date" jdbcType="DATE" property="releaseDate"/>
<result column="plate" jdbcType="VARCHAR" property="plate"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="DATE" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="unit" jdbcType="VARCHAR" property="unit"/>
<result column="details" jdbcType="VARCHAR" property="details"/>
<result column="weight" jdbcType="INTEGER" property="weight"/>
<result column="picture_id" jdbcType="VARCHAR" property="pictureId"/>
<result column="is_fornt_page" jdbcType="INTEGER" property="isForntPage"/>
<result column="is_recommended" jdbcType="INTEGER" property="isRecommended"/>
<result column="is_top" jdbcType="INTEGER" property="isTop"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryCmsActivity" resultMap="BaseResultMap">
select * from cms_activity
where 1=1
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and release_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and release_date &lt;= #{entity.endTime}
</if>
<if test="entity.plate !=null and entity.plate != '' ">
and plate like concat('%',#{entity.plate},'%')
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and create_by like concat('%',#{entity.createBy},'%')
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and create_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and create_date &lt;= #{entity.endTime}
</if>
<if test="entity.updateBy !=null and entity.updateBy != '' ">
and update_by like concat('%',#{entity.updateBy},'%')
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and update_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and update_date &lt;= #{entity.endTime}
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.unit !=null and entity.unit != '' ">
and unit like concat('%',#{entity.unit},'%')
</if>
<if test="entity.details !=null and entity.details != '' ">
and details like concat('%',#{entity.details},'%')
</if>
<if test="entity.weight !=null and entity.weight != '' ">
and weight like concat('%',#{entity.weight},'%')
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and picture_id like concat('%',#{entity.pictureId},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="queryCmsActivityPaged" resultMap="BaseResultMap">
SELECT ca.business_id,
ca.release_date,
ca.plate,
ca.create_by,
ca.create_date,
ca.update_by,
ca.del_flag,
ca.flag,
ca.remarks,
ca.title,
ca.unit,
ca.weight,
ca.picture_id,
ca.is_fornt_page,
ca.is_recommended,
ca.is_top,
su.nick_name as nickName,
oi.path
FROM cms_activity ca
LEFT JOIN oss_info oi on oi.business_id = ca.picture_id
LEFT JOIN sys_user su on su.business_id = ca.create_by
where ca.del_flag='0'
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and release_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and release_date &lt;= #{entity.endTime}
</if>
<if test="entity.flag!=null and entity.flag != '' ">
and ca.flag = #{entity.flag}
</if>
<if test="entity.plate !=null and entity.plate != '' ">
and plate like concat('%',#{entity.plate},'%')
</if>
<if test="entity.createBy !=null and entity.createBy != '' ">
and create_by like concat('%',#{entity.createBy},'%')
</if>
<if test="entity.beginTime !=null ">
and ca.release_date &gt;= #{entity.beginTime}
</if>
<if test="entity.endTime !=null ">
and ca.release_date &lt;= #{entity.endTime}
</if>
<if test="entity.updateBy !=null and entity.updateBy != '' ">
and update_by like concat('%',#{entity.updateBy},'%')
</if>
<if test="entity.title !=null and entity.title != '' ">
and title like concat('%',#{entity.title},'%')
</if>
<if test="entity.unit !=null and entity.unit != '' ">
and unit like concat('%',#{entity.unit},'%')
</if>
<if test="entity.pictureId !=null and entity.pictureId != '' ">
and picture_id like concat('%',#{entity.pictureId},'%')
</if>
<if test="entity.isForntPage !=null and entity.isForntPage != '' ">
and is_fornt_page = #{entity.isForntPage}
</if>
<if test="entity.isRecommended !=null and entity.isRecommended != '' ">
and is_recommended = #{entity.isRecommended}
</if>
<if test="entity.isTop !=null and entity.isTop != '' ">
and is_top = #{entity.isTop}
</if>
ORDER BY ca.release_date DESC
</select>
<update id="deleteCmsActivity" parameterType="java.lang.Integer">
update cms_activity
set del_flag = '1'
where business_id = #{businessId}
</update>
<update id="updateStatus" parameterType="org.rcisoft.business.cmsActivity.entity.CmsActivity">
update cms_activity
set flag = #{ entity.flag}
where business_id = #{entity.businessId}
</update>
<select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select ca.*,
oi.path
from cms_activity ca
left join oss_info oi on oi.business_id = ca.picture_id
where ca.business_id = #{businessId}
</select>
<select id="checkWeight" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select * from cms_activity
where 1=1
and del_flag = '0'
and weight = #{weight}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.syscontentnewsinformation.dao.SysContentNewsInformationRepository"> <mapper namespace="org.rcisoft.business.cmsNotice.dao.CmsNoticeRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation"> <resultMap id="BaseResultMap" type="org.rcisoft.business.cmsNotice.entity.CmsNotice">
<id column="business_id" jdbcType="INTEGER" property="businessId"/> <id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/> <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="release_date" jdbcType="DATE" property="releaseDate"/> <result column="release_date" jdbcType="DATE" property="releaseDate"/>
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
</resultMap> </resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="querySysContentNewsInformations" resultMap="BaseResultMap"> <select id="queryCmsNotice" resultMap="BaseResultMap">
select * from cms_news select * from cms_notice
where 1=1 where 1=1
<if test="entity.beginTime !=null and entity.beginTime != '' "> <if test="entity.beginTime !=null and entity.beginTime != '' ">
and release_date &gt;= #{entity.beginTime} and release_date &gt;= #{entity.beginTime}
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
ORDER BY business_id DESC ORDER BY business_id DESC
</select> </select>
<select id="querySysContentNewsInformationsPaged" resultMap="BaseResultMap"> <select id="queryCmsNoticePaged" resultMap="BaseResultMap">
SELECT cn.business_id, SELECT cn.business_id,
cn.release_date, cn.release_date,
cn.plate, cn.plate,
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
cn.is_top, cn.is_top,
su.nick_name as nickName, su.nick_name as nickName,
oi.path oi.path
FROM cms_news cn FROM cms_notice cn
LEFT JOIN oss_info oi on oi.business_id = cn.picture_id LEFT JOIN oss_info oi on oi.business_id = cn.picture_id
LEFT JOIN sys_user su on su.business_id = cn.create_by LEFT JOIN sys_user su on su.business_id = cn.create_by
where cn.del_flag='0' where cn.del_flag='0'
...@@ -138,26 +138,26 @@ ...@@ -138,26 +138,26 @@
</if> </if>
ORDER BY cn.release_date DESC ORDER BY cn.release_date DESC
</select> </select>
<update id="deleteSysContentNewsInformation" parameterType="java.lang.Integer"> <update id="deleteCmsNotice" parameterType="java.lang.Integer">
update cms_news update cms_notice
set del_flag = '1' set del_flag = '1'
where business_id = #{businessId} where business_id = #{businessId}
</update> </update>
<update id="updateStatus" parameterType="org.rcisoft.business.syscontentnewsinformation.entity.SysContentNewsInformation"> <update id="updateStatus" parameterType="org.rcisoft.business.cmsNotice.entity.CmsNotice">
update cms_news update cms_notice
set flag = #{ entity.flag} set flag = #{ entity.flag}
where business_id = #{entity.businessId} where business_id = #{entity.businessId}
</update> </update>
<select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer"> <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select cn.*, select cn.*,
oi.path oi.path
from cms_news cn from cms_notice cn
left join oss_info oi on oi.business_id = cn.picture_id left join oss_info oi on oi.business_id = cn.picture_id
where cn.business_id = #{businessId} where cn.business_id = #{businessId}
</select> </select>
<select id="checkWeight" resultMap="BaseResultMap" parameterType="java.lang.Integer"> <select id="checkWeight" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select * from cms_news select * from cms_notice
where 1=1 where 1=1
and del_flag = '0' and del_flag = '0'
and weight = #{weight} and weight = #{weight}
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.cmsbanner.dao.CmsBannerRepository"> <mapper namespace="org.rcisoft.business.cmsBanner.dao.CmsBannerRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.cmsbanner.entity.CmsBanner"> <resultMap id="BaseResultMap" type="org.rcisoft.business.cmsBanner.entity.CmsBanner">
<id column="business_id" jdbcType="INTEGER" property="businessId"/> <id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="banner_picture" jdbcType="VARCHAR" property="bannerPicture"/> <result column="banner_picture" jdbcType="VARCHAR" property="bannerPicture"/>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</if> </if>
ORDER BY smb.weight DESC ORDER BY smb.weight DESC
</select> </select>
<select id="selectByIdWithUrl" resultType="org.rcisoft.business.cmsbanner.entity.CmsBanner"> <select id="selectByIdWithUrl" resultType="org.rcisoft.business.cmsBanner.entity.CmsBanner">
SELECT smb.*, SELECT smb.*,
oi.url oi.url
FROM cms_banner smb FROM cms_banner smb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment