提交 4af4e7c3 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 09b90035
......@@ -60,6 +60,8 @@ public class InformationController {
BeanUtils.copyProperties(form, entity);
entity.setTop(0);
entity.setColumnId(form.getColumnId());
InformationColumn column = informationColumnService.selectByPrimaryKey(form.getColumnId());
entity.setColumn(column.getTitle());
entity.setPublishTime(new Date());
service.insertSelective(entity);
InformationRelation relation = new InformationRelation();
......
package com.zrqx.system.fg.controller.information;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.system.SystemRequestPath;
import com.zrqx.core.model.system.InformationColumn;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.system.fg.service.information.FgInformationColumnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(SystemRequestPath.FG + SystemRequestPath.INFORMATIONCOLUMN)
@Api(description = "前台-语料库-资讯栏目")
public class FgInformationColumnController {
@Autowired
private FgInformationColumnService service;
@ApiOperation(value = "栏目列表" , notes = "栏目列表")
@GetMapping(value = SystemRequestPath.LIST )
public CallBack<List<InformationColumn>> getList(){
List<InformationColumn> list = service.selectAll();
return CallBack.success(list);
}
}
package com.zrqx.system.fg.controller.information;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.system.SystemRequestPath;
import com.zrqx.core.form.system.fg.information.FgInformationForm;
import com.zrqx.core.model.system.Information;
import com.zrqx.core.model.system.InformationColumn;
import com.zrqx.core.model.system.InformationRelation;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.system.bg.information.InformationVo;
import com.zrqx.core.vo.system.fg.information.FgInformationVo;
import com.zrqx.system.commons.redis.Redis;
import com.zrqx.system.fg.service.information.FgInformationColumnService;
import com.zrqx.system.fg.service.information.FgInformationRelationService;
import com.zrqx.system.fg.service.information.FgInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import tk.mybatis.mapper.entity.Example;
@RestController
@RequestMapping(SystemRequestPath.FG + SystemRequestPath.INFORMATION)
@Api(description = "前台-语料库")
public class FgInformationController {
@Autowired
private FgInformationService service;
@Autowired
private FgInformationColumnService informationColumnService;
@Autowired
private FgInformationRelationService informationRelationService;
@Autowired
private Redis redis;
@ApiOperation(value = "查询资讯" , notes = "分页查询资讯")
@GetMapping(value = SystemRequestPath.PAGE )
public CallBack<PageInfo<FgInformationVo>> list(FgInformationForm form, PageParam pageParam){
return CallBack.success(service.queryByCriteria(form,pageParam));
}
@ApiOperation(value = "查询资讯详情" , notes = "查询资讯详情")
@GetMapping(value = SystemRequestPath.OID )
public CallBack<InformationVo> selectById(@PathVariable String oid){
InformationVo vo = new InformationVo();
Information information = service.selectByPrimaryKey(oid);
BeanUtils.copyProperties(information, vo);
if(information.getColumnId()!=null) {
InformationColumn column = informationColumnService.selectByPrimaryKey(information.getColumnId());
if(column!=null) {
vo.setColumn(column.getTitle());
}
Example example = informationRelationService.createExample();
example.createCriteria().andEqualTo("infoId", oid);
InformationRelation relation = informationRelationService.selectOneByExample(example);
if(relation!=null) {
vo.setTopicId(relation.getSingId());
vo.setTopic(relation.getSingName());
}
}
return CallBack.success(vo);
}
}
package com.zrqx.system.fg.mapper.information;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.InformationColumn;
public interface FgInformationColumnMapper extends BaseMapper<InformationColumn> {
}
package com.zrqx.system.fg.mapper.information;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.zrqx.core.form.system.fg.information.FgInformationForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.Information;
import com.zrqx.core.vo.system.fg.information.FgInformationVo;
public interface FgInformationMapper extends BaseMapper<Information> {
@Select("<script>"
+ "SELECT cc.id,cc.title,DATE_FORMAT(cc.publishTime,'%Y-%m-%d %H:%i:%s') publishTime,cc.lookNum,"
+ "cc.text FROM sys_information cc where 1=1 "
+ "<if test='"+ NOTBLANK +"(form.title)'>"
+ " and cc.column like concat('%',#{form.title},'%') "
+ "</if>"
+ "</script>")
List<FgInformationVo> queryByCriteria(@Param("form")FgInformationForm form);
}
package com.zrqx.system.fg.mapper.information;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.InformationRelation;
public interface FgInformationRelationMapper extends BaseMapper<InformationRelation> {
}
package com.zrqx.system.fg.service.information;
import com.zrqx.core.model.system.InformationColumn;
import com.zrqx.core.service.BaseService;
public interface FgInformationColumnService extends BaseService<InformationColumn,String>{
}
package com.zrqx.system.fg.service.information;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.InformationColumn;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.system.fg.mapper.information.FgInformationColumnMapper;
@Service
public class FgInformationColumnServiceImpl extends BaseServiceImpl<InformationColumn,String> implements FgInformationColumnService {
@Autowired
private FgInformationColumnMapper mapper;
@Override
public BaseMapper<InformationColumn> getMapper() {
return mapper;
}
}
package com.zrqx.system.fg.service.information;
import com.zrqx.core.model.system.InformationRelation;
import com.zrqx.core.service.BaseService;
public interface FgInformationRelationService extends BaseService<InformationRelation,String>{
}
package com.zrqx.system.fg.service.information;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.InformationRelation;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.system.fg.mapper.information.FgInformationRelationMapper;
@Service
public class FgInformationRelationServiceImpl extends BaseServiceImpl<InformationRelation,String> implements FgInformationRelationService {
@Autowired
private FgInformationRelationMapper mapper;
@Override
public BaseMapper<InformationRelation> getMapper() {
return mapper;
}
}
package com.zrqx.system.fg.service.information;
import com.zrqx.core.form.system.fg.information.FgInformationForm;
import com.zrqx.core.model.system.Information;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.system.fg.information.FgInformationVo;
public interface FgInformationService extends BaseService<Information,String>{
PageInfo<FgInformationVo> queryByCriteria(FgInformationForm form, PageParam pageParam);
}
package com.zrqx.system.fg.service.information;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zrqx.core.form.system.fg.information.FgInformationForm;
import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.system.Information;
import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.system.fg.information.FgInformationVo;
import com.zrqx.system.fg.mapper.information.FgInformationColumnMapper;
import com.zrqx.system.fg.mapper.information.FgInformationMapper;
/**
* 自定义分类
*/
@Service
public class FgInformationServiceImpl extends BaseServiceImpl<Information,String> implements FgInformationService {
@Autowired
private FgInformationMapper mapper;
@Autowired
private FgInformationColumnMapper columnMapper;
@Override
public BaseMapper<Information> getMapper() {
return mapper;
}
@Override
public PageInfo<FgInformationVo> queryByCriteria(FgInformationForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("publishTime desc");
}
List<FgInformationVo> list = mapper.queryByCriteria(form);
return new PageInfo<FgInformationVo>(list);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论