提交 81f0dfe3 authored 作者: 吴德鹏's avatar 吴德鹏

提交

上级 861b16d1
...@@ -18,4 +18,6 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> { ...@@ -18,4 +18,6 @@ public interface TbCfUserInfoDao extends BaseDao<TbCfUserInfoEntity> {
long queryUserTotal(); long queryUserTotal();
List<String> getUserIdsByNick(String nick); List<String> getUserIdsByNick(String nick);
List<String> getUserIds(String name);
} }
...@@ -6,6 +6,7 @@ import com.platform.service.PostService; ...@@ -6,6 +6,7 @@ import com.platform.service.PostService;
import com.platform.utils.IdUtil; import com.platform.utils.IdUtil;
import com.platform.utils.ShiroUtils; import com.platform.utils.ShiroUtils;
import com.platform.vo.PostVo; import com.platform.vo.PostVo;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -70,6 +71,14 @@ public class PostServiceImpl implements PostService { ...@@ -70,6 +71,14 @@ public class PostServiceImpl implements PostService {
@Override @Override
public List<PostVo> queryList(Map<String, Object> map) { public List<PostVo> queryList(Map<String, Object> map) {
List<PostVo> list = new ArrayList<>(); List<PostVo> list = new ArrayList<>();
String author = (String) map.get("author");
if (!StringUtils.isBlank(author)) {
map.put("ids", tbCfUserInfoDao.getUserIds(author));
}
String topic = (String) map.get("topic");
if (!StringUtils.isBlank(topic)) {
}
List<PostEntity> postList = postDao.queryList(map); List<PostEntity> postList = postDao.queryList(map);
postList.forEach(post -> { postList.forEach(post -> {
String userType = post.getUserType().toString(); String userType = post.getUserType().toString();
......
...@@ -65,14 +65,14 @@ ...@@ -65,14 +65,14 @@
LEFT JOIN ( SELECT count( 1 ) likes, post_id FROM post_like GROUP BY post_id ) l ON p.id = l.post_id LEFT JOIN ( SELECT count( 1 ) likes, post_id FROM post_like GROUP BY post_id ) l ON p.id = l.post_id
WHERE 1=1 WHERE 1=1
and p.archived!=0 and p.archived!=0
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<if test="title != null and title.trim() != ''"> <if test="title != null and title.trim() != ''">
AND caption LIKE concat('%',#{title},'%') AND caption LIKE concat('%',#{title},'%')
</if> </if>
<if test="author != null and author.trim() != ''"> <if test="author != null and author.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND p.user_id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if> </if>
<if test="topic != null and topic.trim() != ''"> <if test="topic != null and topic.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
...@@ -93,14 +93,11 @@ ...@@ -93,14 +93,11 @@
<select id="queryTotal" resultType="int"> <select id="queryTotal" resultType="int">
select count(*) from post select count(*) from post
WHERE 1=1 WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<if test="title != null and title.trim() != ''"> <if test="title != null and title.trim() != ''">
AND caption LIKE concat('%',#{title},'%') AND caption LIKE concat('%',#{title},'%')
</if> </if>
<if test="author != null and author.trim() != ''"> <if test="author != null and author.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND user_id =#{userId}
</if> </if>
<if test="topic != null and topic.trim() != ''"> <if test="topic != null and topic.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
...@@ -151,22 +148,22 @@ ...@@ -151,22 +148,22 @@
<update id="update" parameterType="com.platform.entity.PostEntity"> <update id="update" parameterType="com.platform.entity.PostEntity">
update post update post
<set> <set>
<if test="archived != null">`archived` = #{archived}, </if> <if test="archived != null">`archived` = #{archived},</if>
<if test="archivedBy != null">`archived_by` = #{archivedBy}, </if> <if test="archivedBy != null">`archived_by` = #{archivedBy},</if>
<if test="archivedDate != null">`archived_date` = #{archivedDate}, </if> <if test="archivedDate != null">`archived_date` = #{archivedDate},</if>
<if test="userType != null">`user_type` = #{userType}, </if> <if test="userType != null">`user_type` = #{userType},</if>
<if test="createDate != null">`create_date` = #{createDate}, </if> <if test="createDate != null">`create_date` = #{createDate},</if>
<if test="createdBy != null">`created_by` = #{createdBy}, </if> <if test="createdBy != null">`created_by` = #{createdBy},</if>
<if test="updateDate != null">`update_date` = #{updateDate}, </if> <if test="updateDate != null">`update_date` = #{updateDate},</if>
<if test="updatedBy != null">`updated_by` = #{updatedBy}, </if> <if test="updatedBy != null">`updated_by` = #{updatedBy},</if>
<if test="version != null">`version` = #{version}, </if> <if test="version != null">`version` = #{version},</if>
<if test="picture != null">`picture` = #{picture}, </if> <if test="picture != null">`picture` = #{picture},</if>
<if test="caption != null">`caption` = #{caption}, </if> <if test="caption != null">`caption` = #{caption},</if>
<if test="category != null">`category` = #{category}, </if> <if test="category != null">`category` = #{category},</if>
<if test="userId != null">`user_id` = #{userId}, </if> <if test="userId != null">`user_id` = #{userId},</if>
<if test="isTop != null">`is_top` = #{isTop}, </if> <if test="isTop != null">`is_top` = #{isTop},</if>
<if test="itemIds != null">`item_ids` = #{itemIds}, </if> <if test="itemIds != null">`item_ids` = #{itemIds},</if>
<if test="tagIds != null">`tag_ids` = #{tagIds}, </if> <if test="tagIds != null">`tag_ids` = #{tagIds},</if>
<if test="title != null">`title` = #{title}</if> <if test="title != null">`title` = #{title}</if>
</set> </set>
where id = #{id} where id = #{id}
......
...@@ -96,6 +96,13 @@ ...@@ -96,6 +96,13 @@
<select id="getUserIdsByNick" resultType="string"> <select id="getUserIdsByNick" resultType="string">
select user_id from tb_cf_user_info where nick LIKE concat('%',#{name},'%') select user_id from tb_cf_user_info where nick LIKE concat('%',#{name},'%')
</select> </select>
<select id="getUserIds" resultType="string">
select user_id from tb_cf_user_info where nick LIKE concat('%',#{name},'%')
UNION
select user_id from sys_user where user_name LIKE concat('%',#{name},'%')
</select>
<select id="queryTotal" resultType="int"> <select id="queryTotal" resultType="int">
select count(*) from tb_cf_user_info select count(*) from tb_cf_user_info
WHERE 1=1 WHERE 1=1
......
...@@ -596,7 +596,7 @@ statusFormat = function (cellvalue) { ...@@ -596,7 +596,7 @@ statusFormat = function (cellvalue) {
* @param cellvalue * @param cellvalue
* @returns {string} * @returns {string}
*/ */
status1Format = function (cellvalue) { statusFormat1 = function (cellvalue) {
return cellvalue == 1 ? '正常' : '已删除'; return cellvalue == 1 ? '正常' : '已删除';
}; };
......
...@@ -7,7 +7,7 @@ $(function () { ...@@ -7,7 +7,7 @@ $(function () {
{label: '创建人', name: 'createdBy', index: 'created_by', width: 80}, {label: '创建人', name: 'createdBy', index: 'created_by', width: 80},
{label: '用户ID', name: 'userId', index: 'user_id', width: 80}, {label: '用户ID', name: 'userId', index: 'user_id', width: 80},
{label: '帖子数量', name: 'count', index: 'count', width: 80}, {label: '帖子数量', name: 'count', index: 'count', width: 80},
{label: '状态', name: 'archived', index: 'archived', width: 80, formatter: status1Format}, {label: '状态', name: 'archived', index: 'archived', width: 80, formatter: statusFormat1},
{label: '创建时间', name: 'createDate', index: 'create_date', width: 80} {label: '创建时间', name: 'createDate', index: 'create_date', width: 80}
] ]
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论