New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.enums.StatusEnum; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.model.TEdition; |
| | | import com.stylefeng.guns.modular.system.service.ITEditionService; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2023-03-14 09:44:02 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tEdition") |
| | | public class TEditionController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tEdition/"; |
| | | |
| | | @Autowired |
| | | private ITEditionService tEditionService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "tEdition.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tEdition_add") |
| | | public String tEditionAdd() { |
| | | return PREFIX + "tEdition_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tEdition_update/{tEditionId}") |
| | | public String tEditionUpdate(@PathVariable Integer tEditionId, Model model) { |
| | | TEdition tEdition = tEditionService.selectById(tEditionId); |
| | | model.addAttribute("item",tEdition); |
| | | LogObjectHolder.me().set(tEdition); |
| | | return PREFIX + "tEdition_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String createTime,String editionNo) { |
| | | EntityWrapper<TEdition> wrapper = new EntityWrapper<>(); |
| | | if(StringUtils.hasLength(createTime)){ |
| | | String[] split = createTime.split(" - "); |
| | | Date startTime = DateUtil.getDate_str4(split[0]); |
| | | Date endTime = DateUtil.getDate_str4(split[1]); |
| | | wrapper.between("createTime",startTime,endTime); |
| | | } |
| | | if(StringUtils.hasLength(editionNo)){ |
| | | wrapper.like("editionNo",editionNo); |
| | | } |
| | | wrapper.ne("status", StatusEnum.DELETE.getCode()); |
| | | return tEditionService.selectList(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list-back") |
| | | @ResponseBody |
| | | public Object listBack(String condition) { |
| | | return tEditionService.selectList(null); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TEdition tEdition) { |
| | | tEditionService.insert(tEdition); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tEditionId) { |
| | | TEdition tEdition = tEditionService.selectById(tEditionId); |
| | | tEdition.setStatus(StatusEnum.DELETE.getCode()); |
| | | tEditionService.updateById(tEdition); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TEdition tEdition) { |
| | | tEditionService.updateById(tEdition); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tEditionId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tEditionId") Integer tEditionId) { |
| | | return tEditionService.selectById(tEditionId); |
| | | } |
| | | } |