Commit 9c4547ce authored by 廖旭伟's avatar 廖旭伟

增加通过模板id删除客户收藏

parent 54c50177
......@@ -4738,6 +4738,42 @@ msg|String|消息|-
```
### 通过模板id删除客户收藏信息
**请求URL:** customer/work/collect/delete/masterplateId
**请求方式:** GET
**内容类型:** application/json;charset=utf-8
**简要描述:** 删除客户收藏信息
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
id|Long|是|模板id
**请求样例:**
```
http://localhost:8080/customer/work/collect/delete/masterplateId?id=1
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
### 个人信息
**请求URL:** customer/info
......
package com.mortals.xhx.module.customer.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
/**
......@@ -11,4 +12,5 @@ import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
*/
public interface CustomerWorkCollectService extends ICRUDService<CustomerWorkCollectEntity,Long>{
int removeByMasterplateId(Long masterplateId, Context context);
}
\ No newline at end of file
......@@ -45,4 +45,12 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust
throw new AppException("已收藏此模板,请勿重复收藏");
}
}
@Override
public int removeByMasterplateId(Long masterplateId, Context context) {
CustomerWorkCollectEntity condition = new CustomerWorkCollectEntity();
condition.setMasterplateId(masterplateId);
condition.setCustomerId(this.getContextUserId(context));
return this.dao.delete(condition);
}
}
\ No newline at end of file
......@@ -56,4 +56,30 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro
query.setCustomerId(this.getCurUser().getId());
}
@RequestMapping(value = {"delete/masterplateId"},method = {RequestMethod.POST, RequestMethod.GET})
public String deleteByMasterplateId(Long id) {
Context context = this.getContext();
if (id == null) {
return this.createFailJsonResp("请至少选择一条记录");
} else {
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "删除" + this.getModuleDesc();
try {
int iRet = this.service.removeByMasterplateId(id, context);
model.put("message_info", this.getModuleDesc() + "删除成功!删除条数:" + iRet);
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + id + "]");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
}
\ 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