| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void switchState(Long id) throws GoodsClassException {
|
| | | if (id == null) {
|
| | | throw new GoodsClassException(1, "请传递正确参数");
|
| | | }
|
| | | GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new GoodsClassException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer state = resultObj.getState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1;
|
| | | } else {
|
| | | state = 0;
|
| | | }
|
| | | |
| | | GoodsClass updateObj = new GoodsClass();
|
| | | updateObj.setId(id);
|
| | | updateObj.setState(state);
|
| | | goodsClassMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "classCache", key = "'getEffectiveClassCache'")
|
| | | public List<GoodsClass> getEffectiveClassCache() {
|
| | | return goodsClassMapper.getEffectiveClass();
|