You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.4 KiB
Java
70 lines
2.4 KiB
Java
|
6 years ago
|
package com.gszc.service.impl;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson.JSONObject;
|
||
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||
|
|
import com.gszc.entity.Custom;
|
||
|
|
import com.gszc.entity.CustomSupport;
|
||
|
|
import com.gszc.mapper.CustomMapper;
|
||
|
|
import com.gszc.mapper.CustomSupportMapper;
|
||
|
|
import com.gszc.service.ICustomService;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
import java.time.LocalDateTime;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.UUID;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* <p>
|
||
|
|
* 服务实现类
|
||
|
|
* </p>
|
||
|
|
*
|
||
|
|
* @author ky
|
||
|
|
* @since 2020-04-27
|
||
|
|
*/
|
||
|
|
@Service
|
||
|
|
public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> implements ICustomService {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
CustomMapper customMapper;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
CustomSupportMapper customSupportMapper;
|
||
|
|
|
||
|
|
public void customRegister(Custom custom,List<CustomSupport> customSupports){
|
||
|
|
String uuid = UUID.randomUUID().toString();
|
||
|
|
custom.setId(uuid);
|
||
|
|
custom.setCreateDate(LocalDateTime.now());
|
||
|
|
custom.setModifyDate(LocalDateTime.now());
|
||
|
|
customMapper.insert(custom);
|
||
|
|
for(CustomSupport customSupport:customSupports){
|
||
|
|
String id = UUID.randomUUID().toString();
|
||
|
|
customSupport.setId(id);
|
||
|
|
customSupport.setCreateDate(LocalDateTime.now());
|
||
|
|
customSupport.setModifyDate(LocalDateTime.now());
|
||
|
|
customSupport.setCustomId(uuid);
|
||
|
|
customSupportMapper.insert(customSupport);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Custom> invoiceCustomList(String userId){
|
||
|
|
List<Custom> customs = customMapper.selectList(new EntityWrapper<Custom>().eq("mini_user_id", userId).eq("status_code","enable"));
|
||
|
|
return customs;
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Custom> customList(String userId){
|
||
|
|
List<Custom> customs = customMapper.selectList(new EntityWrapper<Custom>().eq("mini_user_id", userId));
|
||
|
|
return customs;
|
||
|
|
}
|
||
|
|
|
||
|
|
public JSONObject customDetail(String customId){
|
||
|
|
JSONObject jsonObject = new JSONObject();
|
||
|
|
Custom custom = customMapper.selectById(customId);
|
||
|
|
List<CustomSupport> customSupports = customSupportMapper.selectList(new EntityWrapper<CustomSupport>().eq("custom_id", customId));
|
||
|
|
jsonObject.put("custom",custom);
|
||
|
|
jsonObject.put("customSupports",customSupports);
|
||
|
|
return jsonObject;
|
||
|
|
}
|
||
|
|
}
|