1
zj
2025-07-10 37670b2ff5379e8603d3b0eec6d493daf2d6cfcb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.nq.service.impl;
 
import com.nq.common.ServerResponse;
import com.nq.dao.SiteProductMapper;
import com.nq.pojo.SiteProduct;
import com.nq.service.ISiteProductService;
 
import java.util.List;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service("iSiteProductService")
public class SiteProductServiceImpl
        implements ISiteProductService {
    private static final Logger log = LoggerFactory.getLogger(SiteProductServiceImpl.class);
 
    @Autowired
    SiteProductMapper siteProductMapper;
 
    public ServerResponse update(SiteProduct siteProduct) {
        if (siteProduct.getId() == null) {
            return ServerResponse.createByErrorMsg("修改id不能为空");
        }
        SiteProduct dbproduct = this.siteProductMapper.selectByPrimaryKey(siteProduct.getId());
        if (dbproduct == null) {
            return ServerResponse.createByErrorMsg("不存在产品设置记录");
        }
 
        int updateCount = this.siteProductMapper.updateByPrimaryKeySelective(siteProduct);
        if (updateCount > 0) {
            return ServerResponse.createBySuccessMsg("修改成功");
        }
        return ServerResponse.createByErrorMsg("修改失败");
    }
 
    public SiteProduct getProductSetting() {
        SiteProduct siteProduct = null;
        List list = this.siteProductMapper.findAllSiteSetting();
        if (list.size() > 0) {
            siteProduct = (SiteProduct)list.get(0);
        }
        return siteProduct;
    }
}