提交 106bb954 authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 4063587e
package com.zrqx.resource.commons.vo.fg.acupointlibrary;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="AcupointLibrary",description="穴位库")
@Table(name = "res_acupoint_library")
public class FgAcupointLibraryListVO {
@Id
@GeneratedValue(strategy =GenerationType.IDENTITY, generator = "SELECT REPLACE (UUID(), '-', '')")
@ApiModelProperty("穴位id,新增时不需要填写")
private String id;
@ApiModelProperty(value = "穴位名称")
private String name;
@ApiModelProperty("名称拼音")
private String namePinyin;
@ApiModelProperty("国际编码")
private String internationalCode;
@ApiModelProperty("穴名")
private String pointName;
@ApiModelProperty("经络")
private String meridian;
@ApiModelProperty("经络id")
private String meridianId;
@ApiModelProperty("所属经络")
private String meridianDescription;
@ApiModelProperty("编辑时间")
private Date editTime;
@ApiModelProperty("编辑人id")
private String editorId;
@ApiModelProperty("编辑人")
private String editor;
@ApiModelProperty("状态:0待审核,1审核通过,审核未通过")
private Integer status;
@ApiModelProperty("穴位图")
private String acupointImg;
@ApiModelProperty("审核意见")
private String auditOpinion;
}
package com.zrqx.resource.commons.vo.fg.acupointlibrary;
import java.util.Date;
import java.util.List;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="AcupointLibraryVO",description="穴位库VO")
public class FgAcupointLibraryVO {
@Id
@GeneratedValue(strategy =GenerationType.IDENTITY, generator = "SELECT REPLACE (UUID(), '-', '')")
@ApiModelProperty("穴位id,新增时不需要填写")
private String id;
@ApiModelProperty(value = "穴位名称")
private String name;
@ApiModelProperty("名称拼音")
private String namePinyin;
@ApiModelProperty("国际编码")
private String internationalCode;
@ApiModelProperty("穴名")
private String pointName;
@ApiModelProperty("经络")
private String meridian;
@ApiModelProperty("经络id")
private String meridianId;
@ApiModelProperty("所属经络")
private String meridianDescription;
@ApiModelProperty("主治")
private String attending;
@ApiModelProperty("明理")
private String reasonable;
@ApiModelProperty("定位描述")
private String positionDescription;
@ApiModelProperty("取穴描述")
private String acupointDescription;
@ApiModelProperty("取穴视频描述")
private String videoDescription;
@ApiModelProperty("视频id")
private String videoId;
@ApiModelProperty("视频名称")
private String videoName;
@ApiModelProperty("视频")
private String video;
@ApiModelProperty("编辑时间")
private Date editTime;
@ApiModelProperty("编辑人")
private String editor;
@ApiModelProperty("状态:0待审核,1审核通过,审核未通过")
private Integer status;
@ApiModelProperty("穴位图")
private String acupointImg;
@ApiModelProperty("穴位分类")
private AcupointLibraryDiyType diyType;
@ApiModelProperty("穴位分类")
private List<VideoLibrary> videoList;
}
package com.zrqx.resource.commons.vo.fg.meridianlibrary;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="MeridianLibraryVO",description="经络库VO")
public class FgMeridianLibraryListVO {
@ApiModelProperty("经络id")
private String id;
@ApiModelProperty(value = "经络名称")
private String name;
@ApiModelProperty("活跃时辰id")
private String activeHourId;
@ApiModelProperty("活跃时辰")
private String activeHour;
@ApiModelProperty("对应肺腑")
private BigDecimal viscera;
@ApiModelProperty("编辑人")
private String editor;
@ApiModelProperty("编辑时间")
private Date editTime;
@ApiModelProperty("状态:0待审核,1审核通过,2审核不通过")
private Integer status;
@ApiModelProperty("审核意见")
private String auditOpinion;
}
package com.zrqx.resource.commons.vo.fg.meridianlibrary;
import java.math.BigDecimal;
import java.util.Date;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibraryDiyType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value="MeridianLibraryVO",description="经络库VO")
public class FgMeridianLibraryVO {
@ApiModelProperty("经络id")
private String id;
@ApiModelProperty(value = "经络名称")
private String name;
@ApiModelProperty("活跃时辰id")
private String activeHourId;
@ApiModelProperty("活跃时辰")
private String activeHour;
@ApiModelProperty("对应肺腑")
private BigDecimal viscera;
@ApiModelProperty("循行路线")
private String route;
@ApiModelProperty("主要病候")
private String sickness;
@ApiModelProperty("主治")
private String attending;
@ApiModelProperty("经脉循行图")
private String meridianImg;
@ApiModelProperty("编辑人")
private String editor;
@ApiModelProperty("编辑时间")
private Date editTime;
@ApiModelProperty("状态:0待审核,1审核通过,2审核不通过")
private Integer status;
@ApiModelProperty(value = "分类")
private MeridianLibraryDiyType diyType;
}
...@@ -15,7 +15,7 @@ import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary; ...@@ -15,7 +15,7 @@ import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType; import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation; import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary; import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.bg.acupointlibrary.AcupointLibraryVO; import com.zrqx.resource.commons.vo.fg.acupointlibrary.FgAcupointLibraryVO;
import com.zrqx.resource.fg.service.FgResourceRelationService; import com.zrqx.resource.fg.service.FgResourceRelationService;
import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryDiyTypeService; import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryDiyTypeService;
import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryService; import com.zrqx.resource.fg.service.acupointlibrary.FgAcupointLibraryService;
...@@ -47,9 +47,9 @@ public class FgAcupointLibraryController { ...@@ -47,9 +47,9 @@ public class FgAcupointLibraryController {
@ApiOperation(value = "查询", notes = "根据ID查询") @ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}") @GetMapping(value = "/get/{oid}")
public CallBack<AcupointLibraryVO> getById(@PathVariable String oid) { public CallBack<FgAcupointLibraryVO> getById(@PathVariable String oid) {
AcupointLibrary entity = service.selectByPrimaryKey(oid); AcupointLibrary entity = service.selectByPrimaryKey(oid);
AcupointLibraryVO vo = new AcupointLibraryVO(); FgAcupointLibraryVO vo = new FgAcupointLibraryVO();
BeanUtils.copyProperties(entity,vo); BeanUtils.copyProperties(entity,vo);
Example example = new Example(AcupointLibraryDiyType.class); Example example = new Example(AcupointLibraryDiyType.class);
example.createCriteria().andEqualTo("acupointId",oid); example.createCriteria().andEqualTo("acupointId",oid);
......
package com.zrqx.resource.fg.controller.meridianlibrary; package com.zrqx.resource.fg.controller.meridianlibrary;
import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.exception.BaseException;
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.util.response.CallBack;
import com.zrqx.resource.bg.service.meridianlibrary.MeridianLibraryDiyTypeService;
import com.zrqx.resource.bg.service.meridianlibrary.MeridianLibraryService;
import com.zrqx.resource.commons.form.bg.ReviewForm;
import com.zrqx.resource.commons.form.bg.meridianlibrary.QueryMeridianLibraryForm;
import com.zrqx.resource.commons.form.bg.meridianlibrary.SaveUpdateMeridianLibraryForm;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary; import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibraryDiyType; import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibraryDiyType;
import com.zrqx.resource.commons.vo.bg.hourlibrary.HourLibraryListVO;
import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryListVO;
import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryVO; import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryVO;
import com.zrqx.resource.commons.vo.fg.meridianlibrary.FgMeridianLibraryListVO;
import com.zrqx.resource.fg.service.meridianlibrary.FgMeridianLibraryDiyTypeService;
import com.zrqx.resource.fg.service.meridianlibrary.FgMeridianLibraryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -40,49 +30,11 @@ import tk.mybatis.mapper.entity.Example; ...@@ -40,49 +30,11 @@ import tk.mybatis.mapper.entity.Example;
public class FgMeridianLibraryController { public class FgMeridianLibraryController {
@Autowired @Autowired
private MeridianLibraryService service; private FgMeridianLibraryService service;
@Autowired @Autowired
private MeridianLibraryDiyTypeService diyTypeService; private FgMeridianLibraryDiyTypeService diyTypeService;
@ApiOperation(value = "新增" , notes ="新增一个")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateMeridianLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "更新" , notes ="根据ID更新")
@PostMapping(value = "/update")
public CallBack<Boolean> update(@RequestBody SaveUpdateMeridianLibraryForm form){
if(!service.saveOrUpdate(form)){
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = "/batch/update/status")
public CallBack<Boolean> updateArray(@RequestBody ReviewForm reviewForm) {
Example example = service.createExample();
example.createCriteria().andIn("id", reviewForm.getIds());
MeridianLibrary entity = new MeridianLibrary();
entity.setStatus(reviewForm.getStatus());
entity.setAuditOpinion(reviewForm.getAuditOpinion());
entity.setEditTime(new Date());
if (!service.UpdateByExampleSelective(entity,example)) {
throw new BaseException("操作失败");
}
return CallBack.success();
}
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
public CallBack<Boolean> deleteByIds(@RequestBody List<String> ids) {
return CallBack.success(service.batchDelete(ids));
}
@ApiOperation(value = "查询", notes = "根据ID查询") @ApiOperation(value = "查询", notes = "根据ID查询")
@GetMapping(value = "/get/{oid}") @GetMapping(value = "/get/{oid}")
...@@ -97,15 +49,10 @@ public class FgMeridianLibraryController { ...@@ -97,15 +49,10 @@ public class FgMeridianLibraryController {
return CallBack.success(vo); return CallBack.success(vo);
} }
@ApiOperation(value = "分页查询" , notes ="查询列表")
@GetMapping(value = "/page")
public CallBack<PageInfo<MeridianLibraryListVO>> page(QueryMeridianLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
@ApiOperation(value = "查询全部经络列表", notes = "查询全部经络列表") @ApiOperation(value = "查询全部经络列表", notes = "查询全部经络列表")
@GetMapping(value = "/get/all/list") @GetMapping(value = "/get/all/list")
public CallBack<List<MeridianLibraryListVO>> getAllList() { public CallBack<List<FgMeridianLibraryListVO>> getAllList() {
return CallBack.success(service.getAllList()); return CallBack.success(service.getAllList());
} }
......
...@@ -7,34 +7,14 @@ import org.apache.ibatis.annotations.Select; ...@@ -7,34 +7,14 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm; import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.acupointlibrary.QueryAcupointLibraryForm;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary; import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.vo.bg.acupointlibrary.AcupointLibraryListVO; import com.zrqx.resource.commons.vo.fg.acupointlibrary.FgAcupointLibraryListVO;
/** /**
* 穴位库 * 穴位库
*/ */
public interface FgAcupointLibraryMapper extends BaseMapper<AcupointLibrary> { public interface FgAcupointLibraryMapper extends BaseMapper<AcupointLibrary> {
/** /**
* 分页查询穴位库
* @param form
* @return
*/
@Select("<script>"
+ "select a.id,a.name,a.internationalCode,a.meridian,a.status,a.auditOpinion,a.editTime,a.editor "
+ "from res_acupoint_library a left join res_acupoint_library_diy_type ad "
+ "on a.id = ad.acupointId "
+ "where 1=1 "
+ " like(ad.code,form.diyTypeCode) "
+ " like(a.name,form.name) "
+ " like(a.internationalCode,form.name) "
+ " eq(a.status,form.status) "
+ " eq(a.meridianId,form.meridianId) "
+ " order by a.editTime desc "
+ "</script>")
List<AcupointLibraryListVO> query(@Param("form")QueryAcupointLibraryForm form);
/**
* *
* @param form * @param form
* @return * @return
...@@ -51,6 +31,6 @@ public interface FgAcupointLibraryMapper extends BaseMapper<AcupointLibrary> { ...@@ -51,6 +31,6 @@ public interface FgAcupointLibraryMapper extends BaseMapper<AcupointLibrary> {
+ "</foreach>" + "</foreach>"
+ "</if>" + "</if>"
+ "</script>") + "</script>")
List<AcupointLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm form); List<FgAcupointLibraryListVO> queryByTileAndDiyType(@Param("form")QueryResourceForPoPForm form);
} }
...@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Select; ...@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Select;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.resource.commons.form.bg.meridianlibrary.QueryMeridianLibraryForm; import com.zrqx.resource.commons.form.bg.meridianlibrary.QueryMeridianLibraryForm;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary; import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryListVO; import com.zrqx.resource.commons.vo.fg.meridianlibrary.FgMeridianLibraryListVO;
/** /**
* 经络库 * 经络库
*/ */
...@@ -31,13 +31,13 @@ public interface FgMeridianLibraryMapper extends BaseMapper<MeridianLibrary> { ...@@ -31,13 +31,13 @@ public interface FgMeridianLibraryMapper extends BaseMapper<MeridianLibrary> {
+ " eq(a.activeHourId,form.activeHourId) " + " eq(a.activeHourId,form.activeHourId) "
+ " order by a.editTime desc " + " order by a.editTime desc "
+ "</script>") + "</script>")
List<MeridianLibraryListVO> query(@Param("form")QueryMeridianLibraryForm form); List<FgMeridianLibraryListVO> query(@Param("form")QueryMeridianLibraryForm form);
/** /**
* 查询全部经络列表 * 查询全部经络列表
* @return * @return
*/ */
@Select("select id,name from res_meridian_library") @Select("select id,name from res_meridian_library")
List<MeridianLibraryListVO> getAllList(); List<FgMeridianLibraryListVO> getAllList();
} }
package com.zrqx.resource.fg.service.acupointlibrary; package com.zrqx.resource.fg.service.acupointlibrary;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.enums.resource.LibraryStatusEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl; import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.acupointlibrary.AcupointLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.acupointlibrary.AcupointLibraryMapper; import com.zrqx.resource.bg.mapper.acupointlibrary.AcupointLibraryMapper;
import com.zrqx.resource.bg.mapper.hourlibrary.HourLibraryMapper;
import com.zrqx.resource.bg.mapper.meridianlibrary.MeridianLibraryMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.acupointlibrary.QueryAcupointLibraryForm;
import com.zrqx.resource.commons.form.bg.acupointlibrary.SaveUpdateAcupointLibraryForm;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary; import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibraryDiyType;
import com.zrqx.resource.commons.model.hourlibrary.HourLibrary;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.vo.bg.acupointlibrary.AcupointLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
import tk.mybatis.mapper.entity.Example;
/** /**
* 穴位库 * 穴位库
...@@ -40,107 +17,9 @@ public class FgAcupointLibrarySerivceImpl extends BaseServiceImpl<AcupointLibrar ...@@ -40,107 +17,9 @@ public class FgAcupointLibrarySerivceImpl extends BaseServiceImpl<AcupointLibrar
@Autowired @Autowired
private AcupointLibraryMapper mapper; private AcupointLibraryMapper mapper;
@Autowired
private AcupointLibraryDiyTypeMapper diyTypeMapper;
@Autowired
private MeridianLibraryMapper meridianLibraryMapper;
@Autowired
private HourLibraryMapper hourLibraryMapper;
@Autowired
private Redis redis;
@Override @Override
public BaseMapper<AcupointLibrary> getMapper() { public BaseMapper<AcupointLibrary> getMapper() {
return mapper; return mapper;
} }
/**
* 添加或修改穴位库
*/
@Override
public boolean saveOrUpdate(SaveUpdateAcupointLibraryForm form) {
AcupointLibrary entity = new AcupointLibrary();
BeanUtils.copyProperties(entity, entity);
if(StringUtils.isNotBlank(form.getMeridianId())) {
MeridianLibrary meridianLibrary = meridianLibraryMapper.selectByPrimaryKey(form.getMeridianId());
entity.setMeridian(meridianLibrary.getName());
}
if(entity.getId() == null) {
//添加
entity.setEditor(redis.getUser().getUserName());
entity.setEditorId(redis.getUser().getUserId());
entity.setEditTime(new Date());
mapper.insert(entity);
}else {
//修改
entity.setEditor(redis.getUser().getUserName());
entity.setEditorId(redis.getUser().getUserId());
entity.setEditTime(new Date());
mapper.updateByPrimaryKey(entity);
//删除原有分类
AcupointLibraryDiyType diyType = new AcupointLibraryDiyType();
diyType.setAcupointId(entity.getId());
diyTypeMapper.delete(diyType);
}
//添加当前对象与自定义关系
if(form.getDiyType() != null) {
AcupointLibraryDiyType diyType = new AcupointLibraryDiyType();
diyType.setCode(form.getDiyType().getCode());
diyType.setDtId(form.getDiyType().getDtId());
diyType.setAcupointId(entity.getId());
diyTypeMapper.insert(diyType);
}
return true;
}
/**
* 批量删除
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = new Example(AcupointLibrary.class);
example.createCriteria().andIn("id", ids);
mapper.deleteByExample(example);
//还需删除与自定义分类关系
example = new Example(AcupointLibraryDiyType.class);
example.createCriteria().andIn("acupointId", ids);
diyTypeMapper.deleteByExample(example);
example = new Example(AcupointLibrary.class);
example.createCriteria().andIn("acupointId", ids);
List<HourLibrary> hourLibraryList = hourLibraryMapper.selectByExample(example);
hourLibraryList.forEach(f -> {
f.setAcupoint(null);
f.setAcupoint(null);
hourLibraryMapper.updateByPrimaryKey(f);
});
return true;
}
/**
* 分页查询穴位库
*/
@Override
public PageInfo<AcupointLibraryListVO> page(QueryAcupointLibraryForm form, PageParam pageParam) {
startPage(pageParam);
return new PageInfo<AcupointLibraryListVO>(mapper.query(form));
}
/**
* 选择弹窗中的列表-根据标题和分类查询
*/
@Override
public PageInfo<AcupointLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam) {
if(pageParam != null && StringUtils.isBlank(pageParam.getOrderBy())){
pageParam.setOrderBy("uploadTime desc, id desc");
}
startPage(pageParam);
List<AcupointLibraryListVO> list = mapper.queryByTileAndDiyType(form);
return new PageInfo<AcupointLibraryListVO>(list);
}
} }
package com.zrqx.resource.fg.service.acupointlibrary; package com.zrqx.resource.fg.service.acupointlibrary;
import java.util.List;
import com.zrqx.core.service.BaseService; import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.acupointlibrary.QueryAcupointLibraryForm;
import com.zrqx.resource.commons.form.bg.acupointlibrary.SaveUpdateAcupointLibraryForm;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary; import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.vo.bg.acupointlibrary.AcupointLibraryListVO;
import com.zrqx.resource.commons.vo.bg.videolibrary.VideoLibraryListVO;
/** /**
* 穴位库 * 穴位库
*/ */
public interface FgAcupointLibraryService extends BaseService<AcupointLibrary,String>{ public interface FgAcupointLibraryService extends BaseService<AcupointLibrary,String>{
/**
* 添加或修改穴位库
* @param form
* @return
*/
boolean saveOrUpdate(SaveUpdateAcupointLibraryForm form);
/**
* 批量删除穴位库
* @param ids
* @return
*/
boolean batchDelete(List<String> ids);
/**
* 分页查询穴位库
* @param form
* @param pageParam
* @return
*/
PageInfo<AcupointLibraryListVO> page(QueryAcupointLibraryForm form, PageParam pageParam);
/**
* 选择弹窗中的列表-根据标题和分类查询
* @param f
* @param pageParam
* @return
*/
PageInfo<AcupointLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm f, PageParam pageParam);
} }
package com.zrqx.resource.fg.service.meridianlibrary; package com.zrqx.resource.fg.service.meridianlibrary;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zrqx.core.commons.redis.Redis;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.service.BaseServiceImpl; import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.bean.BeanUtils;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.acupointlibrary.AcupointLibraryMapper;
import com.zrqx.resource.bg.mapper.hourlibrary.HourLibraryMapper;
import com.zrqx.resource.bg.mapper.meridianlibrary.MeridianLibraryDiyTypeMapper;
import com.zrqx.resource.bg.mapper.meridianlibrary.MeridianLibraryMapper;
import com.zrqx.resource.commons.form.bg.meridianlibrary.QueryMeridianLibraryForm;
import com.zrqx.resource.commons.form.bg.meridianlibrary.SaveUpdateMeridianLibraryForm;
import com.zrqx.resource.commons.model.acupointlibrary.AcupointLibrary;
import com.zrqx.resource.commons.model.hourlibrary.HourLibrary;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary; import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibraryDiyType; import com.zrqx.resource.commons.vo.fg.meridianlibrary.FgMeridianLibraryListVO;
import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryListVO; import com.zrqx.resource.fg.mapper.meridianlibrary.FgMeridianLibraryMapper;
import tk.mybatis.mapper.entity.Example;
/** /**
* 经络库 * 经络库
...@@ -35,19 +18,8 @@ import tk.mybatis.mapper.entity.Example; ...@@ -35,19 +18,8 @@ import tk.mybatis.mapper.entity.Example;
public class FgMeridianLibrarySerivceImpl extends BaseServiceImpl<MeridianLibrary,String> implements FgMeridianLibraryService { public class FgMeridianLibrarySerivceImpl extends BaseServiceImpl<MeridianLibrary,String> implements FgMeridianLibraryService {
@Autowired @Autowired
private MeridianLibraryMapper mapper; private FgMeridianLibraryMapper mapper;
@Autowired
private MeridianLibraryDiyTypeMapper diyTypeMapper;
@Autowired
private AcupointLibraryMapper acupointLibraryMapper;
@Autowired
private HourLibraryMapper hourLibraryMapper;
@Autowired
private Redis redis;
@Override @Override
public BaseMapper<MeridianLibrary> getMapper() { public BaseMapper<MeridianLibrary> getMapper() {
...@@ -55,92 +27,10 @@ public class FgMeridianLibrarySerivceImpl extends BaseServiceImpl<MeridianLibrar ...@@ -55,92 +27,10 @@ public class FgMeridianLibrarySerivceImpl extends BaseServiceImpl<MeridianLibrar
} }
/** /**
* 添加或修改经络库
*/
@Override
public boolean saveOrUpdate(SaveUpdateMeridianLibraryForm form) {
MeridianLibrary entity = new MeridianLibrary();
BeanUtils.copyProperties(entity, entity);
if(StringUtils.isNotBlank(form.getActiveHourId())) {
HourLibrary hourLibrary = hourLibraryMapper.selectByPrimaryKey(form.getActiveHourId());
entity.setActiveHour(hourLibrary.getName());
}
if(entity.getId() == null) {
//添加
entity.setEditor(redis.getUser().getUserName());
entity.setEditorId(redis.getUser().getUserId());
entity.setEditTime(new Date());
mapper.insert(entity);
}else {
//修改
entity.setEditor(redis.getUser().getUserName());
entity.setEditorId(redis.getUser().getUserId());
entity.setEditTime(new Date());
mapper.updateByPrimaryKey(entity);
//删除原有分类
MeridianLibraryDiyType diyType = new MeridianLibraryDiyType();
diyType.setMeridianId(entity.getId());
diyTypeMapper.delete(diyType);
}
//添加当前对象与自定义关系
if(form.getDiyType() != null) {
MeridianLibraryDiyType diyType = new MeridianLibraryDiyType();
diyType.setCode(form.getDiyType().getCode());
diyType.setDtId(form.getDiyType().getDtId());
diyType.setMeridianId(entity.getId());
diyTypeMapper.insert(diyType);
}
return true;
}
/**
*批量删除
*/
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Example example = createExample();
example.createCriteria().andIn("id", ids);
mapper.deleteByExample(example);
//还需删除与自定义分类关系
example = new Example(MeridianLibraryDiyType.class);
example.createCriteria().andIn("meridianId", ids);
diyTypeMapper.deleteByExample(example);
example = new Example(AcupointLibrary.class);
example.createCriteria().andIn("meridianId", ids);
List<AcupointLibrary> list = acupointLibraryMapper.selectByExample(example);
list.forEach(f -> {
f.setMeridian(null);
f.setMeridianId(null);
acupointLibraryMapper.updateByPrimaryKey(f);
});
example = new Example(AcupointLibrary.class);
example.createCriteria().andIn("meridianId", ids);
List<HourLibrary> hourLibraryList = hourLibraryMapper.selectByExample(example);
hourLibraryList.forEach(f -> {
f.setAcupoint(null);
f.setAcupoint(null);
hourLibraryMapper.updateByPrimaryKey(f);
});
return true;
}
/**
* 分页查询经络库
*/
@Override
public PageInfo<MeridianLibraryListVO> page(QueryMeridianLibraryForm form, PageParam pageParam) {
startPage(pageParam);
return new PageInfo<MeridianLibraryListVO>(mapper.query(form));
}
/**
* 查询全部经络列表 * 查询全部经络列表
*/ */
@Override @Override
public List<MeridianLibraryListVO> getAllList() { public List<FgMeridianLibraryListVO> getAllList() {
return mapper.getAllList(); return mapper.getAllList();
} }
......
...@@ -3,43 +3,17 @@ package com.zrqx.resource.fg.service.meridianlibrary; ...@@ -3,43 +3,17 @@ package com.zrqx.resource.fg.service.meridianlibrary;
import java.util.List; import java.util.List;
import com.zrqx.core.service.BaseService; import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.commons.form.bg.meridianlibrary.QueryMeridianLibraryForm;
import com.zrqx.resource.commons.form.bg.meridianlibrary.SaveUpdateMeridianLibraryForm;
import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary; import com.zrqx.resource.commons.model.meridianlibrary.MeridianLibrary;
import com.zrqx.resource.commons.vo.bg.meridianlibrary.MeridianLibraryListVO; import com.zrqx.resource.commons.vo.fg.meridianlibrary.FgMeridianLibraryListVO;
/** /**
* 经络库 * 经络库
*/ */
public interface FgMeridianLibraryService extends BaseService<MeridianLibrary,String>{ public interface FgMeridianLibraryService extends BaseService<MeridianLibrary,String>{
/** /**
* 添加或修改经络库
* @param form
* @return
*/
boolean saveOrUpdate(SaveUpdateMeridianLibraryForm form);
/**
* 批量删除经络库
* @param ids
* @return
*/
boolean batchDelete(List<String> ids);
/**
* 分页查询经络库
* @param form
* @param pageParam
* @return
*/
PageInfo<MeridianLibraryListVO> page(QueryMeridianLibraryForm form, PageParam pageParam);
/**
* 查询全部经络列表" * 查询全部经络列表"
* @return * @return
*/ */
List<MeridianLibraryListVO> getAllList(); List<FgMeridianLibraryListVO> getAllList();
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论