This commit is contained in:
linfso 2024-08-31 13:50:06 +08:00
parent 34ff578fa9
commit 420d924f31
11 changed files with 91 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import com.xdadan.erp.oms.service.IEmisArticleLikeRecordService;
import com.xdadan.erp.oms.service.IEmisArticleService; import com.xdadan.erp.oms.service.IEmisArticleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -55,6 +56,15 @@ public class Oms2cArticleController extends BaseController
{ {
startPage(); startPage();
List<EmisArticle> list = emisArticleService.selectEmisArticleList(emisArticle); List<EmisArticle> list = emisArticleService.selectEmisArticleList(emisArticle);
if(!CollectionUtils.isEmpty(list)){
for (EmisArticle art:list) {
EmisArticleLikeRecord emisArticleLikeRecord = new EmisArticleLikeRecord();
emisArticleLikeRecord.setArticleId(art.getId());
emisArticleLikeRecord.setUserId(getUserId());
int cnt=emisArticleLikeRecordService.checkIsGiveLike(emisArticleLikeRecord);
art.setIsGiveLike(String.valueOf(cnt));
}
}
return getDataTable(list); return getDataTable(list);
} }
@ -76,6 +86,9 @@ public class Oms2cArticleController extends BaseController
@GetMapping("/getDetail") @GetMapping("/getDetail")
public AjaxResult getDetail(Long id) public AjaxResult getDetail(Long id)
{ {
// 更新点击次数
emisArticleService.addArticleClickCount(id);
return AjaxResult.success(emisArticleService.selectEmisArticleById(id)); return AjaxResult.success(emisArticleService.selectEmisArticleById(id));
} }
@ -94,6 +107,7 @@ public class Oms2cArticleController extends BaseController
}else{ }else{
upd.setIsGiveLike("1"); upd.setIsGiveLike("1");
} }
return toAjax(emisArticleLikeRecordService.updateEmisArticleLikeRecord(upd)); return toAjax(emisArticleLikeRecordService.updateEmisArticleLikeRecord(upd));
}else{ }else{

View File

@ -14,6 +14,7 @@ package com.xdadan.erp.oms.web;
import com.xdadan.erp.oms.common.core.controller.BaseController; import com.xdadan.erp.oms.common.core.controller.BaseController;
import com.xdadan.erp.oms.common.core.domain.AjaxResult; import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser; import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser;
import com.xdadan.erp.oms.system.service.ISysOmsUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -33,6 +34,11 @@ import java.util.List;
public class Oms2cCustomerUserController extends BaseController public class Oms2cCustomerUserController extends BaseController
{ {
@Autowired
private ISysOmsUserService sysOmsUserService;
/** /**
* 实名认证 * 实名认证
* @param emisCustomerUser * @param emisCustomerUser
@ -42,6 +48,9 @@ public class Oms2cCustomerUserController extends BaseController
public AjaxResult idVerification(@RequestBody SysOmsUser emisCustomerUser) public AjaxResult idVerification(@RequestBody SysOmsUser emisCustomerUser)
{ {
try { try {
SysOmsUser user=sysOmsUserService.selectSysOmsUserById(getLoginUser().getUser().getId());
// EmisCustomerUser oldUser=emisBaseService.getCustomerUserByPhone(emisCustomerUser.getPhone()); // EmisCustomerUser oldUser=emisBaseService.getCustomerUserByPhone(emisCustomerUser.getPhone());
// if(oldUser!=null){ // if(oldUser!=null){
// return AjaxResult.error("该客户电话号码已被占用,请使用新号码"); // return AjaxResult.error("该客户电话号码已被占用,请使用新号码");

View File

@ -46,7 +46,9 @@ public interface EmisArticleLikeRecordMapper extends BaseMapper<EmisArticleLikeR
* @return 数量 * @return 数量
*/ */
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord); public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord);
/** /**
* 新增 * 新增

View File

@ -64,6 +64,12 @@ public interface EmisArticleMapper extends BaseMapper<EmisArticle>
*/ */
public int updateEmisArticle(EmisArticle emisArticle); public int updateEmisArticle(EmisArticle emisArticle);
public int addArticleClickCount(Long id);
public int minusArticleClickCount(Long id);
/** /**
* 删除 * 删除
* *

View File

@ -46,6 +46,9 @@ package com.xdadan.erp.oms.service;
*/ */
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord); public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord);
/** /**
* 新增文章点赞记录 * 新增文章点赞记录
* *

View File

@ -62,6 +62,13 @@ package com.xdadan.erp.oms.service;
*/ */
public int updateEmisArticle(EmisArticle emisArticle); public int updateEmisArticle(EmisArticle emisArticle);
public int addArticleClickCount(Long id);
public int minusArticleClickCount(Long id);
/** /**
* 批量删除文章管理 * 批量删除文章管理
* *

View File

@ -10,6 +10,7 @@
package com.xdadan.erp.oms.service.impl; package com.xdadan.erp.oms.service.impl;
import com.xdadan.erp.oms.domain.EmisArticle;
import com.xdadan.erp.oms.domain.EmisArticleCat; import com.xdadan.erp.oms.domain.EmisArticleCat;
import com.xdadan.erp.oms.mapper.EmisArticleCatMapper; import com.xdadan.erp.oms.mapper.EmisArticleCatMapper;
import com.xdadan.erp.oms.service.IEmisArticleCatService; import com.xdadan.erp.oms.service.IEmisArticleCatService;
@ -91,6 +92,10 @@ package com.xdadan.erp.oms.service.impl;
return emisArticleCatMapper.updateEmisArticleCat(emisArticleCat); return emisArticleCatMapper.updateEmisArticleCat(emisArticleCat);
} }
/** /**
* 批量删除文章类型 * 批量删除文章类型
* *

View File

@ -67,6 +67,13 @@ package com.xdadan.erp.oms.service.impl;
return emisArticleLikeRecordMapper.checkUnique(emisArticleLikeRecord); return emisArticleLikeRecordMapper.checkUnique(emisArticleLikeRecord);
} }
@Override
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord)
{
return emisArticleLikeRecordMapper.checkIsGiveLike(emisArticleLikeRecord);
}
/** /**
* 新增文章点赞记录 * 新增文章点赞记录
* *

View File

@ -11,6 +11,7 @@
package com.xdadan.erp.oms.service.impl; package com.xdadan.erp.oms.service.impl;
import com.xdadan.erp.oms.domain.EmisArticle; import com.xdadan.erp.oms.domain.EmisArticle;
import com.xdadan.erp.oms.domain.EmisArticleCat;
import com.xdadan.erp.oms.mapper.EmisArticleMapper; import com.xdadan.erp.oms.mapper.EmisArticleMapper;
import com.xdadan.erp.oms.service.IEmisArticleService; import com.xdadan.erp.oms.service.IEmisArticleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -115,4 +116,20 @@ package com.xdadan.erp.oms.service.impl;
return emisArticleMapper.deleteEmisArticleById(id); return emisArticleMapper.deleteEmisArticleById(id);
} }
@Override
public int addArticleClickCount(Long id)
{
return emisArticleMapper.addArticleClickCount(id);
}
@Override
public int minusArticleClickCount(Long id)
{
return emisArticleMapper.minusArticleClickCount(id);
}
} }

View File

@ -31,6 +31,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc order by create_time desc
</select> </select>
<select id="checkIsGiveLike" parameterType="EmisArticleLikeRecord" resultType="int">
select count(1) from emis_article_like_record
where del_flag='0'
and article_id = #{articleId}
and user_id = #{userId}
and is_give_like ='1'
limit 1
</select>
<select id="checkUnique" parameterType="EmisArticleLikeRecord" resultType="int"> <select id="checkUnique" parameterType="EmisArticleLikeRecord" resultType="int">
select count(1) from emis_article_like_record select count(1) from emis_article_like_record
where del_flag='0' where del_flag='0'

View File

@ -174,6 +174,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="addArticleClickCount" parameterType="EmisArticle">
update emis_article set click_count=click_count+1 where id = #{id}
</update>
<update id="minusArticleClickCount" parameterType="EmisArticle">
update emis_article set click_count=click_count-1 where id = #{id}
</update>
<delete id="deleteEmisArticleById" parameterType="Long"> <delete id="deleteEmisArticleById" parameterType="Long">
delete from emis_article where id = #{id} delete from emis_article where id = #{id}
</delete> </delete>