| Line 16... |
Line 16... |
| 16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 17 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
17 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 18 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
18 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 19 |
import com.spice.profitmandi.dao.entity.fofo.Tag;
|
19 |
import com.spice.profitmandi.dao.entity.fofo.Tag;
|
| 20 |
import com.spice.profitmandi.dao.repository.fofo.TagRepository;
|
20 |
import com.spice.profitmandi.dao.repository.fofo.TagRepository;
|
| 21 |
import com.spice.profitmandi.web.request.CreateTagRequest;
|
21 |
import com.spice.profitmandi.web.request.CreatePinCodeTagRequest;
|
| 22 |
|
22 |
|
| 23 |
@Controller
|
23 |
@Controller
|
| 24 |
@Transactional
|
24 |
@Transactional
|
| 25 |
public class TagController {
|
25 |
public class TagController {
|
| 26 |
|
26 |
|
| Line 28... |
Line 28... |
| 28 |
TagRepository tagRepository;
|
28 |
TagRepository tagRepository;
|
| 29 |
|
29 |
|
| 30 |
@Autowired
|
30 |
@Autowired
|
| 31 |
ResponseSender<?> responseSender;
|
31 |
ResponseSender<?> responseSender;
|
| 32 |
|
32 |
|
| 33 |
@RequestMapping(value = ProfitMandiConstants.URL_TAG, method = RequestMethod.POST)
|
- |
|
| 34 |
public ResponseEntity<?> createTag(HttpServletRequest request, @RequestBody CreateTagRequest createTagRequest) {
|
- |
|
| 35 |
Tag tag = new Tag();
|
- |
|
| 36 |
tag.setActive(true);
|
- |
|
| 37 |
tag.setDescription(createTagRequest.getDescription());
|
- |
|
| 38 |
tag.setLabel(createTagRequest.getLabel());
|
- |
|
| 39 |
tag.setType(createTagRequest.getTagType());
|
- |
|
| 40 |
tag.setPinAll(createTagRequest.isPinAll());
|
- |
|
| 41 |
tag.setUserAll(createTagRequest.isUserAll());
|
- |
|
| 42 |
tag.setCreatedBy(1);
|
- |
|
| 43 |
tagRepository.persist(tag);
|
- |
|
| 44 |
return responseSender.ok(ResponseCodeHolder.getMessage("TG_OK_1000"));
|
- |
|
| 45 |
}
|
- |
|
| 46 |
|
33 |
|
| 47 |
@RequestMapping(value = ProfitMandiConstants.URL_TAG_ID, method = RequestMethod.GET)
|
34 |
@RequestMapping(value = ProfitMandiConstants.URL_TAG_ID, method = RequestMethod.GET)
|
| 48 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ID) int id) {
|
35 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ID) int id) {
|
| 49 |
try{
|
36 |
try{
|
| 50 |
return responseSender.ok(tagRepository.selectById(id));
|
37 |
return responseSender.ok(tagRepository.selectById(id));
|