Idea代码12月23日更新

This commit is contained in:
Levi 2024-12-23 10:37:37 +08:00
parent a5408cf633
commit 435728c690
6 changed files with 56 additions and 5 deletions

View File

@ -74,7 +74,8 @@ public class OrderController extends BaseController
/**
* 新增订单信息
*/
@PreAuthorize("@ss.hasPermi('system:order:add')")
// @PreAuthorize("@ss.hasPermi('system:order:add')")
@Anonymous
@Log(title = "订单信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Order order)

View File

@ -60,4 +60,10 @@ public interface FavoriteMapper
public int deleteFavoriteByIds(Long[] ids);
public List<Favorite> selectFavoriteList2(Favorite favorite);
public List<Favorite> selectFavoriteListByPersonIdAndCommodityId(Favorite favorite);
public int insertByFavoriteByPersonIdAndCommodityId(Favorite favorite);
public int deleteFavoriteByPersonIdAndCommodityId(Favorite favorite);
}

View File

@ -60,4 +60,10 @@ public interface IFavoriteService
public int deleteFavoriteById(Long id);
public List<Favorite> selectFavoriteList2(Favorite favorite);
public List<Favorite> selectFavoriteListByPersonIdAndCommodityId(Favorite favorite);
public int insertByFavoriteByPersonIdAndCommodityId(Favorite favorite);
public int deleteFavoriteByPersonIdAndCommodityId(Favorite favorite);
}

View File

@ -95,4 +95,19 @@ public class FavoriteServiceImpl implements IFavoriteService
public List<Favorite> selectFavoriteList2(Favorite favorite){
return favoriteMapper.selectFavoriteList2(favorite);
}
@Override
public List<Favorite> selectFavoriteListByPersonIdAndCommodityId(Favorite favorite){
return favoriteMapper.selectFavoriteListByPersonIdAndCommodityId(favorite);
}
@Override
public int insertByFavoriteByPersonIdAndCommodityId(Favorite favorite){
return favoriteMapper.insertByFavoriteByPersonIdAndCommodityId(favorite);
}
@Override
public int deleteFavoriteByPersonIdAndCommodityId(Favorite favorite){
return favoriteMapper.deleteFavoriteByPersonIdAndCommodityId(favorite);
}
}

View File

@ -87,4 +87,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND favorite.personid = p1.id
AND sellerid = p2.id
</select>
<select id="selectFavoriteListByPersonIdAndCommodityId" parameterType="Long" resultType="Favorite">
SELECT
*
FROM
favorite
WHERE
personid = #{personid}
AND commodityid = #{commodityid}
</select>
<insert id="insertByFavoriteByPersonIdAndCommodityId" parameterType="Favorite">
INSERT INTO favorite(personid, commodityid) VALUES(#{personid}, #{commodityid})
</insert>
<delete id="deleteFavoriteByPersonIdAndCommodityId" parameterType="Favorite">
DELETE
FROM
favorite
WHERE
personid = #{personid}
AND commodityid = #{commodityid}
</delete>
</mapper>

View File

@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into order
insert into `order`
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="commodityid != null">commodityid,</if>
<if test="buyerid != null">buyerid,</if>
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateOrder" parameterType="Order">
update order
update `order`
<trim prefix="SET" suffixOverrides=",">
<if test="commodityid != null">commodityid = #{commodityid},</if>
<if test="buyerid != null">buyerid = #{buyerid},</if>
@ -59,11 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteOrderById" parameterType="Long">
delete from order where id = #{id}
delete from `order` where id = #{id}
</delete>
<delete id="deleteOrderByIds" parameterType="String">
delete from order where id in
delete from `order` where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>