|
|
@@ -7,6 +7,7 @@ import com.dk.mdm.model.pojo.mst.MenuFrequency;
|
|
|
import com.dk.mdm.mapper.mst.MenuFrequencyMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.response.mst.MenuFrequencyResponse;
|
|
|
import com.dk.mdm.model.vo.mst.MenuFrequencyVO;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -16,31 +17,37 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
@Transactional
|
|
|
public class MenuFrequencyService extends BaseService<MenuFrequency> {
|
|
|
|
|
|
- @Override
|
|
|
- public BaseMapper<MenuFrequency> getRepository() {
|
|
|
- return menuFrequencyMapper;
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public BaseMapper<MenuFrequency> getRepository() {
|
|
|
+ return menuFrequencyMapper;
|
|
|
+ }
|
|
|
|
|
|
- @Autowired
|
|
|
- private MenuFrequencyMapper menuFrequencyMapper;
|
|
|
+ @Autowired
|
|
|
+ private MenuFrequencyMapper menuFrequencyMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- private MenuFrequencyConvert menuFrequencyConvert;
|
|
|
+ @Autowired
|
|
|
+ private MenuFrequencyConvert menuFrequencyConvert;
|
|
|
|
|
|
- /**
|
|
|
- * @desc : 保存用户功能频率表
|
|
|
- * @author : 周兴
|
|
|
- * @date : 2024/3/28 9:39
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<?> save(MenuFrequencyVO menuFrequencyVO) {
|
|
|
- MenuFrequency menuFrequency = menuFrequencyConvert.convertToPo(menuFrequencyVO);
|
|
|
- menuFrequency.setQty(1);
|
|
|
- // 保存用户功能频率表
|
|
|
- menuFrequencyMapper.save(menuFrequency);
|
|
|
- return ResponseResultUtil.success();
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * @desc : 保存用户功能频率表
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2024/3/28 9:39
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> save(MenuFrequencyVO menuFrequencyVO) {
|
|
|
+ MenuFrequency menuFrequency = menuFrequencyConvert.convertToPo(menuFrequencyVO);
|
|
|
+ // 先查出数量
|
|
|
+ MenuFrequencyResponse mf = menuFrequencyMapper.selectMenuById(menuFrequency);
|
|
|
+ if (mf == null) {
|
|
|
+ menuFrequency.setQty(1);
|
|
|
+ }else{
|
|
|
+ menuFrequency.setQty(mf.getQty() + 1);
|
|
|
+ }
|
|
|
+ // 保存用户功能频率表
|
|
|
+ menuFrequencyMapper.save(menuFrequency);
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
|
|
|
}
|