提交 bb8d7ed0 authored 作者: Mangostiffy's avatar Mangostiffy

新增分享记录接口

上级 1403ae66
...@@ -12,6 +12,7 @@ import javax.annotation.Resource; ...@@ -12,6 +12,7 @@ import javax.annotation.Resource;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
@Controller @Controller
@RequestMapping(value="/api/share",produces = "application/json;charset=UTF-8") @RequestMapping(value="/api/share",produces = "application/json;charset=UTF-8")
...@@ -33,6 +34,9 @@ public class ShareAPi extends BaseController { ...@@ -33,6 +34,9 @@ public class ShareAPi extends BaseController {
if(null==share_store_id||null==shared_store_id){ if(null==share_store_id||null==shared_store_id){
return ResultOutDto.err(null,"缺少参数"); return ResultOutDto.err(null,"缺少参数");
} }
if(share_store_id.equals(shared_store_id)){
return ResultOutDto.err(null,"不能分享自己");
}
DateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String share_time=df.format(new Date()); String share_time=df.format(new Date());
...@@ -45,4 +49,25 @@ public class ShareAPi extends BaseController { ...@@ -45,4 +49,25 @@ public class ShareAPi extends BaseController {
return ResultOutDto.err(null,"错误"); return ResultOutDto.err(null,"错误");
} }
} }
/**
* 列出分享详细内容
* @return
*/
@RequestMapping("/listsharedetial")
@ResponseBody
public ResultOutDto listShareDetial(){
try {
PageData pd=this.getPageData();
String shareed_store=pd.getString("shareed_store");
if(null==shareed_store){
return ResultOutDto.err(null,"缺少参数");
}
List<PageData> list=shareService.listAll(pd);
return ResultOutDto.ok(list);
}catch (Exception e){
e.printStackTrace();
return ResultOutDto.err(null,"错误");
}
}
} }
...@@ -20,4 +20,12 @@ public interface ShareManager { ...@@ -20,4 +20,12 @@ public interface ShareManager {
* @throws Exception * @throws Exception
*/ */
public List<PageData> list(Page page) throws Exception; public List<PageData> list(Page page) throws Exception;
/**
* 列表全部
* @param pd
* @return
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception;
} }
...@@ -30,4 +30,9 @@ public class ShareService implements ShareManager { ...@@ -30,4 +30,9 @@ public class ShareService implements ShareManager {
public List<PageData> list(Page page) throws Exception { public List<PageData> list(Page page) throws Exception {
return (List<PageData>)dao.findForList("ShareMapper.DatalistPage", page); return (List<PageData>)dao.findForList("ShareMapper.DatalistPage", page);
} }
@Override
public List<PageData> listAll(PageData pd) throws Exception {
return (List<PageData>) dao.findForList("ShareMapper.listAll",pd);
}
} }
...@@ -38,4 +38,25 @@ ...@@ -38,4 +38,25 @@
order by share_time desc order by share_time desc
</select> </select>
<!--列表全部-->
<select id="listAll" parameterType="pd" resultType="pd">
select
share_store,
share.store_name as share_store_name,
share.store_logo as share_store_logo,
shareed_store,
shared.store_name as shared_store_name,
shared.store_logo as shared_store_logo,
share_time
from
<include refid="tableName"></include>
inner join c_store as share on share.store_id=<include refid="tableName"></include>.share_store
inner join c_store as shared on shared.store_id=<include refid="tableName"></include>.shareed_store
where 1=1
<if test="shareed_store!= null and shareed_store != ''">
and shareed_store = #{shareed_store}
</if>
order by share_time desc
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论