方药-药列表返回结果修改,增加排序点击量
This commit is contained in:
@@ -36,22 +36,22 @@ public class MedicinalMaterialsController {
|
||||
@RequestMapping("/getMaterialsList")
|
||||
public R getMaterialsList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<MedicinalMaterials> wrapper = new MPJLambdaWrapper();
|
||||
if (params.containsKey("name")&&StringUtils.isNotEmpty(params.get("name").toString())){
|
||||
wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()),t->t.like(MedicinalMaterials::getName,params.get("name")).or().like(MedicinalMaterials::getOthername,params.get("name")));
|
||||
wrapper.select("id,name,img,latinname,othername,effect,taste,property,tropism,type,sort,hits");
|
||||
if (StringUtils.isNotEmpty(params.get("name").toString())){
|
||||
wrapper.and(t->t.like(MedicinalMaterials::getName,params.get("name"))
|
||||
.or().like(MedicinalMaterials::getOthername,params.get("name")));
|
||||
}
|
||||
if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){
|
||||
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
||||
wrapper.like(MedicinalMaterials::getType,params.get("type"));
|
||||
}
|
||||
if (params.containsKey("taste")&&StringUtils.isNotEmpty(params.get("taste").toString())){
|
||||
wrapper.like(MedicinalMaterials::getProperty,params.get("taste"));
|
||||
}
|
||||
if (params.containsKey("property")&&StringUtils.isNotEmpty(params.get("property").toString())){
|
||||
wrapper.like(MedicinalMaterials::getProperty,params.get("property"));
|
||||
}
|
||||
if (params.containsKey("tropism")&&StringUtils.isNotEmpty(params.get("tropism").toString())){
|
||||
wrapper.like(MedicinalMaterials::getProperty,params.get("tropism"));
|
||||
if (StringUtils.isNotEmpty(params.get("effect").toString())){
|
||||
wrapper.like(MedicinalMaterials::getEffect,params.get("effect"));
|
||||
}
|
||||
wrapper.and(t->t.like(MedicinalMaterials::getProperty,params.get("taste"))
|
||||
.or().like(MedicinalMaterials::getProperty,params.get("property"))
|
||||
.or().like(MedicinalMaterials::getProperty,params.get("tropism")));
|
||||
wrapper.orderByAsc(MedicinalMaterials::getSort);
|
||||
wrapper.orderByDesc(MedicinalMaterials::getHits);
|
||||
Page<MedicinalMaterials> page = materialsService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
@@ -59,7 +59,11 @@ public class MedicinalMaterialsController {
|
||||
|
||||
@RequestMapping(path = "/getMaterials")
|
||||
public R getMaterials(String id) {
|
||||
return R.ok().put("result", materialsService.getById(id));
|
||||
MedicinalMaterials materials = materialsService.getById(id);
|
||||
int hits = materials.getHits() + 1;
|
||||
materials.setHits(hits);
|
||||
materialsService.saveOrUpdate(materials);
|
||||
return R.ok().put("result", materials);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateMaterials")
|
||||
@@ -81,25 +85,27 @@ public class MedicinalMaterialsController {
|
||||
@RequestMapping("/getDrugList")
|
||||
public R getDrugList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<MedicinalDrug> wrapper = new MPJLambdaWrapper();
|
||||
if (params.containsKey("name")&&StringUtils.isNotEmpty(params.get("name").toString())){
|
||||
wrapper.select("id,name,english_name,pinyin_name,kind,prescription_type,insurance_type,type,sort,hits");
|
||||
if (StringUtils.isNotEmpty(params.get("name").toString())){
|
||||
wrapper.and(StringUtils.isNotEmpty(params.get("name").toString()),
|
||||
t->t.like(MedicinalDrug::getName,params.get("name"))
|
||||
.or().like(MedicinalDrug::getEnglishName,params.get("name"))
|
||||
.or().like(MedicinalDrug::getPinyinName,params.get("name")));
|
||||
}
|
||||
if (params.containsKey("kind")&&StringUtils.isNotEmpty(params.get("kind").toString())){
|
||||
if (StringUtils.isNotEmpty(params.get("kind").toString())){
|
||||
wrapper.like(MedicinalDrug::getKind,params.get("kind"));
|
||||
}
|
||||
if (params.containsKey("prescriptionType")&&StringUtils.isNotEmpty(params.get("prescriptionType").toString())){
|
||||
if (StringUtils.isNotEmpty(params.get("prescriptionType").toString())){
|
||||
wrapper.like(MedicinalDrug::getPrescriptionType,params.get("prescriptionType"));
|
||||
}
|
||||
if (params.containsKey("insuranceType")&&StringUtils.isNotEmpty(params.get("insuranceType").toString())){
|
||||
if (StringUtils.isNotEmpty(params.get("insuranceType").toString())){
|
||||
wrapper.like(MedicinalDrug::getInsuranceType,params.get("insuranceType"));
|
||||
}
|
||||
if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){
|
||||
if (StringUtils.isNotEmpty(params.get("type").toString())){
|
||||
wrapper.like(MedicinalDrug::getType,params.get("type"));
|
||||
}
|
||||
wrapper.orderByAsc(MedicinalDrug::getSort);
|
||||
wrapper.orderByDesc(MedicinalDrug::getHits);
|
||||
Page<MedicinalDrug> page = drugService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
@@ -107,7 +113,11 @@ public class MedicinalMaterialsController {
|
||||
|
||||
@RequestMapping(path = "/getDrug")
|
||||
public R getDrug(String id) {
|
||||
return R.ok().put("result", drugService.getById(id));
|
||||
MedicinalDrug drug = drugService.getById(id);
|
||||
int hits = drug.getHits() + 1;
|
||||
drug.setHits(hits);
|
||||
drugService.saveOrUpdate(drug);
|
||||
return R.ok().put("result", drug);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateDrug")
|
||||
|
||||
@@ -63,6 +63,11 @@ public class MedicinalDrug {
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 点击量
|
||||
*/
|
||||
private Integer hits;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@ public class MedicinalMaterials {
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 点击量
|
||||
*/
|
||||
private Integer hits;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user