Commit ae12606a authored by muhong's avatar muhong

修改 用户和商品收藏关联表表名

parent c3327171
package com.wwdz.ch.db.dao; package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.UsersItemsRelation; import com.wwdz.ch.db.domain.UserItemsRelation;
import com.wwdz.ch.db.domain.UsersItemsRelationExample; import com.wwdz.ch.db.domain.UserItemsRelationExample;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface UsersItemsRelationMapper { public interface UserItemsRelationMapper {
long countByExample(UsersItemsRelationExample example); long countByExample(UserItemsRelationExample example);
int deleteByExample(UsersItemsRelationExample example); int deleteByExample(UserItemsRelationExample example);
int insert(UsersItemsRelation record); int insert(UserItemsRelation record);
int insertSelective(UsersItemsRelation record); int insertSelective(UserItemsRelation record);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
...@@ -24,7 +24,7 @@ public interface UsersItemsRelationMapper { ...@@ -24,7 +24,7 @@ public interface UsersItemsRelationMapper {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
UsersItemsRelation selectOneByExample(UsersItemsRelationExample example); UserItemsRelation selectOneByExample(UserItemsRelationExample example);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
...@@ -33,7 +33,7 @@ public interface UsersItemsRelationMapper { ...@@ -33,7 +33,7 @@ public interface UsersItemsRelationMapper {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
UsersItemsRelation selectOneByExampleSelective(@Param("example") UsersItemsRelationExample example, @Param("selective") UsersItemsRelation.Column ... selective); UserItemsRelation selectOneByExampleSelective(@Param("example") UserItemsRelationExample example, @Param("selective") UserItemsRelation.Column ... selective);
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
...@@ -42,11 +42,11 @@ public interface UsersItemsRelationMapper { ...@@ -42,11 +42,11 @@ public interface UsersItemsRelationMapper {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
List<UsersItemsRelation> selectByExampleSelective(@Param("example") UsersItemsRelationExample example, @Param("selective") UsersItemsRelation.Column ... selective); List<UserItemsRelation> selectByExampleSelective(@Param("example") UserItemsRelationExample example, @Param("selective") UserItemsRelation.Column ... selective);
List<UsersItemsRelation> selectByExample(UsersItemsRelationExample example); List<UserItemsRelation> selectByExample(UserItemsRelationExample example);
int updateByExampleSelective(@Param("record") UsersItemsRelation record, @Param("example") UsersItemsRelationExample example); int updateByExampleSelective(@Param("record") UserItemsRelation record, @Param("example") UserItemsRelationExample example);
int updateByExample(@Param("record") UsersItemsRelation record, @Param("example") UsersItemsRelationExample example); int updateByExample(@Param("record") UserItemsRelation record, @Param("example") UserItemsRelationExample example);
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
* @date 2023/07/21 * @date 2023/07/21
*/ */
@Data @Data
public class UsersItemsRelation implements Serializable { public class UserItemsRelation implements Serializable {
/** /**
* 用户id * 用户id
*/ */
...@@ -47,7 +47,7 @@ public class UsersItemsRelation implements Serializable { ...@@ -47,7 +47,7 @@ public class UsersItemsRelation implements Serializable {
if (getClass() != that.getClass()) { if (getClass() != that.getClass()) {
return false; return false;
} }
UsersItemsRelation other = (UsersItemsRelation) that; UserItemsRelation other = (UserItemsRelation) that;
return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId())); && (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()));
} }
......
...@@ -3,14 +3,14 @@ package com.wwdz.ch.db.domain; ...@@ -3,14 +3,14 @@ package com.wwdz.ch.db.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class UsersItemsRelationExample { public class UserItemsRelationExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
protected List<Criteria> oredCriteria; protected List<Criteria> oredCriteria;
public UsersItemsRelationExample() { public UserItemsRelationExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
...@@ -51,7 +51,7 @@ public class UsersItemsRelationExample { ...@@ -51,7 +51,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public UsersItemsRelationExample orderBy(String orderByClause) { public UserItemsRelationExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause); this.setOrderByClause(orderByClause);
return this; return this;
} }
...@@ -63,7 +63,7 @@ public class UsersItemsRelationExample { ...@@ -63,7 +63,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public UsersItemsRelationExample orderBy(String ... orderByClauses) { public UserItemsRelationExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) { for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]); sb.append(orderByClauses[i]);
...@@ -102,7 +102,7 @@ public class UsersItemsRelationExample { ...@@ -102,7 +102,7 @@ public class UsersItemsRelationExample {
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public static Criteria newAndCreateCriteria() { public static Criteria newAndCreateCriteria() {
UsersItemsRelationExample example = new UsersItemsRelationExample(); UserItemsRelationExample example = new UserItemsRelationExample();
return example.createCriteria(); return example.createCriteria();
} }
...@@ -169,7 +169,7 @@ public class UsersItemsRelationExample { ...@@ -169,7 +169,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdEqualToColumn(UsersItemsRelation.Column column) { public Criteria andUserIdEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id = ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -186,7 +186,7 @@ public class UsersItemsRelationExample { ...@@ -186,7 +186,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdNotEqualToColumn(UsersItemsRelation.Column column) { public Criteria andUserIdNotEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id <> ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -203,7 +203,7 @@ public class UsersItemsRelationExample { ...@@ -203,7 +203,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdGreaterThanColumn(UsersItemsRelation.Column column) { public Criteria andUserIdGreaterThanColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id > ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -220,7 +220,7 @@ public class UsersItemsRelationExample { ...@@ -220,7 +220,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdGreaterThanOrEqualToColumn(UsersItemsRelation.Column column) { public Criteria andUserIdGreaterThanOrEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id >= ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -237,7 +237,7 @@ public class UsersItemsRelationExample { ...@@ -237,7 +237,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdLessThanColumn(UsersItemsRelation.Column column) { public Criteria andUserIdLessThanColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id < ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -254,7 +254,7 @@ public class UsersItemsRelationExample { ...@@ -254,7 +254,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andUserIdLessThanOrEqualToColumn(UsersItemsRelation.Column column) { public Criteria andUserIdLessThanOrEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("user_id <= ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("user_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -301,7 +301,7 @@ public class UsersItemsRelationExample { ...@@ -301,7 +301,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdEqualToColumn(UsersItemsRelation.Column column) { public Criteria andItemIdEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id = ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -318,7 +318,7 @@ public class UsersItemsRelationExample { ...@@ -318,7 +318,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdNotEqualToColumn(UsersItemsRelation.Column column) { public Criteria andItemIdNotEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id <> ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -335,7 +335,7 @@ public class UsersItemsRelationExample { ...@@ -335,7 +335,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdGreaterThanColumn(UsersItemsRelation.Column column) { public Criteria andItemIdGreaterThanColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id > ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -352,7 +352,7 @@ public class UsersItemsRelationExample { ...@@ -352,7 +352,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdGreaterThanOrEqualToColumn(UsersItemsRelation.Column column) { public Criteria andItemIdGreaterThanOrEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id >= ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -369,7 +369,7 @@ public class UsersItemsRelationExample { ...@@ -369,7 +369,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdLessThanColumn(UsersItemsRelation.Column column) { public Criteria andItemIdLessThanColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id < ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -386,7 +386,7 @@ public class UsersItemsRelationExample { ...@@ -386,7 +386,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public Criteria andItemIdLessThanOrEqualToColumn(UsersItemsRelation.Column column) { public Criteria andItemIdLessThanOrEqualToColumn(UserItemsRelation.Column column) {
addCriterion(new StringBuilder("item_id <= ").append(column.getEscapedColumnName()).toString()); addCriterion(new StringBuilder("item_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this; return (Criteria) this;
} }
...@@ -420,7 +420,7 @@ public class UsersItemsRelationExample { ...@@ -420,7 +420,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
private UsersItemsRelationExample example; private UserItemsRelationExample example;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
...@@ -429,7 +429,7 @@ public class UsersItemsRelationExample { ...@@ -429,7 +429,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
protected Criteria(UsersItemsRelationExample example) { protected Criteria(UserItemsRelationExample example) {
super(); super();
this.example = example; this.example = example;
} }
...@@ -441,7 +441,7 @@ public class UsersItemsRelationExample { ...@@ -441,7 +441,7 @@ public class UsersItemsRelationExample {
* @mbg.generated * @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
public UsersItemsRelationExample example() { public UserItemsRelationExample example() {
return this.example; return this.example;
} }
......
package com.wwdz.ch.db.manager;
import com.wwdz.ch.db.domain.UserItemsRelation;
import java.util.List;
public interface UserItemsRelationManager {
List<UserItemsRelation> listByUserIds(Long userId, List<Long> userIds);
}
package com.wwdz.ch.db.manager;
import com.wwdz.ch.db.domain.UsersItemsRelation;
import java.util.List;
public interface UsersItemsRelationManager {
List<UsersItemsRelation> listByUserIds(Long userId, List<Long> userIds);
}
package com.wwdz.ch.db.manager.impl; package com.wwdz.ch.db.manager.impl;
import com.wwdz.ch.db.dao.UsersItemsRelationMapper; import com.wwdz.ch.db.dao.UserItemsRelationMapper;
import com.wwdz.ch.db.domain.UsersItemsRelation; import com.wwdz.ch.db.domain.UserItemsRelation;
import com.wwdz.ch.db.domain.UsersItemsRelationExample; import com.wwdz.ch.db.domain.UserItemsRelationExample;
import com.wwdz.ch.db.manager.UsersItemsRelationManager; import com.wwdz.ch.db.manager.UserItemsRelationManager;
import com.xxdxxs.db.component.JdbcHelper; import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -11,14 +11,14 @@ import org.springframework.stereotype.Repository; ...@@ -11,14 +11,14 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public class UsersItemsRelationManagerImpl implements UsersItemsRelationManager { public class UserItemsRelationManagerImpl implements UserItemsRelationManager {
@Autowired @Autowired
private UsersItemsRelationMapper usersItemsRelationMapper; private UserItemsRelationMapper usersItemsRelationMapper;
@Override @Override
public List<UsersItemsRelation> listByUserIds(Long userId, List<Long> userIds) { public List<UserItemsRelation> listByUserIds(Long userId, List<Long> userIds) {
UsersItemsRelationExample example = new UsersItemsRelationExample(); UserItemsRelationExample example = new UserItemsRelationExample();
UsersItemsRelationExample.Criteria criteria = example.createCriteria(); UserItemsRelationExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(userId, criteria::andUserIdEqualTo); JdbcHelper.ifPresent(userId, criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(userIds, criteria::andUserIdIn); JdbcHelper.ifPresent(userIds, criteria::andUserIdIn);
return usersItemsRelationMapper.selectByExample(example); return usersItemsRelationMapper.selectByExample(example);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wwdz.ch.db.dao.UsersItemsRelationMapper"> <mapper namespace="com.wwdz.ch.db.dao.UserItemsRelationMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.UsersItemsRelation"> <resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.UserItemsRelation">
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="item_id" jdbcType="BIGINT" property="itemId" /> <result column="item_id" jdbcType="BIGINT" property="itemId" />
</resultMap> </resultMap>
...@@ -66,14 +66,14 @@ ...@@ -66,14 +66,14 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
user_id, item_id user_id, item_id
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UsersItemsRelationExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserItemsRelationExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
'true' as QUERYID, 'true' as QUERYID,
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from users_items_relation from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
user_id, item_id user_id, item_id
</otherwise> </otherwise>
</choose> </choose>
from users_items_relation from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -110,18 +110,18 @@ ...@@ -110,18 +110,18 @@
order by ${example.orderByClause} order by ${example.orderByClause}
</if> </if>
</select> </select>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.UsersItemsRelationExample"> <delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.UserItemsRelationExample">
delete from users_items_relation delete from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.UsersItemsRelation"> <insert id="insert" parameterType="com.wwdz.ch.db.domain.UserItemsRelation">
insert into users_items_relation (user_id, item_id) insert into user_items_relation (user_id, item_id)
values (#{userId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}) values (#{userId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UsersItemsRelation"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.UserItemsRelation">
insert into users_items_relation insert into user_items_relation
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
...@@ -139,14 +139,14 @@ ...@@ -139,14 +139,14 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.UsersItemsRelationExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.UserItemsRelationExample" resultType="java.lang.Long">
select count(*) from users_items_relation select count(*) from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update users_items_relation update user_items_relation
<set> <set>
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
...@@ -160,14 +160,14 @@ ...@@ -160,14 +160,14 @@
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update users_items_relation update user_items_relation
set user_id = #{record.userId,jdbcType=BIGINT}, set user_id = #{record.userId,jdbcType=BIGINT},
item_id = #{record.itemId,jdbcType=BIGINT} item_id = #{record.itemId,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UsersItemsRelationExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.UserItemsRelationExample" resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
select select
'true' as QUERYID, 'true' as QUERYID,
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from users_items_relation from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
user_id, item_id user_id, item_id
</otherwise> </otherwise>
</choose> </choose>
from users_items_relation from user_items_relation
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
......
...@@ -3,12 +3,12 @@ package com.wwdz.ch.wx.service.impl; ...@@ -3,12 +3,12 @@ package com.wwdz.ch.wx.service.impl;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.domain.Favorites; import com.wwdz.ch.db.domain.Favorites;
import com.wwdz.ch.db.domain.FavoritesItemsRelation; import com.wwdz.ch.db.domain.FavoritesItemsRelation;
import com.wwdz.ch.db.domain.UsersItemsRelation; import com.wwdz.ch.db.domain.UserItemsRelation;
import com.wwdz.ch.db.dto.request.CoinRequestDto; import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.manager.FavoritesItemsRelationManager; import com.wwdz.ch.db.manager.FavoritesItemsRelationManager;
import com.wwdz.ch.db.manager.FavoritesManager; import com.wwdz.ch.db.manager.FavoritesManager;
import com.wwdz.ch.db.manager.ItemManager; import com.wwdz.ch.db.manager.ItemManager;
import com.wwdz.ch.db.manager.UsersItemsRelationManager; import com.wwdz.ch.db.manager.UserItemsRelationManager;
import com.wwdz.ch.wx.entity.request.FavoritesItemRequestDto; import com.wwdz.ch.wx.entity.request.FavoritesItemRequestDto;
import com.wwdz.ch.wx.entity.request.FavoritesRequestDto; import com.wwdz.ch.wx.entity.request.FavoritesRequestDto;
import com.wwdz.ch.wx.service.FavoritesService; import com.wwdz.ch.wx.service.FavoritesService;
...@@ -34,7 +34,7 @@ public class FavoritesServiceImpl implements FavoritesService { ...@@ -34,7 +34,7 @@ public class FavoritesServiceImpl implements FavoritesService {
@Autowired @Autowired
private FavoritesItemsRelationManager favoritesItemsRelationManager; private FavoritesItemsRelationManager favoritesItemsRelationManager;
@Autowired @Autowired
private UsersItemsRelationManager usersItemsRelationManager; private UserItemsRelationManager userItemsRelationManager;
@Autowired @Autowired
private ItemManager itemManager; private ItemManager itemManager;
...@@ -143,10 +143,10 @@ public class FavoritesServiceImpl implements FavoritesService { ...@@ -143,10 +143,10 @@ public class FavoritesServiceImpl implements FavoritesService {
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
List<Long> favoritesItemsIds = list.stream() List<Long> favoritesItemsIds = list.stream()
.map(FavoritesItemsRelation::getItemId).collect(Collectors.toList()); .map(FavoritesItemsRelation::getItemId).collect(Collectors.toList());
List<UsersItemsRelation> usersItemsList = usersItemsRelationManager.listByUserIds(dto.getUserId(), null); List<UserItemsRelation> usersItemsList = userItemsRelationManager.listByUserIds(dto.getUserId(), null);
if (CollectionUtils.isNotEmpty(usersItemsList)) { if (CollectionUtils.isNotEmpty(usersItemsList)) {
List<Long> usersItemsIds = usersItemsList.stream() List<Long> usersItemsIds = usersItemsList.stream()
.map(UsersItemsRelation::getItemId).collect(Collectors.toList()); .map(UserItemsRelation::getItemId).collect(Collectors.toList());
List<Long> itemIds = favoritesItemsIds.stream() List<Long> itemIds = favoritesItemsIds.stream()
.filter(usersItemsIds::contains).collect(Collectors.toList()); .filter(usersItemsIds::contains).collect(Collectors.toList());
CoinRequestDto coinRequestDto = new CoinRequestDto(); CoinRequestDto coinRequestDto = new CoinRequestDto();
...@@ -173,10 +173,10 @@ public class FavoritesServiceImpl implements FavoritesService { ...@@ -173,10 +173,10 @@ public class FavoritesServiceImpl implements FavoritesService {
public Result removeItem(FavoritesItemRequestDto dto) { public Result removeItem(FavoritesItemRequestDto dto) {
try { try {
// 批量删除收藏册下用户创建的钱币 // 批量删除收藏册下用户创建的钱币
List<UsersItemsRelation> usersItemsList = usersItemsRelationManager.listByUserIds(dto.getUserId(), null); List<UserItemsRelation> usersItemsList = userItemsRelationManager.listByUserIds(dto.getUserId(), null);
if (CollectionUtils.isNotEmpty(usersItemsList)) { if (CollectionUtils.isNotEmpty(usersItemsList)) {
List<Long> usersItemsIds = usersItemsList.stream() List<Long> usersItemsIds = usersItemsList.stream()
.map(UsersItemsRelation::getItemId).collect(Collectors.toList()); .map(UserItemsRelation::getItemId).collect(Collectors.toList());
List<Long> itemIds = dto.getItemIds().stream() List<Long> itemIds = dto.getItemIds().stream()
.filter(usersItemsIds::contains).collect(Collectors.toList()); .filter(usersItemsIds::contains).collect(Collectors.toList());
CoinRequestDto coinRequestDto = new CoinRequestDto(); CoinRequestDto coinRequestDto = new CoinRequestDto();
......
...@@ -9,6 +9,7 @@ import com.xxdxxs.support.Delete; ...@@ -9,6 +9,7 @@ import com.xxdxxs.support.Delete;
import com.xxdxxs.support.Insert; import com.xxdxxs.support.Insert;
import com.xxdxxs.support.Select; import com.xxdxxs.support.Select;
import com.xxdxxs.support.Update; import com.xxdxxs.support.Update;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -29,26 +30,31 @@ public class WxFavoritesController { ...@@ -29,26 +30,31 @@ public class WxFavoritesController {
@Autowired @Autowired
private FavoritesService favoritesService; private FavoritesService favoritesService;
@ApiOperation(value = "分页查询")
@PostMapping("/page") @PostMapping("/page")
public Result page(@RequestBody @Validated(Page.class)FavoritesRequestDto dto) { public Result page(@RequestBody @Validated(Page.class)FavoritesRequestDto dto) {
return favoritesService.page(dto); return favoritesService.page(dto);
} }
@ApiOperation(value = "新增")
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody @Validated(Insert.class)FavoritesRequestDto dto) { public Result add(@RequestBody @Validated(Insert.class)FavoritesRequestDto dto) {
return favoritesService.add(dto); return favoritesService.add(dto);
} }
@ApiOperation(value = "修改")
@PostMapping("/update") @PostMapping("/update")
public Result update(@RequestBody @Validated(Update.class)FavoritesRequestDto dto) { public Result update(@RequestBody @Validated(Update.class)FavoritesRequestDto dto) {
return favoritesService.update(dto); return favoritesService.update(dto);
} }
@ApiOperation(value = "详情")
@PostMapping("/info") @PostMapping("/info")
public Result info(@RequestBody @Validated(Select.class) FavoritesRequestDto dto) { public Result info(@RequestBody @Validated(Select.class) FavoritesRequestDto dto) {
return favoritesService.info(dto); return favoritesService.info(dto);
} }
@ApiOperation(value = "单个删除")
@PostMapping("/delete") @PostMapping("/delete")
public Result delete(@RequestBody @Validated(Delete.class) FavoritesRequestDto dto) { public Result delete(@RequestBody @Validated(Delete.class) FavoritesRequestDto dto) {
if (Objects.isNull(dto.getId())) { if (Objects.isNull(dto.getId())) {
...@@ -57,6 +63,7 @@ public class WxFavoritesController { ...@@ -57,6 +63,7 @@ public class WxFavoritesController {
return favoritesService.delete(dto); return favoritesService.delete(dto);
} }
@ApiOperation(value = "批量删除")
@PostMapping("/batchDelete") @PostMapping("/batchDelete")
public Result batchDelete(@RequestBody @Validated(Delete.class) FavoritesRequestDto dto) { public Result batchDelete(@RequestBody @Validated(Delete.class) FavoritesRequestDto dto) {
if (CollectionUtils.isEmpty(dto.getIds())) { if (CollectionUtils.isEmpty(dto.getIds())) {
...@@ -65,6 +72,7 @@ public class WxFavoritesController { ...@@ -65,6 +72,7 @@ public class WxFavoritesController {
return favoritesService.batchDelete(dto); return favoritesService.batchDelete(dto);
} }
@ApiOperation(value = "移除藏品")
@PostMapping("/removeItem") @PostMapping("/removeItem")
public Result removeItem(@RequestBody FavoritesItemRequestDto dto) { public Result removeItem(@RequestBody FavoritesItemRequestDto dto) {
if (Objects.isNull(dto.getFavoritesId())) { if (Objects.isNull(dto.getFavoritesId())) {
......
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