作者 申海龙

一类管理 二级类管理

  1 +package com.agent.controller.system;
  2 +
  3 +import com.agent.entity.agent.SDCargoNameEntity;
  4 +import com.agent.entity.system.SDBIGTYPEEntity;
  5 +import com.agent.entity.system.SDTWOTYPEEntity;
  6 +import com.agent.service.system.SDBIGTYPEService;
  7 +import com.agent.service.system.SDCargoNameService;
  8 +import com.agent.service.system.SDCargoTypeService;
  9 +import com.agent.service.system.SDTWOTYPEService;
  10 +import com.agent.util.HttpJsonMsg;
  11 +import com.agent.vo.ResponseModel;
  12 +import com.agent.vo.agent.SdBigTypeVo;
  13 +import com.agent.vo.agent.SdTwoTypeVo;
  14 +import com.framework.core.Servlets;
  15 +import com.framework.shiro.SessionUtil;
  16 +import com.plugin.easyui.DataGrid;
  17 +import com.plugin.easyui.EasyPage;
  18 +import org.apache.commons.collections.CollectionUtils;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.stereotype.Controller;
  23 +import org.springframework.ui.Model;
  24 +import org.springframework.web.bind.annotation.RequestMapping;
  25 +import org.springframework.web.bind.annotation.RequestMethod;
  26 +import org.springframework.web.bind.annotation.ResponseBody;
  27 +
  28 +import javax.servlet.http.HttpServletRequest;
  29 +import java.util.ArrayList;
  30 +import java.util.List;
  31 +import java.util.Map;
  32 +
  33 +/** 货物品名 大类 二级类 统计
  34 + * @Auther: shenhl
  35 + * @Date: 2019/8/8 15:51
  36 + */
  37 +@Controller
  38 +@RequestMapping(value = "/type")
  39 +public class SDCARGONAMEController {
  40 +
  41 + private static final Logger logger = LoggerFactory.getLogger(com.agent.controller.system.SDCARGONAMEController.class);
  42 + @Autowired
  43 + SDBIGTYPEService sdbigtypeService;
  44 +
  45 + @Autowired
  46 + SDTWOTYPEService sdtwotypeService;
  47 +
  48 + @Autowired
  49 + SDCargoNameService sdCargoNameService;
  50 +
  51 + /**
  52 + * 一级类 列表页面
  53 + * @return
  54 + */
  55 + @RequestMapping(value = "/list")
  56 + public String list(){
  57 + return "sdtype/bigtype";
  58 + }
  59 +
  60 + /**
  61 + * 一级类 跳转添加页面
  62 + * @return
  63 + */
  64 + @RequestMapping(value = "/add")
  65 + public String add(){
  66 + return "sdtype/sdtypeadd";
  67 + }
  68 +
  69 + /**
  70 + * 二级类列表跳转
  71 + * @return
  72 + */
  73 + @RequestMapping(value = "/tlist")
  74 + public String tlist(){
  75 + return "sdtype/twolist";
  76 + }
  77 +
  78 +
  79 + /**
  80 + * 一级类分页查询
  81 + * @param request
  82 + * @param pageForm
  83 + * @return
  84 + */
  85 + @RequestMapping(value = "/grid.json")
  86 + @ResponseBody
  87 + public DataGrid<SdBigTypeVo> grid(HttpServletRequest request, EasyPage<SDBIGTYPEEntity> pageForm) {
  88 +
  89 + Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
  90 + pageForm.setSearchParams(searchParams);
  91 + pageForm.parseData(sdbigtypeService.getPage(pageForm));
  92 + DataGrid<SDBIGTYPEEntity> hzshipperinformationEntityDataGrid = pageForm.getData();
  93 + List<SdBigTypeVo> rows = new ArrayList<>();
  94 + if (CollectionUtils.isNotEmpty(hzshipperinformationEntityDataGrid.getRows())){
  95 + for (SDBIGTYPEEntity sd: hzshipperinformationEntityDataGrid.getRows()){
  96 + SdBigTypeVo sdBigTypeVo = new SdBigTypeVo();
  97 + sdBigTypeVo.setId(sd.getId());
  98 + sdBigTypeVo.setType_name(sd.getType_name());
  99 + sdBigTypeVo.setType_order(sd.getType_order());
  100 + rows.add(sdBigTypeVo);
  101 + }
  102 + }
  103 + DataGrid<SdBigTypeVo> vos = new DataGrid<>();
  104 + vos.setRows(rows);
  105 + vos.setTotal(hzshipperinformationEntityDataGrid.getTotal());
  106 + return vos;
  107 + }
  108 +
  109 +
  110 + /**
  111 + * 大类添加
  112 + * @param sd
  113 + * @param request
  114 + * @return
  115 + */
  116 + @RequestMapping(value = "/bigSave")
  117 + @ResponseBody
  118 + public ResponseModel saves(SDBIGTYPEEntity sd, HttpServletRequest request){
  119 + ResponseModel model = new ResponseModel();
  120 + try {
  121 + // 如果为空 默认为0
  122 + if (sd.getType_order() == null){
  123 + sd.setType_order("0");
  124 + }
  125 +
  126 + if (sdbigtypeService.findName(sd.getType_name()) == 0){
  127 + sdbigtypeService.saves(sd);
  128 +
  129 + model.setStatus(200);
  130 + }else {
  131 + model.setStatus(201);
  132 + }
  133 +
  134 + return model;
  135 + }catch (Exception e){
  136 + e.printStackTrace();
  137 + model.setStatus(500);
  138 + return model;
  139 + }
  140 + }
  141 +
  142 + /**
  143 + * 一级类修改跳转
  144 + * @param model
  145 + * @param id
  146 + * @return
  147 + */
  148 + @RequestMapping(value = "/edit")
  149 + public String edit(Model model, Long id){
  150 +
  151 + SDBIGTYPEEntity one = sdbigtypeService.findOne(id);
  152 +
  153 + model.addAttribute("big", one);
  154 +
  155 + return "sdtype/typeedit";
  156 + }
  157 +
  158 +
  159 + /**
  160 + * 一级类修改修改
  161 + * @param sd
  162 + * @param request
  163 + * @return
  164 + */
  165 + @RequestMapping(value = "/update")
  166 + @ResponseBody
  167 + public ResponseModel update(SDBIGTYPEEntity sd, HttpServletRequest request){
  168 + ResponseModel responseModel = new ResponseModel();
  169 +
  170 + // 如果为空 默认为0
  171 + if (sd.getType_order() == null){
  172 + sd.setType_order("0");
  173 + }
  174 + if (sdbigtypeService.findName(sd.getType_name()) == 0){
  175 + if (sdbigtypeService.typeUpdate(sd) > 0){
  176 + responseModel.setStatus(200);
  177 + }else {
  178 + responseModel.setStatus(500);
  179 + }
  180 + }else {
  181 + responseModel.setStatus(201);
  182 + }
  183 + return responseModel;
  184 + }
  185 +
  186 +
  187 + /**
  188 + * 一级类删除
  189 + *
  190 + * @param ids
  191 + * @return
  192 + */
  193 + @RequestMapping(value = "/delete", method = { RequestMethod.POST })
  194 + @ResponseBody
  195 + public ResponseModel delete(String ids) {
  196 + ResponseModel model = new ResponseModel();
  197 + try {
  198 + sdbigtypeService.bigTypeDelete(ids);
  199 + model.setStatus(200);
  200 + model.setMsg(HttpJsonMsg.SUCCESS);
  201 + } catch (Exception e) {
  202 + e.printStackTrace();
  203 + model.setStatus(500);
  204 + model.setMsg(HttpJsonMsg.ERROR);
  205 + logger.error("系统异常 >>", e);
  206 + }
  207 + return model;
  208 + }
  209 +
  210 +
  211 + /**
  212 + * 二级类分页查询
  213 + * @param request
  214 + * @param pageForm
  215 + * @return
  216 + */
  217 + @RequestMapping(value = "/twogrid.json")
  218 + @ResponseBody
  219 + public DataGrid<SdTwoTypeVo> twogrid(HttpServletRequest request, EasyPage<SDTWOTYPEEntity> pageForm) {
  220 +
  221 + Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
  222 + pageForm.setSearchParams(searchParams);
  223 + pageForm.parseData(sdtwotypeService.getPage(pageForm));
  224 + DataGrid<SDTWOTYPEEntity> hzshipperinformationEntityDataGrid = pageForm.getData();
  225 + List<SdTwoTypeVo> rows = new ArrayList<>();
  226 + if (CollectionUtils.isNotEmpty(hzshipperinformationEntityDataGrid.getRows())){
  227 + for (SDTWOTYPEEntity sd: hzshipperinformationEntityDataGrid.getRows()){
  228 + SdTwoTypeVo sdTwoTypeVo = new SdTwoTypeVo();
  229 +
  230 + SDBIGTYPEEntity one = sdbigtypeService.findOne(sd.getBig_type_id());
  231 + sdTwoTypeVo.setBigName(one.getType_name());
  232 + sdTwoTypeVo.setId(sd.getId());
  233 + sdTwoTypeVo.setBig_type_id(sd.getBig_type_id());
  234 + sdTwoTypeVo.setCargo_name(sd.getCargo_name());
  235 + sdTwoTypeVo.setCargo_name_id(sd.getCargo_name_id());
  236 + sdTwoTypeVo.setTwo_type_name(sd.getTwo_type_name());
  237 + sdTwoTypeVo.setTwo_type_order(sd.getTwo_type_order());
  238 +
  239 + rows.add(sdTwoTypeVo);
  240 + }
  241 + }
  242 + DataGrid<SdTwoTypeVo> vos = new DataGrid<>();
  243 + vos.setRows(rows);
  244 + vos.setTotal(hzshipperinformationEntityDataGrid.getTotal());
  245 + return vos;
  246 + }
  247 +
  248 +
  249 + /**
  250 + * 二级类 跳转添加页面
  251 + * @return
  252 + */
  253 + @RequestMapping(value = "/tadd")
  254 + public String tadd(Model model){
  255 + // 一级类名称
  256 + List<SDBIGTYPEEntity> alls = sdbigtypeService.findAlls();
  257 + // 二级类名称
  258 + List<String> alls1 = sdCargoNameService.findAlls();
  259 + model.addAttribute("big", alls);
  260 + model.addAttribute("cargo", alls1);
  261 + return "sdtype/tadd";
  262 + }
  263 +
  264 +
  265 + /**
  266 + * 二级类添加
  267 + * @param sd
  268 + * @param request
  269 + * @return
  270 + */
  271 + @RequestMapping(value = "/twoSave")
  272 + @ResponseBody
  273 + public ResponseModel twoSave(SDTWOTYPEEntity sd, HttpServletRequest request){
  274 + ResponseModel model = new ResponseModel();
  275 + try {
  276 + // 如果为空 默认为0
  277 + if (sd.getTwo_type_order() == null){
  278 + sd.setTwo_type_order("0");
  279 + }
  280 + sdtwotypeService.saves(sd);
  281 + model.setStatus(200);
  282 + return model;
  283 + }catch (Exception e){
  284 + e.printStackTrace();
  285 + model.setStatus(500);
  286 + return model;
  287 + }
  288 + }
  289 +
  290 + /**
  291 + * 二级类删除
  292 + *
  293 + * @param ids
  294 + * @return
  295 + */
  296 + @RequestMapping(value = "/tdelete", method = { RequestMethod.POST })
  297 + @ResponseBody
  298 + public ResponseModel tdelete(String ids) {
  299 + ResponseModel model = new ResponseModel();
  300 + try {
  301 + sdtwotypeService.tDelete(ids);
  302 + model.setStatus(200);
  303 + model.setMsg(HttpJsonMsg.SUCCESS);
  304 + } catch (Exception e) {
  305 + e.printStackTrace();
  306 + model.setStatus(500);
  307 + model.setMsg(HttpJsonMsg.ERROR);
  308 + logger.error("系统异常 >>", e);
  309 + }
  310 + return model;
  311 + }
  312 +
  313 +
  314 + /**
  315 + * 二级类修改跳转
  316 + * @param model
  317 + * @param id
  318 + * @return
  319 + */
  320 + @RequestMapping(value = "/tedit")
  321 + public String tedit(Model model, Long id){
  322 +
  323 + SDTWOTYPEEntity one = sdtwotypeService.findOne(id);
  324 + // 一级类名称
  325 + List<SDBIGTYPEEntity> alls = sdbigtypeService.findAlls();
  326 + // 二级类名称
  327 + List<String> alls1 = sdCargoNameService.findAlls();
  328 + model.addAttribute("big", alls);
  329 + model.addAttribute("one", one);
  330 + return "sdtype/tedit";
  331 + }
  332 +
  333 +
  334 + /**
  335 + * 二级类修改修改
  336 + * @param sd
  337 + * @param request
  338 + * @return
  339 + */
  340 + @RequestMapping(value = "/tupdate")
  341 + @ResponseBody
  342 + public ResponseModel tupdate(SDTWOTYPEEntity sd, HttpServletRequest request){
  343 + ResponseModel responseModel = new ResponseModel();
  344 + // 如果为空 默认为0
  345 + if (sd.getTwo_type_order() == null){
  346 + sd.setTwo_type_order("0");
  347 + }
  348 + if (sdtwotypeService.tUpdate(sd) > 0){
  349 + responseModel.setStatus(200);
  350 + }else {
  351 + responseModel.setStatus(500);
  352 + }
  353 +
  354 + return responseModel;
  355 + }
  356 +
  357 +
  358 +}
  1 +package com.agent.entity.system;
  2 +
  3 +import com.agent.entity.BasicEntity;
  4 +import com.agent.entity.IdEntity;
  5 +
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.Table;
  8 +
  9 +/**
  10 + * @Auther: shenhl
  11 + * @Date: 2019/8/8 15:52
  12 + */
  13 +
  14 +@Entity
  15 +@Table(name = "SD_BIG_TYPE")
  16 +public class SDBIGTYPEEntity extends IdEntity {
  17 +
  18 + /**
  19 + * 类型名称
  20 + */
  21 + private String type_name;
  22 +
  23 + /**
  24 + * 排序字段 默认为0
  25 + */
  26 + private String type_order;
  27 +
  28 + public String getType_name() {
  29 + return type_name;
  30 + }
  31 +
  32 + public void setType_name(String type_name) {
  33 + this.type_name = type_name;
  34 + }
  35 +
  36 + public String getType_order() {
  37 + return type_order;
  38 + }
  39 +
  40 + public void setType_order(String type_order) {
  41 + this.type_order = type_order;
  42 + }
  43 +}
  1 +package com.agent.entity.system;
  2 +
  3 +import com.agent.entity.BasicEntity;
  4 +import com.agent.entity.IdEntity;
  5 +
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.Table;
  8 +
  9 +/**
  10 + * @Auther: shenhl
  11 + * @Date: 2019/8/8 15:54
  12 + */
  13 +@Entity
  14 +@Table(name = "SD_TWO_TYPE")
  15 +public class SDTWOTYPEEntity extends IdEntity{
  16 +
  17 + /**
  18 + * 二级类名称
  19 + */
  20 + private String two_type_name;
  21 +
  22 + /**
  23 + * 大类ID
  24 + */
  25 + private Long big_type_id;
  26 +
  27 + /**
  28 + * 排序字段
  29 + */
  30 + private String two_type_order;
  31 +
  32 + /**
  33 + * 货物品名
  34 + */
  35 + private String cargo_name;
  36 +
  37 + /**
  38 + * 货物id
  39 + * @return
  40 + */
  41 + private Long cargo_name_id;
  42 +
  43 + public String getTwo_type_name() {
  44 + return two_type_name;
  45 + }
  46 +
  47 + public void setTwo_type_name(String two_type_name) {
  48 + this.two_type_name = two_type_name;
  49 + }
  50 +
  51 + public Long getBig_type_id() {
  52 + return big_type_id;
  53 + }
  54 +
  55 + public void setBig_type_id(Long big_type_id) {
  56 + this.big_type_id = big_type_id;
  57 + }
  58 +
  59 + public String getTwo_type_order() {
  60 + return two_type_order;
  61 + }
  62 +
  63 + public void setTwo_type_order(String two_type_order) {
  64 + this.two_type_order = two_type_order;
  65 + }
  66 +
  67 + public String getCargo_name() {
  68 + return cargo_name;
  69 + }
  70 +
  71 + public void setCargo_name(String cargo_name) {
  72 + this.cargo_name = cargo_name;
  73 + }
  74 +
  75 + public Long getCargo_name_id() {
  76 + return cargo_name_id;
  77 + }
  78 +
  79 + public void setCargo_name_id(Long cargo_name_id) {
  80 + this.cargo_name_id = cargo_name_id;
  81 + }
  82 +}
  1 +package com.agent.repository.system;
  2 +
  3 +import com.agent.entity.system.SDBIGTYPEEntity;
  4 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.data.repository.PagingAndSortingRepository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * @Auther: shenhl
  14 + * @Date: 2019/6/18 19:15
  15 + */
  16 +public interface SDBIGTYPERepository extends PagingAndSortingRepository<SDBIGTYPEEntity, Long>,
  17 + JpaSpecificationExecutor<SDBIGTYPEEntity> {
  18 +
  19 + @Transactional
  20 + @Modifying(clearAutomatically=true)
  21 + @Query(value = "insert into SD_BIG_TYPE(TYPE_NAME, TYPE_ORDER) values(?1, ?2)", nativeQuery = true)
  22 + int saves(String typename, String typeorder);
  23 +
  24 + @Transactional
  25 + @Modifying(clearAutomatically=true)
  26 + @Query(value = "update SD_BIG_TYPE set TYPE_NAME = ?2, TYPE_ORDER = ?3 where id = ?1", nativeQuery = true)
  27 + int typeUpdate(Long id, String name, String order);
  28 +
  29 + @Transactional
  30 + @Modifying
  31 + @Query(value = "DELETE FROM SD_BIG_TYPE WHERE ID = ?1", nativeQuery = true)
  32 + int bigTypeDelete(Long id);
  33 +
  34 + @Query(value = "select * from SD_BIG_TYPE", nativeQuery = true)
  35 + List<SDBIGTYPEEntity> findAlls();
  36 +
  37 + @Query(value = "select count(*) from SD_BIG_TYPE where TYPE_NAME = ?1", nativeQuery = true)
  38 + int findName(String type_name);
  39 +
  40 +
  41 +}
@@ -30,4 +30,7 @@ public interface SDCargoNameRepository extends PagingAndSortingRepository<SDCarg @@ -30,4 +30,7 @@ public interface SDCargoNameRepository extends PagingAndSortingRepository<SDCarg
30 @Query(value = "delete from SD_CARGO_NAME where sd_waybill = ?1", nativeQuery = true) 30 @Query(value = "delete from SD_CARGO_NAME where sd_waybill = ?1", nativeQuery = true)
31 int deletes(String waybillnomaster); 31 int deletes(String waybillnomaster);
32 32
  33 + @Query(value = "select distinct SD_CARGO_NAME from SD_CARGO_NAME where SD_CARGO_NAME not in (select CARGO_NAME from SD_TWO_TYPE)", nativeQuery = true)
  34 + List<String> findAlls();
  35 +
33 } 36 }
  1 +package com.agent.repository.system;
  2 +
  3 +import com.agent.entity.system.SDBIGTYPEEntity;
  4 +import com.agent.entity.system.SDTWOTYPEEntity;
  5 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.data.repository.PagingAndSortingRepository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +/**
  12 + * @Auther: shenhl
  13 + * @Date: 2019/6/18 19:15
  14 + */
  15 +public interface SDTWOTYPERepository extends PagingAndSortingRepository<SDTWOTYPEEntity, Long>,
  16 + JpaSpecificationExecutor<SDTWOTYPEEntity> {
  17 +
  18 +
  19 + @Transactional
  20 + @Modifying(clearAutomatically=true)
  21 + @Query(value = "insert into SD_TWO_TYPE(TWO_TYPE_NAME, BIG_TYPE_ID, TWO_TYPE_ORDER, CARGO_NAME) values(?1, ?2, ?3, ?4)", nativeQuery = true)
  22 + int saves(String typename, Long bigid, String typeorder, String cargoname);
  23 +
  24 + @Transactional
  25 + @Modifying
  26 + @Query(value = "DELETE FROM SD_TWO_TYPE WHERE ID = ?1", nativeQuery = true)
  27 + int tDelete(Long id);
  28 +
  29 + @Transactional
  30 + @Modifying(clearAutomatically=true)
  31 + @Query(value = "update SD_TWO_TYPE set TWO_TYPE_NAME = ?2, BIG_TYPE_ID = ?3, TWO_TYPE_ORDER = ?4 where id = ?1", nativeQuery = true)
  32 + int tUpdate(Long id, String name, Long bigid, String order);
  33 +
  34 +
  35 +}
  1 +package com.agent.service.system;
  2 +
  3 +import com.agent.entity.agent.HZSHIPPERINFORMATIONEntity;
  4 +import com.agent.entity.agent.ManifestEntity;
  5 +import com.agent.entity.agent.SecurityDeclarationEntity;
  6 +import com.agent.entity.system.SDBIGTYPEEntity;
  7 +import com.agent.repository.system.SDBIGTYPERepository;
  8 +import com.agent.service.BasicService;
  9 +import com.google.common.base.Splitter;
  10 +import com.plugin.easyui.EasyPage;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.data.domain.Page;
  13 +import org.springframework.data.domain.PageRequest;
  14 +import org.springframework.data.jpa.domain.Specification;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.annotation.Transactional;
  17 +
  18 +import java.util.List;
  19 +
  20 +/**
  21 + * @Auther: shenhl
  22 + * @Date: 2019/8/8 16:07
  23 + */
  24 +@Service
  25 +public class SDBIGTYPEService extends BasicService<SDBIGTYPEEntity> {
  26 +
  27 + @Autowired
  28 + SDBIGTYPERepository sdbigtypeRepository;
  29 +
  30 + /**
  31 + * 分页查询
  32 + *
  33 + * @param pageForm 分页对象
  34 + * @return 包含分页信息和数据的分页对象
  35 + */
  36 + public Page<SDBIGTYPEEntity> getPage(EasyPage<SDBIGTYPEEntity> pageForm) {
  37 +
  38 + PageRequest pageRequest = buildPageRequest(pageForm);
  39 + Specification<SDBIGTYPEEntity> spec = buildSpecification(pageForm);
  40 + Page<SDBIGTYPEEntity> page = sdbigtypeRepository.findAll(spec, pageRequest);
  41 + return page;
  42 + }
  43 +
  44 +
  45 + @Transactional
  46 + public SDBIGTYPEEntity saves(SDBIGTYPEEntity sd) {
  47 +
  48 + return sdbigtypeRepository.save(sd);
  49 + }
  50 +
  51 + public SDBIGTYPEEntity findOne(Long id) {
  52 + return sdbigtypeRepository.findOne(id);
  53 + }
  54 +
  55 + @Transactional
  56 + public int typeUpdate(SDBIGTYPEEntity sd){
  57 + return sdbigtypeRepository.typeUpdate(sd.getId(), sd.getType_name(), sd.getType_order());
  58 + }
  59 +
  60 + @Transactional
  61 + public void bigTypeDelete(String ids) {
  62 + try {
  63 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  64 + for (String id : list) {
  65 + sdbigtypeRepository.bigTypeDelete(Long.valueOf(id));
  66 + }
  67 + }catch (Exception e){
  68 + e.printStackTrace();
  69 + }
  70 +
  71 + }
  72 +
  73 + public List<SDBIGTYPEEntity> findAlls(){
  74 +
  75 + return sdbigtypeRepository.findAlls();
  76 + }
  77 +
  78 + public int findName(String type_name){
  79 +
  80 + return sdbigtypeRepository.findName(type_name);
  81 + }
  82 +
  83 +}
@@ -37,5 +37,9 @@ public class SDCargoNameService extends BasicService<SDCargoNameEntity> { @@ -37,5 +37,9 @@ public class SDCargoNameService extends BasicService<SDCargoNameEntity> {
37 return i; 37 return i;
38 } 38 }
39 39
  40 + public List<String> findAlls(){
  41 +
  42 + return sdCargoNameRepository.findAlls();
  43 + }
40 44
41 } 45 }
  1 +package com.agent.service.system;
  2 +
  3 +import com.agent.entity.system.SDBIGTYPEEntity;
  4 +import com.agent.entity.system.SDTWOTYPEEntity;
  5 +import com.agent.repository.system.SDBIGTYPERepository;
  6 +import com.agent.repository.system.SDTWOTYPERepository;
  7 +import com.agent.service.BasicService;
  8 +import com.google.common.base.Splitter;
  9 +import com.plugin.easyui.EasyPage;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.data.domain.Page;
  12 +import org.springframework.data.domain.PageRequest;
  13 +import org.springframework.data.jpa.domain.Specification;
  14 +import org.springframework.stereotype.Service;
  15 +import org.springframework.transaction.annotation.Transactional;
  16 +
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * @Auther: shenhl
  21 + * @Date: 2019/8/8 16:07
  22 + */
  23 +@Service
  24 +public class SDTWOTYPEService extends BasicService<SDTWOTYPEEntity> {
  25 +
  26 + @Autowired
  27 + SDTWOTYPERepository sdtwotypeRepository;
  28 +
  29 +
  30 +
  31 + /**
  32 + * 分页查询
  33 + *
  34 + * @param pageForm 分页对象
  35 + * @return 包含分页信息和数据的分页对象
  36 + */
  37 + public Page<SDTWOTYPEEntity> getPage(EasyPage<SDTWOTYPEEntity> pageForm) {
  38 +
  39 + PageRequest pageRequest = buildPageRequest(pageForm);
  40 + Specification<SDTWOTYPEEntity> spec = buildSpecification(pageForm);
  41 + Page<SDTWOTYPEEntity> page = sdtwotypeRepository.findAll(spec, pageRequest);
  42 + return page;
  43 + }
  44 +
  45 +
  46 + @Transactional
  47 + public SDTWOTYPEEntity saves(SDTWOTYPEEntity sd){
  48 +
  49 + return sdtwotypeRepository.save(sd);
  50 + }
  51 +
  52 + @Transactional
  53 + public void tDelete(String ids) {
  54 + try {
  55 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  56 + for (String id : list) {
  57 + sdtwotypeRepository.tDelete(Long.valueOf(id));
  58 + }
  59 + }catch (Exception e){
  60 + e.printStackTrace();
  61 + }
  62 +
  63 + }
  64 +
  65 + public SDTWOTYPEEntity findOne(Long id){
  66 + return sdtwotypeRepository.findOne(id);
  67 + }
  68 +
  69 + @Transactional
  70 + public int tUpdate(SDTWOTYPEEntity sd){
  71 + return sdtwotypeRepository.tUpdate(sd.getId(), sd.getTwo_type_name(), sd.getBig_type_id(), sd.getTwo_type_order());
  72 + }
  73 +
  74 +}
  1 +package com.agent.vo.agent;
  2 +
  3 +/**
  4 + * @Auther: shenhl
  5 + * @Date: 2019/8/9 15:30
  6 + */
  7 +public class SdBigTypeVo {
  8 +
  9 + private Long id;
  10 +
  11 + /**
  12 + * 类型名称
  13 + */
  14 + private String type_name;
  15 +
  16 + /**
  17 + * 排序字段 默认为0
  18 + */
  19 + private String type_order;
  20 +
  21 + public String getType_name() {
  22 + return type_name;
  23 + }
  24 +
  25 + public void setType_name(String type_name) {
  26 + this.type_name = type_name;
  27 + }
  28 +
  29 + public String getType_order() {
  30 + return type_order;
  31 + }
  32 +
  33 + public void setType_order(String type_order) {
  34 + this.type_order = type_order;
  35 + }
  36 +
  37 + public Long getId() {
  38 + return id;
  39 + }
  40 +
  41 + public void setId(Long id) {
  42 + this.id = id;
  43 + }
  44 +}
  1 +package com.agent.vo.agent;
  2 +
  3 +/**
  4 + * @Auther: shenhl
  5 + * @Date: 2019/8/12 09:34
  6 + */
  7 +public class SdTwoTypeVo {
  8 +
  9 + private Long id;
  10 +
  11 + private String two_type_name;
  12 +
  13 + private Long big_type_id;
  14 +
  15 + private String two_type_order;
  16 +
  17 + private String cargo_name;
  18 +
  19 + private Long cargo_name_id;
  20 +
  21 + private String bigName;
  22 +
  23 + public String getBigName() {
  24 + return bigName;
  25 + }
  26 +
  27 + public void setBigName(String bigName) {
  28 + this.bigName = bigName;
  29 + }
  30 +
  31 + public Long getId() {
  32 + return id;
  33 + }
  34 +
  35 + public void setId(Long id) {
  36 + this.id = id;
  37 + }
  38 +
  39 + public String getTwo_type_name() {
  40 + return two_type_name;
  41 + }
  42 +
  43 + public void setTwo_type_name(String two_type_name) {
  44 + this.two_type_name = two_type_name;
  45 + }
  46 +
  47 + public Long getBig_type_id() {
  48 + return big_type_id;
  49 + }
  50 +
  51 + public void setBig_type_id(Long big_type_id) {
  52 + this.big_type_id = big_type_id;
  53 + }
  54 +
  55 + public String getTwo_type_order() {
  56 + return two_type_order;
  57 + }
  58 +
  59 + public void setTwo_type_order(String two_type_order) {
  60 + this.two_type_order = two_type_order;
  61 + }
  62 +
  63 + public String getCargo_name() {
  64 + return cargo_name;
  65 + }
  66 +
  67 + public void setCargo_name(String cargo_name) {
  68 + this.cargo_name = cargo_name;
  69 + }
  70 +
  71 + public Long getCargo_name_id() {
  72 + return cargo_name_id;
  73 + }
  74 +
  75 + public void setCargo_name_id(Long cargo_name_id) {
  76 + this.cargo_name_id = cargo_name_id;
  77 + }
  78 +}
@@ -82,6 +82,8 @@ @@ -82,6 +82,8 @@
82 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.wbm" />||wbm/list',this)"><spring:message code="menu.wbm" /></a></li> 82 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.wbm" />||wbm/list',this)"><spring:message code="menu.wbm" /></a></li>
83 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="hz.info" />||hzinfo/list',this)"><spring:message code="hz.info" /></a></li> 83 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="hz.info" />||hzinfo/list',this)"><spring:message code="hz.info" /></a></li>
84 <li><a href="javascript:void(0);" onclick="addTab('货量统计||cargo/list',this)">货量统计</a></li> 84 <li><a href="javascript:void(0);" onclick="addTab('货量统计||cargo/list',this)">货量统计</a></li>
  85 + <li><a href="javascript:void(0);" onclick="addTab('一级类管理||type/list',this)">一级类管理</a></li>
  86 + <li><a href="javascript:void(0);" onclick="addTab('二级类管理||type/tlist',this)">二级类管理</a></li>
85 <%-- <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.consignee_info_set" />||consignee/list')"><spring:message code="menu.consignee_info_set" /></a></li> --%> 87 <%-- <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.consignee_info_set" />||consignee/list')"><spring:message code="menu.consignee_info_set" /></a></li> --%>
86 </ul> 88 </ul>
87 </li> 89 </li>
  1 +<%--
  2 + Created by IntelliJ IDEA.
  3 + User: lenovo
  4 + Date: 2019/3/15
  5 + Time: 9:33
  6 + To change this template use File | Settings | File Templates.
  7 +--%>
  8 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  9 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  10 +<%
  11 + String path = request.getContextPath();
  12 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  13 +%>
  14 +<!DOCTYPE html>
  15 +<html lang="en">
  16 +<head>
  17 + <meta charset="utf-8">
  18 + <meta name="viewport" content="width=device-width, initial-scale=1">
  19 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  20 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  21 + <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
  22 + <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
  23 +
  24 + <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  25 + <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  26 + <script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
  27 + <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  28 +
  29 +</head>
  30 +<body>
  31 +<div class="container">
  32 + <div data-options="closable:true">
  33 + <table id="dg" style="width:100%;" title="货主信息管理"
  34 + data-options="
  35 + rownumbers:true,
  36 + singleSelect:false,
  37 + autoRowHeight:false,
  38 + pagination:true,
  39 + fitColumns:true,
  40 + striped:true,
  41 + collapsible:true,
  42 + toolbar:'#tb',
  43 + pageSize:10">
  44 + <thead>
  45 + <tr>
  46 + <th field="." formatter="editFormat"><spring:message code="opt.edit" /></th>
  47 + <th field="type_name">名称</th>
  48 + <%--<th field="type_order">排序字段</th>--%>
  49 + </tr>
  50 + </thead>
  51 + </table>
  52 + <div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
  53 + <form id="searchForm">
  54 + <table class="search_form_table">
  55 + <a href="javascript:doSave()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>
  56 + <a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a>
  57 + </table>
  58 + </form>
  59 + </div>
  60 + </div>
  61 +
  62 +</div>
  63 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  64 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  65 +<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
  66 +<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
  67 +<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
  68 +<!--弹出层引入的JS-->
  69 +<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  70 +<script type="text/javascript">
  71 +
  72 + $(function(){
  73 + function getPageNumber(){
  74 + var pageNumber = window.localStorage.getItem("pageNumber");
  75 + if(typeof(pageNumber) != "undefined")
  76 + {
  77 + try{
  78 + var pattern = /^\d+$/g; //判断是否是数字
  79 +
  80 + //console.log(pageNumber.search(pattern));
  81 +
  82 + if(pageNumber.search(pattern) >= 0)
  83 + {
  84 + var num = parseInt(pageNumber);
  85 + return num;
  86 + }
  87 + return 1;
  88 + }
  89 + catch(e){
  90 + return 1;
  91 + }
  92 + }
  93 + return 1;
  94 + }
  95 +
  96 + //console.log(getPageNumber());
  97 +
  98 + $('#dg').datagrid({
  99 + url:'<%=basePath %>type/grid.json',
  100 + //queryParams:$("#searchForm").serializeJson(),
  101 + pageNumber:getPageNumber(),
  102 + view: detailview,
  103 + detailFormatter:function(index,row){
  104 + return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
  105 + }
  106 + });
  107 + });
  108 +
  109 + function editFormat(val,row,index){
  110 +
  111 + var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="updateType('+row.id+')" lay-event="choose"><i class="iconfont">&#xe65a;</i></a>'
  112 + return html;
  113 + }
  114 +
  115 +
  116 + function doSearch(){
  117 + $('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
  118 + $('#dg').datagrid("reload");
  119 + }
  120 +
  121 + function getIds() {
  122 + var ids = [];
  123 + var rows = $("#dg").datagrid('getChecked');
  124 + $.each(rows,function(key,v){
  125 + ids.push(v.id);
  126 + });
  127 + return ids;
  128 + }
  129 +
  130 + //添加
  131 + function doSave() {
  132 + layer.open({
  133 + type : 2,
  134 + title : '新增',
  135 + maxmin : true,
  136 + shadeClose : false, // 点击遮罩关闭层
  137 + area : [ '700px', '350px' ],
  138 + content : '<%=basePath %>type/add'
  139 + });
  140 + }
  141 +
  142 + function updateType(id) {
  143 + // iframe层
  144 + layer.open({
  145 + type : 2,
  146 + title : '修改一级类',
  147 + maxmin : true,
  148 + shadeClose : false, // 点击遮罩关闭层
  149 + area : [ '450px', '300px' ],
  150 + content : '<%=basePath %>type/edit?id='+id
  151 + });
  152 + }
  153 +
  154 + function doDelete(){
  155 + var rows = $("#dg").datagrid('getChecked');
  156 + if(rows.length==0){
  157 + layer.open({content:"<spring:message code="opt.selectone" />"});
  158 + return false;
  159 + }
  160 + layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
  161 + $.post("<%=basePath %>hzinfo/delete",{ids:getIds().join(",")},function(data){
  162 + if(data.status == 200) {
  163 + layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  164 + window.location.href="<%=basePath %>hzinfo/list";
  165 + })
  166 + }else{
  167 + layer.open({content:"<spring:message code="opt.delfailed" />!"});
  168 + }
  169 + },"json");
  170 +
  171 + });
  172 + }
  173 +
  174 + $("#manifnum").keyup(function(){
  175 + var leng = $("#manifnum").val().length;
  176 + if (leng == 3)
  177 + {
  178 + $("#manifnum").val( $("#manifnum").val()+"-")
  179 + }
  180 + })
  181 +
  182 + function getIds() {
  183 + var ids = [];
  184 + var rows = $("#dg").datagrid('getChecked');
  185 + $.each(rows,function(key,v){
  186 + ids.push(v.id);
  187 + });
  188 + return ids;
  189 + }
  190 +
  191 + function doDelete(){
  192 + var rows = $("#dg").datagrid('getChecked');
  193 + if(rows.length==0){
  194 + layer.open({content:"<spring:message code="opt.selectone" />"});
  195 + return false;
  196 + }
  197 + layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
  198 + $.post("<%=basePath %>type/delete",{ids:getIds().join(",")},function(data){
  199 + if(data.status == 200) {
  200 + layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  201 + window.location.href="<%=basePath %>type/list";
  202 + })
  203 + }else{
  204 + layer.open({content:"<spring:message code="opt.delfailed" />!"});
  205 + }
  206 + },"json");
  207 +
  208 + });
  209 + }
  210 +
  211 +</script>
  212 +</body>
  213 +</html>
  214 +
  215 +
  1 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  3 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!DOCTYPE html>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  13 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  14 + <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
  15 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  16 + <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
  17 + <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  18 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
  19 + <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
  20 + <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
  21 + <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
  22 + <!-- validate 验证中英文 -->
  23 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  24 +</head>
  25 +<body>
  26 + <div class="container">
  27 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <table class="kv-table">
  31 + <tbody>
  32 + <tr>
  33 + <td class="kv-label">名称</td>
  34 + <td class="kv-content">
  35 + <input id="type_name" name="type_name" type="text" required/>
  36 + </td>
  37 + </tr>
  38 + <%--<tr>--%>
  39 + <%--<td class="kv-label">排序字段</td>--%>
  40 + <%--<td class="kv-content">--%>
  41 + <%--<input id="type_order" name="type_order" type="text" />--%>
  42 + <%--</td>--%>
  43 + <%--</tr>--%>
  44 + <tr>
  45 + <td colspan="6">
  46 + <div class="opt-buttons" style="padding-top:20px;">
  47 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  48 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  49 + </button>
  50 + </div>
  51 + </td>
  52 + </tr>
  53 + </tbody>
  54 + </table>
  55 + </form>
  56 + </div>
  57 + </div>
  58 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  59 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  60 + <script src="<%=basePath %>resource/js/tools.js"></script>
  61 + <script type="text/javascript">
  62 + $("#form").validate({
  63 + submitHandler:function(form){
  64 + submit();
  65 + }
  66 + });
  67 +
  68 + var selectFals = false;
  69 + function submit(){
  70 + // if (selectFals == true){
  71 + var data = $("#form").serialize();
  72 + $.post("<%=basePath%>type/bigSave",data,function(data){
  73 + if(data.status==200){
  74 + layer.confirm("<spring:message code="opt.savesuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  75 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  76 + parent.layer.close(index);
  77 + window.parent.location.reload();
  78 + })
  79 + }else if (data.status == 201){
  80 + alert("名称不可以重复")
  81 + }else {
  82 + alert("网络异常")
  83 + }
  84 + })
  85 + // }else {
  86 + // alert("货主类型至少选择一项");
  87 + // return false;
  88 + // }
  89 + }
  90 + </script>
  91 +</body>
  92 +</html>
  1 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  3 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!DOCTYPE html>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  13 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  14 + <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
  15 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  16 + <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
  17 + <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  18 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
  19 + <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
  20 + <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
  21 + <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
  22 + <!-- validate 验证中英文 -->
  23 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  24 +</head>
  25 +<body>
  26 + <div class="container">
  27 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <table class="kv-table">
  31 + <tbody>
  32 + <tr>
  33 + <td class="kv-label">
  34 + 一级类名称<span class="required_span">*</span>
  35 + </td>
  36 + <td class="kv-content">
  37 + <select id="big_type_id" name="big_type_id">
  38 + <%--<option value=""></option>--%>
  39 + <c:forEach items="${big}" var="big">
  40 + <option value="${big.id}">${big.type_name}</option>
  41 + </c:forEach>
  42 + </select>
  43 + </td>
  44 + </tr>
  45 + <tr>
  46 + <td class="kv-label">
  47 + 二级名称<span class="required_span">*</span>
  48 + </td>
  49 + <td class="kv-content">
  50 + <input id="two_type_name" name="two_type_name" type="text" required/>
  51 + </td>
  52 + </tr>
  53 + <tr>
  54 + <td class="kv-label">
  55 + 货物名称<span class="required_span">*</span>
  56 + </td>
  57 + <td class="kv-content">
  58 + <select id="cargo_name" name="cargo_name">
  59 + <%--<option value=""></option>--%>
  60 + <c:forEach items="${cargo}" var="cargo">
  61 + <option value="${cargo}">${cargo}</option>
  62 + </c:forEach>
  63 + </select>
  64 + </td>
  65 + </tr>
  66 + <%--<tr>--%>
  67 + <%--<td class="kv-label">排序字段</td>--%>
  68 + <%--<td class="kv-content">--%>
  69 + <%--<input id="two_type_order" name="two_type_order" type="text"/>--%>
  70 + <%--</td>--%>
  71 + <%--</tr>--%>
  72 + <tr>
  73 + <td colspan="6">
  74 + <div class="opt-buttons" style="padding-top:20px;">
  75 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  76 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  77 + </button>
  78 + </div>
  79 + </td>
  80 + </tr>
  81 + </tbody>
  82 + </table>
  83 + </form>
  84 + </div>
  85 + </div>
  86 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  87 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  88 + <script src="<%=basePath %>resource/js/tools.js"></script>
  89 + <script type="text/javascript">
  90 + $("#form").validate({
  91 + submitHandler:function(form){
  92 + submit();
  93 + }
  94 + });
  95 +
  96 + var selectFals = false;
  97 + function submit(){
  98 + // if (selectFals == true){
  99 + var data = $("#form").serialize();
  100 + $.post("<%=basePath%>type/twoSave",data,function(data){
  101 + if(data.status==200){
  102 + layer.confirm("<spring:message code="opt.savesuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  103 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  104 + parent.layer.close(index);
  105 + window.parent.location.reload();
  106 + })
  107 + }else {
  108 + alert("网络异常")
  109 + }
  110 + })
  111 +
  112 + }
  113 + </script>
  114 +</body>
  115 +</html>
  1 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  3 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!DOCTYPE html>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  13 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  14 + <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
  15 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  16 + <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
  17 + <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  18 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
  19 + <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
  20 + <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
  21 + <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
  22 + <!-- validate 验证中英文 -->
  23 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  24 +</head>
  25 +<body>
  26 + <div class="container">
  27 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <input type="hidden" id="id" name="id" value="${one.id}">
  31 + <table class="kv-table">
  32 + <tbody>
  33 + <tr>
  34 + <td class="kv-label">
  35 + 一级类名称<span class="required_span">*</span>
  36 + </td>
  37 + <td class="kv-content">
  38 + <select id="big_type_id" name="big_type_id">
  39 + <%--<option value=""></option>--%>
  40 + <c:forEach items="${big}" var="big">
  41 + <option value="${big.id}" ${big.id eq one.big_type_id?"selected":""} >${big.type_name}</option>
  42 + </c:forEach>
  43 + </select>
  44 + </td>
  45 + </tr>
  46 +
  47 + <tr>
  48 + <td class="kv-label">
  49 + 二级名称<span class="required_span">*</span>
  50 + </td>
  51 + <td class="kv-content">
  52 + <input id="two_type_name" name="two_type_name" value="${one.two_type_name}" type="text" required/>
  53 + </td>
  54 + </tr>
  55 + <%--<tr>--%>
  56 + <%--<td class="kv-label">排序字段</td>--%>
  57 + <%--<td class="kv-content">--%>
  58 + <%--<input id="two_type_order" name="two_type_order" value="${one.two_type_order}" type="text" required/>--%>
  59 + <%--</td>--%>
  60 + <%--</tr>--%>
  61 + <tr>
  62 + <td colspan="6">
  63 + <div class="opt-buttons" style="padding-top:20px;">
  64 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  65 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  66 + </button>
  67 + </div>
  68 + </td>
  69 + </tr>
  70 + </tbody>
  71 + </table>
  72 + </form>
  73 + </div>
  74 + </div>
  75 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  76 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  77 + <script src="<%=basePath %>resource/js/tools.js"></script>
  78 + <script type="text/javascript">
  79 + $("#form").validate({
  80 + submitHandler:function(form){
  81 + submit();
  82 + }
  83 + });
  84 +
  85 + $(function () {
  86 + $("#form").find("input[type=checkbox]").bind("click", function () {
  87 + //当前checkbox是否选中
  88 + if (this.checked){
  89 + //除当前的checkbox其他不选中
  90 + $("#form").find("input[type=checkbox]").not(this).attr("checked", false);
  91 + }
  92 + })
  93 + })
  94 +
  95 +
  96 + function submit(){
  97 +
  98 + var data = $("#form").serialize();
  99 + $.post("<%=basePath%>type/tupdate",data,function(data){
  100 + if(data.status==200){
  101 + layer.confirm("修改成功!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  102 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  103 + parent.layer.close(index);
  104 + window.parent.location.reload();
  105 + })
  106 + }else if (data.status == 201){
  107 + layer.open({content:"名称不能重复"});
  108 + }else {
  109 + layer.open({content:"网络异常!"});
  110 + }
  111 + })
  112 +
  113 + }
  114 + </script>
  115 +</body>
  116 +</html>
  1 +<%--
  2 + Created by IntelliJ IDEA.
  3 + User: lenovo
  4 + Date: 2019/3/15
  5 + Time: 9:33
  6 + To change this template use File | Settings | File Templates.
  7 +--%>
  8 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  9 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  10 +<%
  11 + String path = request.getContextPath();
  12 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  13 +%>
  14 +<!DOCTYPE html>
  15 +<html lang="en">
  16 +<head>
  17 + <meta charset="utf-8">
  18 + <meta name="viewport" content="width=device-width, initial-scale=1">
  19 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  20 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  21 + <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
  22 + <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
  23 +
  24 + <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  25 + <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  26 + <script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
  27 + <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  28 +
  29 +</head>
  30 +<body>
  31 +<div class="container">
  32 + <div data-options="closable:true">
  33 + <table id="dg" style="width:100%;" title="货主信息管理"
  34 + data-options="
  35 + rownumbers:true,
  36 + singleSelect:false,
  37 + autoRowHeight:false,
  38 + pagination:true,
  39 + fitColumns:true,
  40 + striped:true,
  41 + collapsible:true,
  42 + toolbar:'#tb',
  43 + pageSize:10">
  44 + <thead>
  45 + <tr>
  46 + <th field="." formatter="editFormat"><spring:message code="opt.edit" /></th>
  47 + <th field="bigName">一级类名称</th>
  48 + <th field="two_type_name">二级类名称</th>
  49 + <th field="cargo_name">货物品名</th>
  50 + <%--<th field="two_type_order">排序字段</th>--%>
  51 + </tr>
  52 + </thead>
  53 + </table>
  54 + <div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
  55 + <form id="searchForm">
  56 + <table class="search_form_table">
  57 + <a href="javascript:doSave()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>
  58 + <a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a>
  59 + </table>
  60 + </form>
  61 + </div>
  62 + </div>
  63 +
  64 +</div>
  65 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  66 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  67 +<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
  68 +<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
  69 +<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
  70 +<!--弹出层引入的JS-->
  71 +<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  72 +<script type="text/javascript">
  73 +
  74 + $(function(){
  75 + function getPageNumber(){
  76 + var pageNumber = window.localStorage.getItem("pageNumber");
  77 + if(typeof(pageNumber) != "undefined")
  78 + {
  79 + try{
  80 + var pattern = /^\d+$/g; //判断是否是数字
  81 +
  82 + //console.log(pageNumber.search(pattern));
  83 +
  84 + if(pageNumber.search(pattern) >= 0)
  85 + {
  86 + var num = parseInt(pageNumber);
  87 + return num;
  88 + }
  89 + return 1;
  90 + }
  91 + catch(e){
  92 + return 1;
  93 + }
  94 + }
  95 + return 1;
  96 + }
  97 +
  98 + //console.log(getPageNumber());
  99 +
  100 + $('#dg').datagrid({
  101 + url:'<%=basePath %>type/twogrid.json',
  102 + //queryParams:$("#searchForm").serializeJson(),
  103 + pageNumber:getPageNumber(),
  104 + view: detailview,
  105 + detailFormatter:function(index,row){
  106 + return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
  107 + }
  108 + });
  109 + });
  110 +
  111 + function editFormat(val,row,index){
  112 +
  113 + var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="tUpdate('+row.id+')" lay-event="choose"><i class="iconfont">&#xe65a;</i></a>'
  114 + return html;
  115 + }
  116 +
  117 +
  118 + function doSearch(){
  119 + $('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
  120 + $('#dg').datagrid("reload");
  121 + }
  122 +
  123 + function getIds() {
  124 + var ids = [];
  125 + var rows = $("#dg").datagrid('getChecked');
  126 + $.each(rows,function(key,v){
  127 + ids.push(v.id);
  128 + });
  129 + return ids;
  130 + }
  131 +
  132 + //添加
  133 + function doSave() {
  134 + layer.open({
  135 + type : 2,
  136 + title : '新增',
  137 + maxmin : true,
  138 + shadeClose : false, // 点击遮罩关闭层
  139 + area : [ '1000px', '500px' ],
  140 + content : '<%=basePath %>type/tadd'
  141 + });
  142 + }
  143 +
  144 + function tUpdate(id) {
  145 + // iframe层
  146 + layer.open({
  147 + type : 2,
  148 + title : '修改一级类',
  149 + maxmin : true,
  150 + shadeClose : false, // 点击遮罩关闭层
  151 + area : [ '1000px', '500px' ],
  152 + content : '<%=basePath %>type/tedit?id='+id
  153 + });
  154 + }
  155 +
  156 +
  157 + $("#manifnum").keyup(function(){
  158 + var leng = $("#manifnum").val().length;
  159 + if (leng == 3)
  160 + {
  161 + $("#manifnum").val( $("#manifnum").val()+"-")
  162 + }
  163 + })
  164 +
  165 + function getIds() {
  166 + var ids = [];
  167 + var rows = $("#dg").datagrid('getChecked');
  168 + $.each(rows,function(key,v){
  169 + ids.push(v.id);
  170 + });
  171 + return ids;
  172 + }
  173 +
  174 + function doDelete(){
  175 + var rows = $("#dg").datagrid('getChecked');
  176 + if(rows.length==0){
  177 + layer.open({content:"<spring:message code="opt.selectone" />"});
  178 + return false;
  179 + }
  180 + layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
  181 + $.post("<%=basePath %>type/tdelete",{ids:getIds().join(",")},function(data){
  182 + if(data.status == 200) {
  183 + layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  184 + window.location.href="<%=basePath %>type/tlist";
  185 + })
  186 + }else{
  187 + layer.open({content:"<spring:message code="opt.delfailed" />!"});
  188 + }
  189 + },"json");
  190 +
  191 + });
  192 + }
  193 +
  194 +</script>
  195 +</body>
  196 +</html>
  197 +
  198 +
  1 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  3 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!DOCTYPE html>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  13 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  14 + <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
  15 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  16 + <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
  17 + <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  18 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
  19 + <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
  20 + <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
  21 + <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
  22 + <!-- validate 验证中英文 -->
  23 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  24 +</head>
  25 +<body>
  26 + <div class="container">
  27 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <input type="hidden" id="id" name="id" value="${big.id}">
  31 + <table class="kv-table">
  32 + <tbody>
  33 + <tr>
  34 + <td class="kv-label">名称</td>
  35 + <td class="kv-content">
  36 + <input id="type_name" name="type_name" type="text" value="${big.type_name}" required/>
  37 + </td>
  38 + </tr>
  39 +
  40 + <%--<tr>--%>
  41 + <%--<td class="kv-label">排序字段</td>--%>
  42 + <%--<td class="kv-content">--%>
  43 + <%--<input id="type_order" name="type_order" type="text" value="${big.type_order}"/>--%>
  44 + <%--</td>--%>
  45 + <%--</tr>--%>
  46 + <tr>
  47 + <td colspan="6">
  48 + <div class="opt-buttons" style="padding-top:20px;">
  49 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  50 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  51 + </button>
  52 + </div>
  53 + </td>
  54 + </tr>
  55 + </tbody>
  56 + </table>
  57 + </form>
  58 + </div>
  59 + </div>
  60 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  61 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  62 + <script src="<%=basePath %>resource/js/tools.js"></script>
  63 + <script type="text/javascript">
  64 + $("#form").validate({
  65 + submitHandler:function(form){
  66 + submit();
  67 + }
  68 + });
  69 +
  70 + $(function () {
  71 + $("#form").find("input[type=checkbox]").bind("click", function () {
  72 + //当前checkbox是否选中
  73 + if (this.checked){
  74 + //除当前的checkbox其他不选中
  75 + $("#form").find("input[type=checkbox]").not(this).attr("checked", false);
  76 + }
  77 + })
  78 + })
  79 +
  80 +
  81 + function submit(){
  82 +
  83 + var data = $("#form").serialize();
  84 + $.post("<%=basePath%>type/update",data,function(data){
  85 + if(data.status==200){
  86 + layer.confirm("修改成功!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  87 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  88 + parent.layer.close(index);
  89 + window.parent.location.reload();
  90 + })
  91 + }else if (data.status == 201){
  92 + layer.open({content:"名称不能重复"});
  93 + }else {
  94 + layer.open({content:"网络异常!"});
  95 + }
  96 + })
  97 +
  98 + }
  99 + </script>
  100 +</body>
  101 +</html>