예제 #1
0
 public void del() {
   ((UsersMapper) SpringContextUtil.getBean("usersMapper")).del(this);
   UserDiscount userDiscount = new UserDiscount();
   userDiscount.setUserid(this.getUserid());
   userDiscount.delByuserid();
   ;
 }
예제 #2
0
 public void save() {
   UsersMapper mapper = (UsersMapper) SpringContextUtil.getBean("usersMapper");
   mapper.add(this);
   this.setUseraddressid(this.getUserid());
   this.setMembership(this.getUserid());
   mapper.update(this);
 }
 public List<UserDto> getListUserDto(Map map) {
   UsersMapper usersMapper = (UsersMapper) SpringContextUtil.getBean("usersMapper");
   UserAddressMapper userAddressMapper =
       (UserAddressMapper) SpringContextUtil.getBean("userAddressMapper");
   List<Users> list = usersMapper.getUsersList(map);
   List<UserDto> dtoList = new ArrayList<UserDto>();
   if (map == null) {
     map = new HashMap();
   }
   for (Users temp : list) {
     UserDto dto = BeanMapper.map(temp, UserDto.class);
     map.clear();
     map.put("useraddressid", temp.getUseraddressid());
     // 可能需要进行修改
     dto.setUserAddress(userAddressMapper.getUserAddressList(map));
     // 可能需要进行修改
     dtoList.add(dto);
   }
   return dtoList;
 }
 public List<UserDiscountDto> getListUserDiscountDto(Map map) {
   UserDiscountMapper userDiscountMapper =
       (UserDiscountMapper) SpringContextUtil.getBean("userDiscountMapper");
   CommodityTypeMapper commodityTypeMapper =
       (CommodityTypeMapper) SpringContextUtil.getBean("commodityTypeMapper");
   List<UserDiscount> list = userDiscountMapper.getUserDiscountList(map);
   List<UserDiscountDto> dtoList = new ArrayList<UserDiscountDto>();
   if (map == null) {
     map = new HashMap();
   }
   for (UserDiscount temp : list) {
     UserDiscountDto dto = BeanMapper.map(temp, UserDiscountDto.class);
     map.clear();
     map.put("commodityid", temp.getCommodityid());
     List<SimpleCommodityDto> SimpleCommoditydtolist = mapper.getSimpleCommodityDtoList(map);
     if (!SimpleCommoditydtolist.isEmpty()) {
       dto.setCommodity(SimpleCommoditydtolist.get(0));
       dto.setType(commodityTypeMapper.getCommodityTypeById(temp.getTypeid()));
       dtoList.add(dto);
     }
   }
   return dtoList;
 }
 public List<DetailCommodityDto> getListDetailCommodityDto(Map map) {
   CommodityMarkMapper commodityMarkMapper =
       (CommodityMarkMapper) SpringContextUtil.getBean("commodityMarkMapper");
   List<DetailCommodityDto> list = mapper.getDetailCommodityDtoList(map);
   //        if(map == null){
   //            map = new HashMap();
   //        }
   // 暂时不做商品你标签所以商品标签全为空
   //        for(DetailCommodityDto dto : list){
   //            map.clear();
   //            map.put("ids", Arrays.asList(dto.getMarkids().split("/")));
   //            dto.setMarks(commodityMarkMapper.getCommoditymarkListByIds(map));
   //        }
   return list;
 }
 public List<PromotionDto> getListPromotionDto(Map map) {
   PromotionPriceMapper promotionPriceMapper =
       (PromotionPriceMapper) SpringContextUtil.getBean("promotionPriceMapper");
   List<PromotionPrice> list = promotionPriceMapper.getPromotionPriceList(map);
   List<PromotionDto> dtoList = new ArrayList<PromotionDto>();
   if (map == null) {
     map = new HashMap();
   }
   for (PromotionPrice temp : list) {
     PromotionDto dto = BeanMapper.map(temp, PromotionDto.class);
     map.clear();
     map.put("commodityid", dto.getPromotionid());
     dto.setCommodity(mapper.getSimpleCommodityDtoList(map).get(0));
     dtoList.add(dto);
   }
   return dtoList;
 }
예제 #7
0
 public void update() {
   ((UsersMapper) SpringContextUtil.getBean("usersMapper")).update(this);
 }