菜品起售停售业务功能开发

master
hahameng 8 months ago
parent 4fa4cc94af
commit f028eb4012

@ -70,4 +70,19 @@ public class DishController {
dishService.delete(ids);
return Result.success();
}
/**
*
*
* @param status
* @param id
*/
@PostMapping("/status/{status}")
public Result startOrStop(@PathVariable Integer status,Long id){
dishService.startOrStop(status,id);
return Result.success();
}
}

@ -59,4 +59,12 @@ public interface DishMapper {
*/
@Delete("delete from dish where id=#{id}")
void delete(Long id);
/**
*
*
* @param dish
*/
@AutoFill(value = OperationType.UPDATE)
void update(Dish dish);
}

@ -33,4 +33,12 @@ public interface DishService {
* @param ids
*/
void delete(List<Long> ids);
/**
*
*
* @param status
* @param id
*/
void startOrStop(Integer status, Long id);
}

@ -124,8 +124,8 @@ public class CategoryServiceImpl implements CategoryService {
Category category=Category.builder()
.id(id)
.status(status)
.updateTime(LocalDateTime.now())
.updateUser(BaseContext.getCurrentId())
/*.updateTime(LocalDateTime.now())
.updateUser(BaseContext.getCurrentId())*/
.build();
categoryMapper.update(category);

@ -113,4 +113,21 @@ public class DishServiceImpl implements DishService {
dishFlavorMapper.deleteByDishId(id);
}
}
/**
*
*
* @param status
* @param id
*/
@Override
public void startOrStop(Integer status, Long id) {
Dish dish = Dish.builder()
.id( id)
.status( status)
.build();
dishMapper.update(dish);
}
}

@ -8,8 +8,8 @@
values (#{name}, #{categoryId}, #{price}, #{image}, #{description}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser}, #{status})
</insert>
<!-- select * from dish d left join category c on d.category_id = c.id
-->
<!-- select * from dish d left join category c on d.category_id = c.id
-->
<!--<select id="pageQuery" resultType="com.sky.vo.DishVO">
select * from category c left join dish d on d.category_id=c.id
<where>
@ -39,4 +39,15 @@
</where>
order by d.create_time desc
</select>
<update id="update">
update dish
<set>
<if test="status != null">
status=#{status},
</if>
</set>
where id=#{id}
</update>
</mapper>
Loading…
Cancel
Save