Commit 2ccf387b authored by root's avatar root

添加栏目配置接口

parent 6282adb4
...@@ -116,4 +116,6 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -116,4 +116,6 @@ public class BBannerController extends PaginationController<BBanner> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bannerOrderMap); bannerOrderMap);
} }
} }
...@@ -32,7 +32,9 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -32,7 +32,9 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
" <if test=\"title!=null and title != ''\">and title like CONCAT('%',#{title},'%')</if>" + " <if test=\"title!=null and title != ''\">and title like CONCAT('%',#{title},'%')</if>" +
" <if test=\"isExternalLink!=null and isExternalLink != ''\">and is_external_link=#{isExternalLink}</if>" + " <if test=\"isExternalLink!=null and isExternalLink != ''\">and is_external_link=#{isExternalLink}</if>" +
" <if test=\"lineType!=null and lineType != ''\">and line_type=#{lineType}</if>" + " <if test=\"lineType!=null and lineType != ''\">and line_type=#{lineType}</if>" +
// " <if test=\"remarks!=null and remarks != ''\">and remarks like CONCAT('%',#{remarks},'%')</if>" +
// " corp_id = #{param.corpId} "+
" order by banner_sort asc " + " order by banner_sort asc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
......
...@@ -19,6 +19,6 @@ public class FindBannerPaginDTO { ...@@ -19,6 +19,6 @@ public class FindBannerPaginDTO {
@ApiModelProperty(value = "类型(0:线下,1:线上)",required = false,dataType = "varchar") @ApiModelProperty(value = "类型(0:线下,1:线上)",required = false,dataType = "varchar")
private String lineType; private String lineType;
// private String corpId; private String corpId;
} }
...@@ -93,7 +93,6 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -93,7 +93,6 @@ public class BBannerServiceImpl implements BBannerService {
@Override @Override
public List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model) { public List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model) {
// log.info("------zql---------"+model.getCorpId());
return bBannerRepository.queryBanners(model); return bBannerRepository.queryBanners(model);
} }
......
package org.rcisoft.business.bdictionary.controller;
/*固定导入*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.bdictionary.dto.ColumConfigDTO;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import javax.validation.Valid;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.bdictionary.service.BDictionaryService;
import java.util.List;
/**
* Created by on 2019-9-29 16:21:48.
*/
@Api(tags = "11 栏目配置")
@RestController
@RequestMapping("bdictionary")
public class BDictionaryController extends PaginationController<BDictionary> {
@Autowired
private BDictionaryService bDictionaryServiceImpl;
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add(CurUser curUser,@Valid BDictionary bDictionary, BindingResult bindingResult) {
PersistModel data = bDictionaryServiceImpl.save(bDictionary);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDictionary);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) {
BDictionary bDictionary = new BDictionary();
bDictionary.setBusinessId(id);
PersistModel data = bDictionaryServiceImpl.remove(bDictionary);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
// @ApiOperation(value="修改", notes="修改")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
// @PutMapping("/update/{id:\\w+}")
// public Result update(@Valid BDictionary bDictionary, BindingResult bindingResult) {
// bDictionary.setToken(getToken());
// PersistModel data = bDictionaryServiceImpl.merge(bDictionary);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// bDictionary);
// }
@ApiOperation(value="1101 查看栏目配置", notes="查看栏目配置")
@GetMapping(value = "/columnConfiguration")
public Result columnConfiguration(CurUser curUser) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDictionaryServiceImpl.findAll(curUser));
}
@ApiOperation(value="1102 更新栏目配置", notes="查看栏目配置")
@PostMapping(value = "/updateConfiguration")
public Result updateConfiguration(CurUser curUser, @Valid ColumConfigDTO param, BindingResult bindingResult) {
return Result.builder(new PersistModel(bDictionaryServiceImpl.updateConfiguration(param)),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
param);
}
}
package org.rcisoft.business.bdictionary.dao;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-9-29 16:21:48.
*/
@Repository
public interface BDictionaryRepository extends BaseMapper<BDictionary> {
/**
* 分页查询 bDictionary
*
*/
@Select("<script>" +
" select * from b_dictionary where 1=1 "+
" and del_flag = !1 and flag = 1 "+
" <if test=\"configList != null and configList.size()>0 \">and name in " +
" <foreach item='item' index='index' collection='configList' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if>"+
" </script>")
@ResultMap(value = "BaseResultMap" )
List<BDictionary> queryBDictionarys(@Param("curUser") CurUser curUser, @Param("configList") List<String> configList);
}
package org.rcisoft.business.bdictionary.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ColumConfigDTO {
@ApiModelProperty(value = "主键id" ,required = true, dataType = "varchar")
private String businessId;
@ApiModelProperty(value = "值" ,required = true, dataType = "varchar")
private String value;
}
package org.rcisoft.business.bdictionary.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2019-9-29 16:21:48.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_dictionary")
public class BDictionary extends IdEntity<BDictionary> {
private String pid;
private String type;
private String name;
private String value;
}
package org.rcisoft.business.bdictionary.service;
import org.rcisoft.business.bdictionary.dto.ColumConfigDTO;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List;
/**
* Created by on 2019-9-29 16:21:48.
*/
public interface BDictionaryService {
/**
* 保存
* @param bDictionary
* @return
*/
PersistModel save(BDictionary bDictionary);
/**
* 逻辑删除
* @param bDictionary
* @return
*/
PersistModel remove(BDictionary bDictionary);
// /**
// * 修改
// * @param bDictionary
// * @return
// */
// PersistModel merge(BDictionary bDictionary);
//
// /**
// * 根据id查询
// * @param id
// * @return
// */
// BDictionary findById(String id);
/**
* 分页查询
* @param curUser
* @return
*/
List<BDictionary> findAll(CurUser curUser);
/**
* 更新设置
* @param param
* @return
*/
int updateConfiguration(ColumConfigDTO param);
}
package org.rcisoft.business.bdictionary.service.impl;
import org.rcisoft.business.bdictionary.dto.ColumConfigDTO;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bdictionary.dao.BDictionaryRepository;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.bdictionary.service.BDictionaryService;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.BeanUtils;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2019-9-29 16:21:48.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BDictionaryServiceImpl implements BDictionaryService {
@Autowired
private BDictionaryRepository bDictionaryRepository;
/**
* 保存 bDictionary
* @param bDictionary
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BDictionary bDictionary){
//增加操作
UserUtil.setCurrentPersistOperation(bDictionary);
int line = bDictionaryRepository.insertSelective(bDictionary);
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bDictionary
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BDictionary bDictionary){
UserUtil.setCurrentMergeOperation(bDictionary);
bDictionary.setDeleted();
int line = bDictionaryRepository.logicalDelete(bDictionary);
return new PersistModel(line);
}
// /**
// * 修改 bDictionary
// * @param bDictionary
// * @return
// */
// @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
// @Override
// public PersistModel merge(BDictionary bDictionary){
// UserUtil.setCurrentMergeOperation(bDictionary);
// int line = bDictionaryRepository.updateByPrimaryKeySelective(bDictionary);
// log.info(UserUtil.getUserInfoProp(bDictionary.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
// bDictionary.getBusinessId()+"的信息");
// return new PersistModel(line);
// }
//
// /**
// * 根据id查询 bDictionary
// * @param id
// * @return
// */
// public BDictionary findById(String id){
// return bDictionaryRepository.selectByPrimaryKey(id);
// }
/**
* 分页查询 bDictionary
* @param curUser
* @return
*/
public List<BDictionary> findAll(CurUser curUser){
List<String> configList = new ArrayList<>();
configList.add("关注人数");
configList.add("总裁读书会");
configList.add("在学人数");
List<BDictionary> DictList = bDictionaryRepository.queryBDictionarys(curUser,configList);
return DictList;
}
@Override
public int updateConfiguration(ColumConfigDTO param) {
BDictionary model = new BDictionary();
BeanUtils.copyProperties(param, model);
UserUtil.setCurrentMergeOperation(model);
return bDictionaryRepository.updateByPrimaryKeySelective(model);
}
}
...@@ -55,9 +55,9 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -55,9 +55,9 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="601 添加/编辑课程", notes="businessId为空时是添加方法,不为空时是修改方法") @ApiOperation(value="601 添加/编辑课程", notes="businessId为空时是添加方法,不为空时是修改方法")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid AddLessonDTO addLessonDTO, BindingResult bindingResult) { public Result add(CurUser curUser, @Valid AddLessonDTO addLessonDTO, BindingResult bindingResult) {
if(addLessonDTO.getCode().length()> // if(addLessonDTO.getCode().length()>
Integer.parseInt(global.getMAX_CODE_LENGTH())) // Integer.parseInt(global.getMAX_CODE_LENGTH()))
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR); // throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
PersistModel data = bLessonService.persist(addLessonDTO); PersistModel data = bLessonService.persist(addLessonDTO);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
......
...@@ -278,7 +278,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -278,7 +278,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" or (bvs.type = 1 and bvs.target_id in " + " or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>) " + " <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " + " </if>) " +
" order by T.bsum , b.collect_number " + " order by T.bsum , b.collect_number desc" +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryInterested(@Param("curUser") CurUser curUser, @Param("departs") List<String> departs); List<BLesson> queryInterested(@Param("curUser") CurUser curUser, @Param("departs") List<String> departs);
......
...@@ -9,11 +9,9 @@ import javax.validation.constraints.NotBlank; ...@@ -9,11 +9,9 @@ import javax.validation.constraints.NotBlank;
@Data @Data
public class AddLessonDTO { public class AddLessonDTO {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程id") @ApiModelProperty(value = "课程id")
private String businessId; private String businessId;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程编号") @ApiModelProperty(value = "课程编号")
private String code; private String code;
...@@ -32,12 +30,11 @@ public class AddLessonDTO { ...@@ -32,12 +30,11 @@ public class AddLessonDTO {
@ApiModelProperty(value = "课程描述") @ApiModelProperty(value = "课程描述")
@Length(min = 1,max = 255,message = "长度最小为1,最大为200")
private String courseDescription; private String courseDescription;
@ApiModelProperty(value = "可见范围") // @ApiModelProperty(value = "可见范围")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") // @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String viewRange; // private String viewRange;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)",required = true) @ApiModelProperty(value = "课程类型(0:课程 1:培训)",required = true)
...@@ -45,8 +42,7 @@ public class AddLessonDTO { ...@@ -45,8 +42,7 @@ public class AddLessonDTO {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonType; private String lessonType;
@ApiModelProperty(value = "价值") @ApiModelProperty(value = "")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String value; private String value;
@ApiModelProperty(value = "标签集合,使用','分隔") @ApiModelProperty(value = "标签集合,使用','分隔")
......
...@@ -38,17 +38,17 @@ public class FileUploadController extends FileController { ...@@ -38,17 +38,17 @@ public class FileUploadController extends FileController {
// @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar") // @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar")
}) })
@PostMapping(value = "upload") @PostMapping(value = "upload")
public Result upload(CurUser curUser, @Valid MultipartFile importFile, BindingResult bindingResult) throws Exception { public Result upload(CurUser curUser, @Valid MultipartFile file, BindingResult bindingResult) throws Exception {
Result result = new Result(); Result result = new Result();
//获取文件名称 //获取文件名称
String originalName = importFile.getOriginalFilename(); String originalName = file.getOriginalFilename();
String path = global.getBASE_UPLOAD_SERVER_LOCATION(); String path = global.getBASE_UPLOAD_SERVER_LOCATION();
String course_logo_path =global.getIMAGE_LOCATION()+global.getCOURSE_LOGO_LOCATION(); String course_logo_path =global.getIMAGE_LOCATION()+global.getCOURSE_LOGO_LOCATION();
boolean type = false; boolean type = false;
if("1".equals(global.getIS_SERVER_LINUX())){ if("1".equals(global.getIS_SERVER_LINUX())){
type = true; type = true;
} }
Map<String,Object> map= UploadUtil.picImport(path,course_logo_path,importFile,type); Map<String,Object> map= UploadUtil.picImport(path,course_logo_path,file,type);
if(map.get(UploadUtil.IS_SUCCESSS).equals(true)) if(map.get(UploadUtil.IS_SUCCESSS).equals(true))
{ {
// BLesson bL=new BLesson(); // BLesson bL=new BLesson();
......
<?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.bdictionary.dao.BDictionaryRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bdictionary.entity.BDictionary">
<id column="BUSINESS_ID" jdbcType="VARCHAR" property="businessId"/>
<result column="PID" jdbcType="VARCHAR" property="pid"/>
<result column="TYPE" jdbcType="VARCHAR" property="type"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="VALUE" jdbcType="VARCHAR" property="value"/>
<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="TIMESTAMP" property="updateDate"/>
<result column="DEL_FLAG" jdbcType="VARCHAR" property="delFlag"/>
<result column="FLAG" jdbcType="CHAR" property="flag"/>
<result column="REMARKS" jdbcType="VARCHAR" property="remarks"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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