bug 食堂修改

This commit is contained in:
lizhenhua 2025-08-08 16:47:10 +08:00
parent d91d4ad1cd
commit a25c579aa1
3 changed files with 21 additions and 20 deletions

View File

@ -6,14 +6,14 @@ import org.apache.ibatis.annotations.Param;
/**
* 地址信息Mapper接口
*
*
* @author xsheng
* @date 2025-04-14
*/
public interface UserAddrMapper {
/**
* 查询地址信息
*
*
* @param id 地址信息主键
* @return 地址信息
*/
@ -21,7 +21,7 @@ public interface UserAddrMapper {
/**
* 查询地址信息列表
*
*
* @param userAddr 地址信息
* @return 地址信息集合
*/
@ -29,7 +29,7 @@ public interface UserAddrMapper {
/**
* 新增地址信息
*
*
* @param userAddr 地址信息
* @return 结果
*/
@ -37,7 +37,7 @@ public interface UserAddrMapper {
/**
* 修改地址信息
*
*
* @param userAddr 地址信息
* @return 结果
*/
@ -47,11 +47,11 @@ public interface UserAddrMapper {
int updateUserAddrAsNotDefault(@Param("userId") Long userId, @Param("ifDefault") Integer ifDefault);
int updateUserAddrAsDefault(@Param("userId") Long userId, @Param("id") Long id, @Param("ifDefault") Integer ifDefault);
int updateUserAddrAsDefault(@Param("userId") Long userId, @Param("addrId") Long id, @Param("ifDefault") Integer ifDefault);
/**
* 删除地址信息
*
*
* @param id 地址信息主键
* @return 结果
*/
@ -59,7 +59,7 @@ public interface UserAddrMapper {
/**
* 批量删除地址信息
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/

View File

@ -14,7 +14,7 @@ import com.bonus.canteen.core.user.service.IUserAddrService;
/**
* 地址信息Service业务层处理
*
*
* @author xsheng
* @date 2025-04-14
*/
@ -25,7 +25,7 @@ public class UserAddrServiceImpl implements IUserAddrService {
/**
* 查询地址信息
*
*
* @param id 地址信息主键
* @return 地址信息
*/
@ -36,7 +36,7 @@ public class UserAddrServiceImpl implements IUserAddrService {
/**
* 查询地址信息列表
*
*
* @param userAddr 地址信息
* @return 地址信息
*/
@ -48,7 +48,7 @@ public class UserAddrServiceImpl implements IUserAddrService {
/**
* 新增地址信息
*
*
* @param userAddr 地址信息
* @return 结果
*/
@ -65,7 +65,7 @@ public class UserAddrServiceImpl implements IUserAddrService {
/**
* 修改地址信息
*
*
* @param userAddr 地址信息
* @return 结果
*/
@ -88,13 +88,14 @@ public class UserAddrServiceImpl implements IUserAddrService {
userAddrMapper.updateUserAddrAsDefault(userAddr.getUserId(), userAddr.getAddrId(), YesOrNoEnum.YES.key());
return 1;
} catch (Exception e) {
e.printStackTrace();
throw new ServiceException("设置默认地址失败");
}
}
/**
* 批量删除地址信息
*
*
* @param ids 需要删除的地址信息主键
* @return 结果
*/
@ -105,7 +106,7 @@ public class UserAddrServiceImpl implements IUserAddrService {
/**
* 删除地址信息信息
*
*
* @param id 地址信息主键
* @return 结果
*/

View File

@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserAddrList" parameterType="com.bonus.canteen.core.user.domain.UserAddr" resultMap="UserAddrResult">
<include refid="selectUserAddrVo"/>
<where>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="addrId != null "> and addr_id = #{addrId}</if>
<if test="contactName != null and contactName != ''"> and contact_name like concat('%', #{contactName}, '%')</if>
@ -37,12 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ifDefault != null "> and if_default = #{ifDefault}</if>
</where>
</select>
<select id="selectUserAddrById" parameterType="Long" resultMap="UserAddrResult">
<include refid="selectUserAddrVo"/>
where id = #{id}
</select>
<insert id="insertUserAddr" parameterType="com.bonus.canteen.core.user.domain.UserAddr" useGeneratedKeys="true" keyProperty="addrId">
insert into user_addr
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteUserAddrById" parameterType="Long">
delete from user_addr where addr_id = #{addrId}
delete from user_addr where addr_id = #{id}
</delete>
<delete id="deleteUserAddrByIds" parameterType="String">
@ -109,4 +109,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{addrId}
</foreach>
</delete>
</mapper>
</mapper>